Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub ConnectMapGuide(pv_objUser As CObjUser, pv_strMgSessionID As String, pv_strMapName As String)
- Try
- Dim webConfigFilePath As String = Me.WebConfigFilePath
- MapGuideApi.MgInitializeWebTier(webConfigFilePath)
- Dim flag As Boolean = Operators.CompareString(pv_strMgSessionID, "", False) = 0
- If flag Then
- Dim userInformation As MgUserInformation = New MgUserInformation("Anonymous", "")
- Dim mgSite As MgSite = New MgSite()
- mgSite.Open(userInformation)
- Me.m_strSessionID = mgSite.CreateSession()
- Else
- Dim userInformation2 As MgUserInformation = New MgUserInformation(pv_strMgSessionID)
- Dim mgSiteConnection As MgSiteConnection = New MgSiteConnection()
- mgSiteConnection.Open(userInformation2)
- Me.m_mgResourceService = CType(mgSiteConnection.CreateService(0), MgResourceService)
- Me.m_mgFeatureService = CType(mgSiteConnection.CreateService(2), MgFeatureService)
- Me.m_mgMap.Open(Me.ResourceService, pv_strMapName)
- End If
- Catch ex As Exception
- Me.errHandl.ErrorRaised(ex, pv_objUser, "MapGuide")
- Dim flag As Boolean = Operators.CompareString(ex.Message, "Session has expired or is invalid. Please log in again.", False) = 0
- If flag Then
- Dim userInformation3 As MgUserInformation = New MgUserInformation("Anonymous", "")
- Dim mgSite2 As MgSite = New MgSite()
- mgSite2.Open(userInformation3)
- Me.m_strSessionID = mgSite2.CreateSession()
- End If
- End Try
- End Sub
- Public Function DoesResourceExist(pv_mgresourceIdentifier As MgResourceIdentifier, pv_mgresourceService As MgResourceService) As Boolean
- Try
- pv_mgresourceService.GetResourceContent(pv_mgresourceIdentifier)
- Catch ex As Exception
- Return False
- End Try
- Return True
- End Function
- Public Sub ChangeLayerVisibility(pv_objUser As CObjUser, pv_strLayerName As String, pv_blnVisible As Boolean)
- Try
- Dim layers As MgLayerCollection = Me.Map.GetLayers()
- Dim mgLayer As MgLayer = CType(layers.GetItem(pv_strLayerName), MgLayer)
- mgLayer.Visible = pv_blnVisible
- mgLayer.DisplayInLegend = pv_blnVisible
- Me.Map.Save(Me.ResourceService)
- Catch pv_objExc As Exception
- Me.errHandl.ErrorRaised(pv_objExc, pv_objUser, "")
- End Try
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement