SpatialQuerySOE.ArcCatalog_CSharp\PropertyPage.cs
// 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. // namespace SpatialQuerySOE.ArcCatalog { [System.Runtime.InteropServices.Guid("2EAD4A98-BB8C-4b88-A323-48F53653ACBF")] public class PropertyPage : SOEUtilities.SOEPropertyPage { #region Member Variables private ESRI.ArcGIS.esriSystem.IPropertySet m_extensionProperties; private ESRI.ArcGIS.esriSystem.IPropertySet m_serverObjectProperties; private string m_extensionType; private string m_serverObjectType; #endregion private PropertyForm propertyPage; public PropertyPage() { propertyPage = new PropertyForm(); m_serverObjectType = "MapServer"; // Must be the same name used when registering the SOE m_extensionType = "SpatialQuerySOE"; } ~PropertyPage() { propertyPage.Dispose(); propertyPage = null; } #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 override ESRI.ArcGIS.Framework.IComPropertyPageSite PageSite { set { propertyPage.PageSite = value; } } /// <summary> /// Displays the form defining the property page's UI /// </summary> public override void Show() { propertyPage.Show(); } /// <summary> /// Fired when the property page is activated /// </summary> /// <returns>the handle of the form containing the property page's UI</returns> public override int Activate() { return propertyPage.getHWnd(); } /// <summary> /// Hides the form containing the property page's UI /// </summary> public override void Hide() { propertyPage.Hide(); } public override void Deactivate() { base.Deactivate(); } #endregion #region Inherited from IAGSSOEParameterPage - ServerObjectProperties, ExtensionProperties, ServerObjectExtensionType, ServerObjectType /// <summary> /// Properties of the server object on which the extension is configured. /// </summary> public override ESRI.ArcGIS.esriSystem.IPropertySet ServerObjectProperties { get { return m_serverObjectProperties; } set { // Pass the location of the map document underlying the current server object to the property form m_serverObjectProperties = value; propertyPage.SetMap(m_serverObjectProperties.GetProperty("FilePath").ToString()); } } /// <summary> /// Properties of the extension for the current server object. /// </summary> public override ESRI.ArcGIS.esriSystem.IPropertySet ExtensionProperties { 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", propertyPage.Layer); m_extensionProperties.SetProperty("FieldName", propertyPage.Field); return m_extensionProperties; } set { // Pass the extension properties to the property form m_extensionProperties = value; propertyPage.Layer = m_extensionProperties.GetProperty("LayerName").ToString(); propertyPage.Field = m_extensionProperties.GetProperty("FieldName").ToString(); } } /// <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 override string ServerObjectExtensionType { get { return m_extensionType; } } /// <summary> /// The type of server object that the SOE extends. This SOE extends MapServer server objects. /// </summary> public override string ServerObjectType { get { return m_serverObjectType; } } #endregion #endregion } }