void popupButton_Click(object sender, RoutedEventArgs e)
 {
     if (mapTipsConfig == null)
     {
         mapTipsConfig = new MapTipsConfig()
         {
             Width     = 350,
             MaxHeight = 400,
             Layer     = Layer,
             Style     = ResourceUtility.LoadEmbeddedStyle("Themes/MapTipsConfig.Theme.xaml", "MapTipsConfigStyle"),
             Margin    = new Thickness(10)
         };
     }
     MapApplication.Current.ShowWindow(Resources.Strings.ConfigurePopups, mapTipsConfig, true, null, null,
                                       WindowType.DesignTimeFloating);
 }
예제 #2
0
 private void popupButton_Click(object sender, RoutedEventArgs e)
 {
     if (mapTipsConfig == null)
     {
         ArcGISDynamicMapServiceLayer dummyLayer = new ArcGISDynamicMapServiceLayer();
         ESRI.ArcGIS.Mapping.Core.LayerExtensions.SetLayerInfos(dummyLayer, LayerInfos);
         mapTipsConfig = new MapTipsConfig()
         {
             VerticalAlignment = VerticalAlignment.Stretch,
             Layer             = dummyLayer,
             Style             = ResourceUtility.LoadEmbeddedStyle("Themes/MapTipsConfig.Theme.xaml", "MapTipsConfigStyle"),
             Margin            = new Thickness(10)
         };
     }
     MapApplication.Current.ShowWindow(Resources.Strings.ConfigurePopups, mapTipsConfig, true, null, null, WindowType.DesignTimeFloating);
 }
