How I Converted Events 03.03.08 Source Code to work with VS2005. I hope this will be useful to others.
On my development machine I installed DNN 3.x and DNN 4.x. The source version of Events was then installed onto the DNN3 site.
Using the Dotnetnuke Module Upgrade Wizard the Events source files were transferred to the DNN4 site.
Before the converted code would run error free I made the following changes
I deleted the source files/directories for the Scheduler and Web controls. I didn't plan on modifying the controls and ASP.Net doesn't like the fact that the web control was written in C#. So that DNN could still reference the controls, I placed the original DotNetNuke.Events.WebControls.dll and DotNetNuke.Events.ScheduleControl.dll in the DNN4 bin folder. (I have included the source files for the controls in past conversions but it requires a little more work.)
Using VS2005 I tried to Build the DNN4 site, encountering hundreds of errors. I opened all the .ascx.vb files and deleted the "Protected WithEvents" control references. This eliminated most of the errors.
In EventController.vb I marked the EventSignupsController Class as Public.
In EventController.vb I changed the ProcessRequest Sub. Here is the replacement subroutine.
In EventController.vb I changed a line in SetDefaultModuleSettings to prevent a warning.
' Dslage - Modified the next line to correct warning.
Dim PortalSettings As DotNetNuke.Entities.Portals.PortalSettings = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings
In DataProver.vb I removed a reference to the original assembly dll in the CreateProvider Sub. This doesn't create a build error but will cause the application to crash when you add an event.
'DSlage - removed assembly name from third parameter
objProvider = CType(Framework.Reflection.CreateObject("data", "DotNetNuke.Modules.Events.Data", ""), DataProvider)
Whenever convenient I would also comment out lines creating unused variable warnings.
At this point my DNN4 builds without errors but I couldn't use the module because the upgrade wizard does not actually install the upgraded modules into DNN. You could manually configure the Events module pages and manually run the SQL files. But I choose to create a modified install zip file that installs the Events module without transferring any files or dlls.
I haven't tested everything but so far so good.
Questions and comments welcome.
'DSlage - I added the Dim oRequest and oResponse - The old code using oContext.current.request created errors
Public Sub ProcessRequest(ByVal oContext As HttpContext) Implements IHttpHandler.ProcessRequest
Dim oRequest As HttpRequest = oContext.Request
Dim oResponse As HttpResponse = oContext.Response
If (iItemID = 0) And (oRequest.QueryString("itemID") = "") Then
Exit Sub
End If
' Need to Switch Thread Culture in order to Obtain Correct Date Format in Querystring
System.Threading.Thread.CurrentThread.CurrentCulture = New CultureInfo(oRequest.QueryString("culture"))
If oRequest.QueryString("selecteddate") = Nothing Or Not IsDate(oRequest.QueryString("selecteddate")) Then
Exit Sub
End If
Dim selecteddate As Date = Convert.ToDateTime(oRequest.QueryString("selecteddate"))
Dim oEvent As New EventInfo
Dim oCntrl As New EventController
If Not oRequest.QueryString("itemID") = "" Then
iItemID = CType(oRequest.QueryString("itemID"), Long)
End If
oEvent = oCntrl.EventsGet(CInt(iItemID))
Dim vEvent As StringBuilder = GetOutlookEvent(CInt(iItemID), oContext, selecteddate)
If vEvent Is Nothing Then
Exit Sub
End If
' Stream The vCalendar
Dim oStream As HttpResponse
oStream = oResponse
oStream.ContentEncoding = System.Text.Encoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.ANSICodePage)
oStream.ContentType = "text/x-vCalendar"
oStream.AppendHeader("Content-Disposition", "filename=" & HttpUtility.UrlEncode(oEvent.EventName) & ".vcs")
oStream.Write(vEvent.ToString)
oStream = Nothing
vEvent = Nothing
oEvent = Nothing
End Sub