Example #1
0
        public void showLayerInfoOnTreeView(WMSLayerInfoWithQoS wmsLayerInfoWithQoS)
        {
            TreeViewItem rootTreeNode = new TreeViewItem();

            RadioButtonWithTextAndMultiIcon area1 = new RadioButtonWithTextAndMultiIcon();

            area1.TextBlock_Name.Text               = "All layers (" + wmsLayerInfoWithQoS.WMSLayersList.Count + ")";
            area1.TextBlock_Name.FontSize           = 15;
            area1.TextBlock_Name.FontWeight         = FontWeights.Bold;
            area1.isSelected_RadioButton.Visibility = Visibility.Collapsed;
            area1.Image_Layer.Visibility            = Visibility.Collapsed;
            area1.Image_QoS.Visibility              = Visibility.Collapsed;

            //we customs the TreeviewItem: add checkbox and image icon before title text content,
            //then we use our TreeViewItem UserControl as the Header Object of TreeViewItem.
            rootTreeNode.Header     = area1;
            rootTreeNode.IsExpanded = true;

            foreach (GeoSearch.QualityQueryServiceReference.WMSLayer layer in wmsLayerInfoWithQoS.WMSLayersList)
            {
                TreeViewItem layerTreeNode            = new TreeViewItem();
                RadioButtonWithTextAndMultiIcon area2 = new RadioButtonWithTextAndMultiIcon();
                //we show the layer's title in tree view as tree node
                area2.TextBlock_Name.Text = layer.title;
                //and the true layer is taged as the object
                area2.TextBlock_Name.Tag   = layer.name;
                area2.Image_Map.Visibility = Visibility.Collapsed;

                BitmapImage image = new BitmapImage(new Uri(Converters.getQoSBarImagePathString(layer.rankValue), UriKind.Relative));
                area2.Image_QoS.Source = image;

                area2.isSelected_RadioButton.Checked += new RoutedEventHandler(radioButton_Selected);
                layerTreeNode.Selected += new RoutedEventHandler(layerTreeNode_Selected);
                layerTreeNode.Header    = area2;
                rootTreeNode.Items.Add(layerTreeNode);
            }
            this.TreeView_WMSLayer.Items.Add(rootTreeNode);
        }
Example #2
0
        void radioButton_Selected(object sender, RoutedEventArgs e)
        {
            //throw new NotImplementedException();

            if (sender is RadioButton)
            {
                RadioButton button     = sender as RadioButton;
                StackPanel  StackPanel = button.Parent as StackPanel;
                RadioButtonWithTextAndMultiIcon area = StackPanel.Parent as RadioButtonWithTextAndMultiIcon;
                area.isSelected_RadioButton.IsChecked = true;
                layerName = area.TextBlock_Name.Tag as string;
                List <Object> list = TreeView_WMSLayer.Items.ToList();
                foreach (Object object1 in list)
                {
                    if (object1 is TreeViewItem)
                    {
                        TreeViewItem LayersTreeNode = object1 as TreeViewItem;
                        IEnumerable <TreeViewItem> TreeViewItemList = LayersTreeNode.GetDescendantContainers();
                        foreach (TreeViewItem treeViewItem in TreeViewItemList)
                        {
                            RadioButtonWithTextAndMultiIcon area1 = treeViewItem.Header as RadioButtonWithTextAndMultiIcon;
                            if (area1 != area)
                            {
                                area1.isSelected_RadioButton.IsChecked = false;
                            }
                        }
                    }
                }
            }

            DateTime to   = DateTime.Now;
            DateTime from = to.AddDays(-layerQoSHistoralInterval + 1);

            setLayerQoSDateTimeFromAndTo(from, to);
            setLayerQoSDatePickerFromAndTo();
            queryPerformanceFunctions.getWMSLayerQoSHistoralInfo(record, layerName, FromDateTime_ForLayer, ToDateTime_ForLayer);
        }
Example #3
0
        void layerTreeNode_Selected(object sender, RoutedEventArgs e)
        {
            //throw new NotImplementedException();
            string layerName = null;

            if (sender is TreeViewItem)
            {
                TreeViewItem layerTreeNode  = sender as TreeViewItem;
                TreeViewItem LayersTreeNode = layerTreeNode.GetParentTreeViewItem();
                IEnumerable <TreeViewItem> TreeViewItemList = LayersTreeNode.GetDescendantContainers();
                foreach (TreeViewItem treeViewItem in TreeViewItemList)
                {
                    if (treeViewItem != layerTreeNode)
                    {
                        RadioButtonWithTextAndMultiIcon area1 = treeViewItem.Header as RadioButtonWithTextAndMultiIcon;
                        area1.isSelected_RadioButton.IsChecked = false;
                    }
                }
                RadioButtonWithTextAndMultiIcon area = layerTreeNode.Header as RadioButtonWithTextAndMultiIcon;
                area.isSelected_RadioButton.IsChecked = true;
                Grid_WMSLayerQoS.Visibility           = Visibility.Visible;
                layerName = area.TextBlock_Name.Tag as string;
            }
        }