예제 #3
0
        public override void AddConfigUI(System.Windows.Controls.Grid grid)
        {
            TextBlock label;

            #region Header
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            Grid g = new Grid();
            g.ColumnDefinitions.Add(new ColumnDefinition());
            g.ColumnDefinitions.Add(new ColumnDefinition());
            g.RowDefinitions.Add(new RowDefinition());
            label = new TextBlock()
            {
                Text = Name,
                VerticalAlignment = System.Windows.VerticalAlignment.Center,
                Margin            = new Thickness(2, 10, 2, 2),
                FontWeight        = FontWeights.Bold,
                TextTrimming      = TextTrimming.WordEllipsis
            };
            g.Children.Add(label);
            g.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            g.SetValue(Grid.ColumnSpanProperty, 2);
            grid.Children.Add(g);
            #endregion

            #region Type
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            label = new TextBlock()
            {
                Text              = Resources.Strings.LabelType,
                Margin            = new Thickness(2),
                VerticalAlignment = System.Windows.VerticalAlignment.Center
            };
            label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            grid.Children.Add(label);
            label = new TextBlock()
            {
                Text              = Type.ToString(),
                Margin            = new Thickness(2),
                VerticalAlignment = System.Windows.VerticalAlignment.Center
            };
            label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            label.SetValue(Grid.ColumnProperty, 1);
            grid.Children.Add(label);
            #endregion

            #region Layer name
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            label = new TextBlock()
            {
                Text              = Resources.Strings.LabelLayerName,
                Margin            = new Thickness(2),
                VerticalAlignment = System.Windows.VerticalAlignment.Center
            };
            label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            grid.Children.Add(label);
            TextBox tb = new TextBox()
            {
                Text   = LayerName,
                Margin = new Thickness(2),
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
            };
            tb.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            tb.SetValue(Grid.ColumnProperty, 1);
            grid.Children.Add(tb);
            tb.TextChanged += (s, e) =>
            {
                LayerName = tb.Text;
            };
            #endregion

            #region Popups config
            if (SupportsJobResource && LayerInfos != null && LayerInfos.Count > 0 && LayerInfos.All(l => l.Fields != null && l.Fields.Count > 0))
            {
                grid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });
                label = new TextBlock()
                {
                    Text              = Resources.Strings.LabelPopUps,
                    Margin            = new Thickness(2),
                    VerticalAlignment = System.Windows.VerticalAlignment.Center
                };
                label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
                grid.Children.Add(label);
                Button popupButton = new Button
                {
                    Content = new Image
                    {
                        Source              = new BitmapImage(new Uri("/ESRI.ArcGIS.Mapping.GP;component/Images/Show_Popup16.png", UriKind.Relative)),
                        Stretch             = Stretch.None,
                        VerticalAlignment   = System.Windows.VerticalAlignment.Center,
                        HorizontalAlignment = System.Windows.HorizontalAlignment.Center
                    },
                    Width = 22,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Style = Application.Current.Resources["SimpleButtonStyle"] as Style
                };
                ToolTipService.SetToolTip(popupButton, Resources.Strings.ConfigurePopupFieldAliasesAndVisibility);
                popupButton.Click += popupButton_Click;
                popupButton.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
                popupButton.SetValue(Grid.ColumnProperty, 1);
                grid.Children.Add(popupButton);
            }
            #endregion

            #region Opacity
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            label = new TextBlock()
            {
                Text              = Resources.Strings.LabelTransparency,
                Margin            = new Thickness(2),
                VerticalAlignment = System.Windows.VerticalAlignment.Top
            };
            label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            grid.Children.Add(label);

            ContentControl sliderOpacity = new ContentControl()
            {
                DataContext = this,
                Style       = ResourceUtility.LoadEmbeddedStyle("Themes/HorizontalTransparencySlider.xaml", "TransparencySliderStyle")
            };
            sliderOpacity.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            sliderOpacity.SetValue(Grid.ColumnProperty, 1);
            grid.Children.Add(sliderOpacity);
            #endregion
        }
        public override void AddConfigUI(System.Windows.Controls.Grid grid)
        {
            base.AddConfigUI(grid);
            #region Layer name
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            TextBlock layerName = new TextBlock()
            {
                Text              = Resources.Strings.LabelLayerName,
                Margin            = new Thickness(2),
                VerticalAlignment = System.Windows.VerticalAlignment.Center
            };
            layerName.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            grid.Children.Add(layerName);
            TextBox labelTextBox = new TextBox()
            {
                Text   = LayerName == null ? string.Empty : LayerName,
                Margin = new Thickness(2),
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
            };
            labelTextBox.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            labelTextBox.SetValue(Grid.ColumnProperty, 1);
            grid.Children.Add(labelTextBox);
            labelTextBox.TextChanged += (s, e) =>
            {
                LayerName = labelTextBox.Text;
            };
            #endregion
            #region Renderer
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            TextBlock label2 = new TextBlock()
            {
                Text              = Resources.Strings.LabelRenderer,
                Margin            = new Thickness(2),
                VerticalAlignment = System.Windows.VerticalAlignment.Center
            };
            label2.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            grid.Children.Add(label2);
            Button rendererButton = null;
            if (GeometryType == Core.GeometryType.Unknown)
            {
                TextBlock tb = new TextBlock()
                {
                    Text = Resources.Strings.NotAvailable, VerticalAlignment = VerticalAlignment.Center
                };
                ToolTipService.SetToolTip(tb, Resources.Strings.GeometryTypeIsNotKnown);
                tb.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
                tb.SetValue(Grid.ColumnProperty, 1);
                grid.Children.Add(tb);
            }
            else
            {
                rendererButton = new Button()
                {
                    Content = new Image()
                    {
                        Source              = new BitmapImage(new Uri("/ESRI.ArcGIS.Mapping.GP;component/Images/ColorScheme16.png", UriKind.Relative)),
                        Stretch             = Stretch.None,
                        VerticalAlignment   = System.Windows.VerticalAlignment.Center,
                        HorizontalAlignment = System.Windows.HorizontalAlignment.Center
                    },
                    Width = 22,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Style     = Application.Current.Resources["SimpleButtonStyle"] as Style,
                    IsEnabled = (Mode == InputMode.SketchLayer),
                };
                ToolTipService.SetToolTip(rendererButton, Resources.Strings.ConfigureRenderer);
                rendererButton.Click += rendererButton_Click;
                rendererButton.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
                rendererButton.SetValue(Grid.ColumnProperty, 1);
                grid.Children.Add(rendererButton);
            }
            #endregion
            #region Popup Config
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            label2 = new TextBlock()
            {
                Text              = Resources.Strings.LabelPopUps,
                Margin            = new Thickness(2),
                VerticalAlignment = System.Windows.VerticalAlignment.Center
            };
            label2.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            grid.Children.Add(label2);
            Button popupButton = null;
            if (Layer == null)
            {
                TextBlock tb = new TextBlock()
                {
                    Text = Resources.Strings.NotAvailable, VerticalAlignment = VerticalAlignment.Center
                };
                ToolTipService.SetToolTip(tb, Resources.Strings.FieldInformationIsNotKnown);
                tb.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
                tb.SetValue(Grid.ColumnProperty, 1);
                grid.Children.Add(tb);
            }
            else
            {
                popupButton = new Button()
                {
                    Content = new Image()
                    {
                        Source              = new BitmapImage(new Uri("/ESRI.ArcGIS.Mapping.GP;component/Images/Show_Popup16.png", UriKind.Relative)),
                        Stretch             = Stretch.None,
                        VerticalAlignment   = System.Windows.VerticalAlignment.Center,
                        HorizontalAlignment = System.Windows.HorizontalAlignment.Center
                    },
                    Width = 22,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Style     = Application.Current.Resources["SimpleButtonStyle"] as Style,
                    IsEnabled = (Mode == InputMode.SketchLayer),
                };
                ToolTipService.SetToolTip(popupButton, Resources.Strings.ConfigurePopupFieldAliasesAndVisibility);
                popupButton.Click += popupButton_Click;
                popupButton.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
                popupButton.SetValue(Grid.ColumnProperty, 1);
                grid.Children.Add(popupButton);
            }
            #endregion

            #region Transparency
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            label2 = new TextBlock()
            {
                Text              = Resources.Strings.LabelTransparency,
                Margin            = new Thickness(2),
                VerticalAlignment = System.Windows.VerticalAlignment.Top
            };
            label2.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            grid.Children.Add(label2);

            ContentControl slider = new ContentControl()
            {
                DataContext = this,
                IsEnabled   = (Mode == InputMode.SketchLayer),
                Style       = ResourceUtility.LoadEmbeddedStyle("Themes/HorizontalTransparencySlider.xaml", "TransparencySliderStyle")
            };
            //Slider slider = new Slider()
            //{
            //    DataContext = this,
            //    IsEnabled = (Mode == InputMode.SketchLayer),
            //    Orientation = Orientation.Horizontal,
            //    Width = 145,
            //    Minimum = 0,
            //    Maximum = 1
            //};
            //slider.SetBinding(Slider.ValueProperty,
            //    new System.Windows.Data.Binding("Opacity") { Mode = System.Windows.Data.BindingMode.TwoWay });
            slider.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
            slider.SetValue(Grid.ColumnProperty, 1);
            grid.Children.Add(slider);
            #endregion

            if (Input)
            {
                #region Input Mode
                grid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });
                TextBlock label = new TextBlock()
                {
                    Text              = Resources.Strings.LabelInputFeatures,
                    Margin            = new Thickness(2),
                    VerticalAlignment = System.Windows.VerticalAlignment.Center
                };
                label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
                grid.Children.Add(label);

                grid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });
                StackPanel panel = new StackPanel()
                {
                    Orientation = System.Windows.Controls.Orientation.Vertical,
                    Margin      = new Thickness(15, 0, 0, 0),
                };
                panel.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1);
                panel.SetValue(Grid.ColumnSpanProperty, 2);
                RadioButton interactive = new RadioButton()
                {
                    Content    = Resources.Strings.Interactively,
                    IsChecked  = (Mode == InputMode.SketchLayer),
                    Margin     = new Thickness(2),
                    Foreground = Application.Current.Resources["DesignHostBackgroundTextBrush"] as Brush
                };
                panel.Children.Add(interactive);
                RadioButton selection = new RadioButton()
                {
                    Content    = Resources.Strings.BySelectingLayerFromMap,
                    IsChecked  = (Mode == InputMode.SelectExistingLayer),
                    Margin     = new Thickness(2),
                    Foreground = Application.Current.Resources["DesignHostBackgroundTextBrush"] as Brush
                };
                panel.Children.Add(selection);
                RadioButton fromExtent = null;
                if (GeometryType == Core.GeometryType.Polygon)
                {
                    fromExtent = new RadioButton()
                    {
                        Content    = Resources.Strings.FromMapExtent,
                        IsChecked  = (Mode == InputMode.CurrentExtent),
                        Margin     = new Thickness(2),
                        Foreground = Application.Current.Resources["DesignHostBackgroundTextBrush"] as Brush
                    };
                    panel.Children.Add(fromExtent);
                }
                interactive.Checked += (a, b) =>
                {
                    Mode = InputMode.SketchLayer;
                    selection.IsChecked = false;
                    if (fromExtent != null)
                    {
                        fromExtent.IsChecked = false;
                    }
                    if (popupButton != null)
                    {
                        popupButton.IsEnabled = true;
                    }
                    if (rendererButton != null)
                    {
                        rendererButton.IsEnabled = true;
                    }
                    //if (slider != null)
                    //    slider.IsEnabled = true;
                };
                selection.Checked += (a, b) =>
                {
                    Mode = InputMode.SelectExistingLayer;
                    interactive.IsChecked = false;
                    if (fromExtent != null)
                    {
                        fromExtent.IsChecked = false;
                    }
                    if (popupButton != null)
                    {
                        popupButton.IsEnabled = false;
                    }
                    if (rendererButton != null)
                    {
                        rendererButton.IsEnabled = false;
                    }
                    //if (slider != null)
                    //    slider.IsEnabled = false;
                };
                if (fromExtent != null)
                {
                    fromExtent.Checked += (a, b) =>
                    {
                        Mode = InputMode.CurrentExtent;
                        interactive.IsChecked = false;
                        selection.IsChecked   = false;
                        if (popupButton != null)
                        {
                            popupButton.IsEnabled = false;
                        }
                        if (rendererButton != null)
                        {
                            rendererButton.IsEnabled = false;
                        }
                        //if (slider != null)
                        //    slider.IsEnabled = false;
                    };
                }
                grid.Children.Add(panel);
                #endregion
            }
        }