Exemple #1
0
        /// <summary>
        /// LayerProperty property changed handler.
        /// </summary>
        /// <param name="d">LayerCheckBox that changed its Layer.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs.</param>
        private static void OnLayerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LayerCheckBox dp = d as LayerCheckBox;

            ESRI.ArcGIS.Client.Layer newLayer = (ESRI.ArcGIS.Client.Layer)e.NewValue;
            ESRI.ArcGIS.Client.Layer oldLayer = (ESRI.ArcGIS.Client.Layer)e.OldValue;
            if (dp.Map != null)
            {
                if (oldLayer != null)
                {
                    dp.Map.Layers.Remove(oldLayer);
                }
                if (newLayer != null && dp.IsChecked.Value)
                {
                    dp.Map.Layers.Add(newLayer);
                }
            }
            if (dp.Configurator != null)
            {
                dp.Configurator.Layer = newLayer;
                if (newLayer != null)
                {
                    dp.Configurator.Title = newLayer.ID;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// MapProperty property changed handler.
        /// </summary>
        /// <param name="d">LayerCheckBox that changed its Map.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs.</param>
        private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LayerCheckBox dp = d as LayerCheckBox;

            ESRI.ArcGIS.Client.Map newMap = (ESRI.ArcGIS.Client.Map)e.NewValue;
            ESRI.ArcGIS.Client.Map oldMap = (ESRI.ArcGIS.Client.Map)e.OldValue;
            if (oldMap != null && dp.Layer != null)
            {
                oldMap.Layers.Remove(dp.Layer);
            }
            if (newMap != null && dp.Layer != null && dp.IsChecked.Value)
            {
                newMap.Layers.Add(dp.Layer);
            }
        }
Exemple #3
0
        /// <summary>
        /// ConfiguratorProperty property changed handler.
        /// </summary>
        /// <param name="d">LayerCheckBox that changed its Configurator.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs.</param>
        private static void OnConfiguratorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LayerCheckBox         dp       = d as LayerCheckBox;
            ConfiguratorContainer newPanel = (ConfiguratorContainer)e.NewValue;
            ConfiguratorContainer oldPanel = (ConfiguratorContainer)e.OldValue;

            if (oldPanel != null)
            {
                oldPanel.Layer = null;
            }
            if (newPanel != null)
            {
                newPanel.Layer = dp.Layer;
                if (dp.Layer != null)
                {
                    newPanel.Title = dp.Layer.ID;
                }
            }
        }