当前位置: 首页>>代码示例>>C#>>正文


C# FeatureLayer.Update方法代码示例

本文整理汇总了C#中FeatureLayer.Update方法的典型用法代码示例。如果您正苦于以下问题:C# FeatureLayer.Update方法的具体用法?C# FeatureLayer.Update怎么用?C# FeatureLayer.Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FeatureLayer的用法示例。


在下文中一共展示了FeatureLayer.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SbAddClick

        private void SbAddClick(object sender, RoutedEventArgs e)
        {
            var l = ((FrameworkElement) sender).DataContext as StoredLayer;
            if (l == null) return;

            switch (l.Type)
            {
                case "Map Service":
                    var ml = new ArcGISImageServiceLayer();
                    

                    ml.Url = l.Id;
                    ml.ID = l.Title;
                    ml.Visible = true;
                    
                    var pts = AppStateSettings.Instance.ViewDef.FindOrCreateAcceleratedGroupLayer(l.Path);
                    pts.ChildLayers.Add(ml);
                    ml.Initialize();
                    
                    break;
                // FIXME TODO: Unreachable code
                    //break;
                case "Feature Service":
                    var fl = new FeatureLayer() {};

                    fl.Url = l.Id + @"/0";
                    fl.ID = l.Title;
                    fl.Visible = true;
                    fl.InitializationFailed += fl_InitializationFailed;
                    fl.Initialized += fl_Initialized;
                    fl.UpdateCompleted += fl_UpdateCompleted;
                    var pt = AppStateSettings.Instance.ViewDef.FindOrCreateAcceleratedGroupLayer(l.Path);
                    pt.ChildLayers.Add(fl);
                    fl.Initialize();
                    fl.Update();
                    break;
                case "wms":
                    var wl = new WmsLayer {
                                              SupportedSpatialReferenceIDs = new[] {102100},
                                              Visible = false
                                          };
                    wl.Visible = true;
                    wl.SkipGetCapabilities = false;
                    wl.Initialized += (st, es) => { wl.Layers = wl.LayerList.Select(k => k.Title).ToArray(); };
                    wl.Url = l.Id;
                    wl.ID = l.Title;
                    wl.Title = l.Title;

                    var p = AppStateSettings.Instance.ViewDef.FindOrCreateGroupLayer(l.Path);
                    p.ChildLayers.Add(wl);
                    wl.Initialize();

                    break;
            }
            AppStateSettings.Instance.ViewDef.StoredLayers.Add(l);
            AppStateSettings.Instance.ViewDef.StoredLayers.Save();
        }
开发者ID:TNOCS,项目名称:csTouch,代码行数:57,代码来源:NewLayerView.xaml.cs

示例2: VersionsCombo_SelectionChanged

 private void VersionsCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Fl = (MyMap.Layers["ServiceConnections"] as FeatureLayer);
       Fl.GdbVersion = (e.AddedItems[0] as Graphic).Attributes["name"].ToString();
       Fl.Update();
 }
开发者ID:konglingjie,项目名称:arcgis-samples-silverlight,代码行数:6,代码来源:FeatureLayerChangeVersion.xaml.cs

示例3: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            AddRecordButton.IsEnabled = false;

            // Create the LocalFeatureService and set MaxRecords property
            _localFeatureService = new LocalFeatureService(@"..\Maps-and-Data\CitiesOverOneMillion.mpk")
            {
                MaxRecords = 100000,
            };

            // Register an event handler for the PropertyChanged Event
            _localFeatureService.PropertyChanged += (s, propertyChangedEventArgs) =>
            {
                // Get the property
                var property = _localFeatureService.GetType().GetProperty(propertyChangedEventArgs.PropertyName);

                // Get the Value
                var value = property.GetValue(_localFeatureService, null);

                if (value == null)
                    return;

                // Get the property type
                string varType = value.GetType().ToString();

                // Display the property info
                switch (varType)
                {
                    case "System.Collections.ObjectModel.ReadOnlyCollection`1[ESRI.ArcGIS.Client.Local.LayerDetails]":
                        statusDisplay.Items.Insert(0, propertyChangedEventArgs.PropertyName + ": " + _localFeatureService.FeatureLayers.Count.ToString());
                        break;
                    default:
                        statusDisplay.Items.Insert(0, propertyChangedEventArgs.PropertyName + ": " + value.ToString());
                        break;
                }

                // Display the error
                if (_localFeatureService.Error != null)
                    statusDisplay.Items.Insert(0, "Error: " + _localFeatureService.Error.Message);
            };

            // Start the LocalFeatureService
            _localFeatureService.StartAsync(x =>
            {
                // Create a new FeatureLayer (to contain the table)
                _featureLayerTable = new FeatureLayer()
                {
                    Url = _localFeatureService.UrlFeatureService + "/1",
                    ID = "EditTable",
                    DisableClientCaching = true,
                    AutoSave = false,
                    //Do not use ESRI.ArcGIS.Client.FeatureLayer.QueryMode.OnDemand
                    Mode = ESRI.ArcGIS.Client.FeatureLayer.QueryMode.Snapshot,
                    OutFields = new OutFields() { "*" },
                };

                /*
                * Register a series of inline event handlers...
                */

                // Register an handler for the InitializationFailed event
                _featureLayerTable.InitializationFailed += (s, e) =>
                {
                    statusDisplay.Items.Insert(0, _featureLayerTable.InitializationFailure.Message);
                };

                // Register a handler for the Initialized event (raised by an explicit Initialize call)
                _featureLayerTable.Initialized += (s, e) =>
                {
                    statusDisplay.Items.Insert(0, "FeatureLayer Initialized Event Raised");
                    statusDisplay.Items.Insert(0, "FeatureLayer contains: " + _featureLayerTable.Graphics.Count.ToString() + " features"); //This will be 0.
                    _featureLayerTable.Update();
                };

                // Register a handler for the UpdateCompleted event (raised by an explicit Update call)
                _featureLayerTable.UpdateCompleted += (senderObj, eventArgs) =>
                {
                    statusDisplay.Items.Insert(0, "FeatureLayer UpdateCompleted Event Raised");
                    statusDisplay.Items.Insert(0, "FeatureLayer contains: " + _featureLayerTable.Graphics.Count.ToString() + " features"); //This will be the total number (n) graphic features (up to service query limit).
                    AddRecordButton.IsEnabled = true;
                };

                // Register a handler for the Begin Save Edits event (raised by the explicit Save Edits call)
                _featureLayerTable.BeginSaveEdits += (s1, beginEditEventArgs) =>
                {
                    statusDisplay.Items.Insert(0, "FeatureLayer BeginSaveEdits Event Raised");
                };

                // Register a handler for the End Save Edits event (raised by server response)
                _featureLayerTable.EndSaveEdits += (s2, endEditEventArgs) =>
                {
                    statusDisplay.Items.Insert(0, "## Edit Successful ##");
                    // Edit was successful - call Update to trigger a refresh and display the number of features
                    _featureLayerTable.Update();
                };

                // Register a handler for the Save Edits Failed event (raised by server response)
                _featureLayerTable.SaveEditsFailed += (s3, taskFailedEventArgs) =>
//.........这里部分代码省略.........
开发者ID:GlenDhu,项目名称:tips-and-tricks-wpf,代码行数:101,代码来源:MainWindow.xaml.cs


注:本文中的FeatureLayer.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。