コード例 #1
0
        private void SubscribeToLayerInitializationEvents(Layer layer, bool subscribe)
        {
            if (layer == null)
            {
                return;
            }

            if (subscribe)
            {
                //unsubscribe from events
                CustomGraphicsLayer cgl = layer as CustomGraphicsLayer;
                if (cgl != null)
                {
                    cgl.UpdateFailed    += layerUpdateFailed;
                    cgl.UpdateCompleted += layerUpdateCompleted;
                }
                else
                {
                    FeatureLayer fl = layer as FeatureLayer;
                    if (fl != null)
                    {
                        fl.UpdateFailed    += layerUpdateFailed;
                        fl.UpdateCompleted += layerUpdateCompleted;
                    }
                    else
                    {
                        layer.InitializationFailed += layerInitFailed;
                        layer.Initialized          += layerUpdateCompleted;
                    }
                }
            }
            else
            {
                //unsubscribe from events
                CustomGraphicsLayer cgl = layer as CustomGraphicsLayer;
                if (cgl != null)
                {
                    cgl.UpdateFailed    -= layerUpdateFailed;
                    cgl.UpdateCompleted -= layerUpdateCompleted;
                }
                else
                {
                    FeatureLayer fl = layer as FeatureLayer;
                    if (fl != null)
                    {
                        fl.UpdateFailed    -= layerUpdateFailed;
                        fl.UpdateCompleted -= layerUpdateCompleted;
                    }
                    else
                    {
                        layer.InitializationFailed -= layerInitFailed;
                        layer.Initialized          -= layerUpdateCompleted;
                    }
                }
            }
        }
コード例 #2
0
        public void Execute(object parameter)
        {
            ESRI.ArcGIS.Client.Extensibility.PopupInfo param = parameter as ESRI.ArcGIS.Client.Extensibility.PopupInfo;
            if (param == null || param.PopupItem == null)
            {
                return;
            }
            CustomGraphicsLayer cgl = param.PopupItem.Layer as CustomGraphicsLayer;

            if (cgl != null && param.PopupItem.Graphic != null)
            {
                cgl.OnItemClicked(param.PopupItem.Graphic);
            }
        }
コード例 #3
0
        public bool CanExecute(object parameter)
        {
            ESRI.ArcGIS.Client.Extensibility.PopupInfo param = parameter as ESRI.ArcGIS.Client.Extensibility.PopupInfo;
            if (param == null || param.PopupItem == null)
            {
                return(false);
            }
            CustomGraphicsLayer cgl = param.PopupItem.Layer as CustomGraphicsLayer;

            if (cgl != null && param.PopupItem.Graphic != null)
            {
                return(true);
            }
            return(false);
        }