Server spatial query server object extension
SpatialQuerySOE.ArcCatalog_VBNet\PropertyPage.vb
' Copyright 2010 ESRI
' 
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' 
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' 
' See the use restrictions.
' 

Imports Microsoft.VisualBasic
Imports System
Namespace SpatialQuerySOE.ArcCatalog_VBNet
  <System.Runtime.InteropServices.Guid("2378B5DC-BF24-498c-B0A2-6E8C43628EA3")> _
  Public Class PropertyPage
    Inherits SOEUtilities.SOEPropertyPage
#Region "Member Variables"

    Private m_extensionProperties As ESRI.ArcGIS.esriSystem.IPropertySet
    Private m_serverObjectProperties As ESRI.ArcGIS.esriSystem.IPropertySet
    Private m_extensionType As String
    Private m_serverObjectType As String

#End Region

    Private property_Page As PropertyForm

    Public Sub New()
      property_Page = New PropertyForm()
      m_serverObjectType = "MapServer"
      ' Must be the same name used when registering the SOE
      m_extensionType = "SpatialQuerySOE_VBNet"
    End Sub

    Protected Overrides Sub Finalize()
      property_Page.Dispose()
      property_Page = Nothing
    End Sub

#Region "SOEPropertyPage Members"

#Region "Inherited from IComPropertyPage - Activate, Show, Hide, PageSite"

    ''' <summary>
    ''' PageSite permits accessed to the PageChanged method, which, when fired, enables the Apply button on the property page
    ''' </summary>
    Public Overrides WriteOnly Property PageSite() As ESRI.ArcGIS.Framework.IComPropertyPageSite
      Set(ByVal value As ESRI.ArcGIS.Framework.IComPropertyPageSite)
        property_Page.PageSite = value
      End Set
    End Property

    ''' <summary>
    ''' Displays the form defining the property page's UI
    ''' </summary>
    Public Overrides Sub Show()
      property_Page.Show()
    End Sub

    ''' <summary>
    ''' Fired when the property page is activated
    ''' </summary>
    ''' <returns>the handle of the form containing the property page's UI</returns>
    Public Overrides Function Activate() As Integer
      Return property_Page.getHWnd()
    End Function

    ''' <summary>
    ''' Hides the form containing the property page's UI
    ''' </summary>
    Public Overrides Sub Hide()
      property_Page.Hide()
    End Sub

    Public Overrides Sub Deactivate()
      MyBase.Deactivate()
    End Sub

#End Region

#Region "Inherited from IAGSSOEParameterPage - ServerObjectProperties, ExtensionProperties, ServerObjectExtensionType, ServerObjectType"

    ''' <summary>
    ''' Properties of the server object on which the extension is configured.
    ''' </summary>
    Public Overrides Property ServerObjectProperties() As ESRI.ArcGIS.esriSystem.IPropertySet
      Get
        Return m_serverObjectProperties
      End Get
      Set(ByVal value As ESRI.ArcGIS.esriSystem.IPropertySet)
        ' Pass the location of the map document underlying the current server object to the property form
        m_serverObjectProperties = value
        property_Page.SetMap(m_serverObjectProperties.GetProperty("FilePath").ToString())
      End Set
    End Property

    ''' <summary>
    ''' Properties of the extension for the current server object.
    ''' </summary>
    Public Overrides Property ExtensionProperties() As ESRI.ArcGIS.esriSystem.IPropertySet
      Get
        ' Checking the SOE in ArcCatalog adds the following properties into the 
        ' map server cfg file -or- existing properties are updated
        m_extensionProperties.SetProperty("LayerName", property_Page.Layer)
        m_extensionProperties.SetProperty("FieldName", property_Page.Field)
        Return m_extensionProperties
      End Get
      Set(ByVal value As ESRI.ArcGIS.esriSystem.IPropertySet)
        ' Pass the extension properties to the property form
        m_extensionProperties = value
        property_Page.Layer = m_extensionProperties.GetProperty("LayerName").ToString()
        property_Page.Field = m_extensionProperties.GetProperty("FieldName").ToString()
      End Set
    End Property

    ''' <summary>
    ''' The type of the SOE.  This must match the name of the SOE as defined when it is 
    ''' registered with the SOM.
    ''' </summary>
    Public Overrides ReadOnly Property ServerObjectExtensionType() As String
      Get
        Return m_extensionType
      End Get
    End Property

    ''' <summary>
    ''' The type of server object that the SOE extends.  This SOE extends MapServer server objects.
    ''' </summary>
    Public Overrides ReadOnly Property ServerObjectType() As String
      Get
        Return m_serverObjectType
      End Get
    End Property

#End Region

#End Region
  End Class
End Namespace