public ServicePropertyEditor(MSCFeatureService fs)
        {
            this.mscFeatureService = fs;
            AGSFeatureService parentService = fs.ParentService;

            if (parentService == null)
            {
                throw new Exception("Service not connected");
            }
            this.InitializeComponent();
            if (parentService == null)
            {
                return;
            }
            this.localFeatureService = (AGSFeatureService)Utility.CloneObject(parentService);
            this.localFeatureService.ExportOptions         = (AGSExportOptions)Utility.CloneObject(fs.ExportOptions);
            this.localFeatureService.ExportOptions.Dynamic = !this.mscFeatureService.QueryOnly;
            AGSFeatureServiceLayer aGSFeatureServiceLayer = (AGSFeatureServiceLayer)parentService.MapLayers[fs.ServiceLayerID];

            if (aGSFeatureServiceLayer != null)
            {
                this.spProps.SetService(aGSFeatureServiceLayer, fs.ExportOptions);
            }
            else
            {
                this.spProps.SetService(this.localFeatureService, fs.ExportOptions);
            }
            this.spProps.ExtentOptions.Add(AfaStrings.Current, fs.ExportOptions.BoundingBox);
            this.spProps.cbBoundingBoxTypes.SelectedIndex = this.spProps.ExtentOptions.Count - 1;
        }
Esempio n. 2
0
 public void SetService(object o)
 {
     try
     {
         if (!object.Equals(o, this.ThisService))
         {
             this.ThisService = o;
             this.exServiceInfo.Visibility = Visibility.Collapsed;
             this.exExportProps.Visibility = Visibility.Collapsed;
             bool dynamic = true;
             if (this.ExportOptions != null)
             {
                 dynamic = this.ExportOptions.Dynamic;
             }
             if (o != this.lbServiceInfo.ItemsSource)
             {
                 AGSObject aGSObject = o as AGSObject;
                 if (aGSObject != null)
                 {
                     this.IgnoreTextBoxChange       = true;
                     this.lbServiceInfo.ItemsSource = aGSObject.Properties;
                     string text = "";
                     if (this.cbBoundingBoxTypes.SelectedItem != null)
                     {
                         text = this.cbBoundingBoxTypes.SelectedItem.ToString();
                     }
                     this.ExtentOptions = this.BuildExtentOptions(aGSObject);
                     this.cbBoundingBoxTypes.ItemsSource = this.ExtentOptions.Keys;
                     Extent obj;
                     if (this.ExtentOptions.TryGetValue(text, out obj))
                     {
                         this.cbBoundingBoxTypes.SelectedValue = text;
                         this.ctrlBoundingBoxExtent.Content    = Utility.CloneObject(obj);
                     }
                     else
                     {
                         this.cbBoundingBoxTypes.SelectedIndex = 0;
                         this.ctrlBoundingBoxExtent.Content    = Utility.CloneObject(this.ExtentOptions.Values.ElementAt(0));
                     }
                     this.IgnoreTextBoxChange = false;
                 }
                 AGSLayer aGSLayer = o as AGSLayer;
                 if (aGSLayer != null)
                 {
                     this.IgnoreTextBoxChange       = true;
                     this.lbServiceInfo.ItemsSource = aGSLayer.Properties;
                     this.exServiceInfo.Visibility  = Visibility.Visible;
                     string text2 = "";
                     if (this.cbBoundingBoxTypes.SelectedItem != null)
                     {
                         text2 = this.cbBoundingBoxTypes.SelectedItem.ToString();
                     }
                     this.ExtentOptions = this.BuildExtentOptions(aGSLayer.Service);
                     this.cbBoundingBoxTypes.ItemsSource = this.ExtentOptions.Keys;
                     Extent obj2;
                     if (this.ExtentOptions.TryGetValue(text2, out obj2))
                     {
                         this.cbBoundingBoxTypes.SelectedValue = text2;
                         this.ctrlBoundingBoxExtent.Content    = Utility.CloneObject(obj2);
                     }
                     else
                     {
                         this.cbBoundingBoxTypes.SelectedIndex = 0;
                         this.ctrlBoundingBoxExtent.Content    = Utility.CloneObject(this.ExtentOptions.Values.ElementAt(0));
                     }
                     this.IgnoreTextBoxChange      = false;
                     this.exExportProps.Visibility = Visibility.Visible;
                     this.ctrlExportProps.Content  = aGSLayer;
                     this.ExportOptions            = aGSLayer.Service.ExportOptions;
                     this.ExportOptions.Dynamic    = dynamic;
                 }
                 else
                 {
                     AGSFeatureServiceLayer aGSFeatureServiceLayer = o as AGSFeatureServiceLayer;
                     if (aGSFeatureServiceLayer == null)
                     {
                         AGSFeatureService aGSFeatureService = o as AGSFeatureService;
                         if (aGSFeatureService != null)
                         {
                             this.lbServiceInfo.ItemsSource = aGSFeatureService.Properties;
                             this.exServiceInfo.Visibility  = Visibility.Visible;
                             this.exExportProps.Visibility  = Visibility.Visible;
                             this.ctrlExportProps.Content   = aGSFeatureService;
                             this.ExportOptions             = aGSFeatureService.ExportOptions;
                             this.ExportOptions.Dynamic     = dynamic;
                         }
                         AGSService aGSService = o as AGSService;
                         if (aGSService != null)
                         {
                             this.lbServiceInfo.ItemsSource = aGSService.Properties;
                             this.exServiceInfo.Visibility  = Visibility.Visible;
                             this.exExportProps.Visibility  = Visibility.Visible;
                             this.ctrlExportProps.Content   = aGSService;
                             this.ExportOptions             = aGSService.ExportOptions;
                             this.ExportOptions.Dynamic     = dynamic;
                         }
                         AGSImageService aGSImageService = o as AGSImageService;
                         if (aGSImageService != null)
                         {
                             foreach (AGSField current in aGSImageService.Fields.Values)
                             {
                                 if (!(current.Type == "esriFieldTypeOID") && !(current.Type == "esriFieldTypeGeometry"))
                                 {
                                     this.OrderFieldChoices.Add(current.Name);
                                 }
                             }
                             string version = aGSImageService.Version;
                             if (version.StartsWith("9"))
                             {
                                 this.LimitedImageSupport = true;
                             }
                         }
                     }
                 }
             }
         }
     }
     catch
     {
         MessageBox.Show("In Catch of SetService");
     }
 }