예제 #1
0
 public void AddContent(string name, ChartConfigProfile chart)
 {
     AlterChart.Items.Add(CreateAlterChartViewItem(name, Config.Charts.Charts[name]));
     (RemoveCharts.Content as StackPanel).Children.Insert((RemoveCharts.Content as StackPanel).Children.Count - 1, new CheckBox()
     {
         IsChecked = false,
         Content   = name
     });
 }
예제 #2
0
        private TreeViewItem CreateAlterChartViewItem(string name, ChartConfigProfile config)
        {
            TreeViewItem toAlter = new TreeViewItem()
            {
                Header = name, Tag = name
            };
            Border border = new Border()
            {
                BorderThickness = new Thickness(2), BorderBrush = Brushes.Black, CornerRadius = new CornerRadius(3)
            };

            StackPanel toTree = new StackPanel()
            {
                Background = config.CanvasBackGround.Clone()
            };

            TreeViewItem canvasColor = new TreeViewItem {
                Header = "Canvas Color"
            };

            Color color = ((SolidColorBrush)config.CanvasBackGround.GetAsFrozen()).Color;

            double[] rgb = new double[] { color.R, color.G, color.B };
            for (int i = 0; i < rgb.Length; i++)
            {
                Slider slider = new Slider()
                {
                    Width = 100, Minimum = 0, Maximum = 255, Value = rgb[i]
                };
                slider.ValueChanged += On_ValueChanged;
                canvasColor.Items.Add(slider);
            }

            toTree.Children.Add(canvasColor);
            TreeViewItem removeInputs = new TreeViewItem()
            {
                Header = "Remove Inputs", Name = "remove"
            };

            foreach (var input in config.ChartInputs)
            {
                int i = config.ChartInputs.IndexOf(input);
                toTree.Children.Add(AddColorOptions(input, config.Ellipses[i].Clone(), config.Lines[i].Clone()));
                removeInputs.Items.Add(new CheckBox()
                {
                    IsChecked = false,
                    Content   = input
                });
            }

            TreeViewItem addInputs = new TreeViewItem()
            {
                Header = "Add Inputs"
            };

            {
                addInputs.Items.Add(AddColorOptions("Input Colors"));
                addInputs.Items.Add(new TextBox()
                {
                    MinWidth = 70, MaxWidth = 150
                });

                Button add = new Button()
                {
                    Content = "Add"
                };
                add.Click += Add_Click;
                addInputs.Items.Add(add);
            }

            toTree.Children.Add(addInputs);

            border.Child = toTree;
            toAlter.Items.Add(border);

            toAlter.Items.Add(removeInputs);

            Button save = new Button()
            {
                Content = "Save Changes"
            };

            save.Click += Save_Click;
            toAlter.Items.Add(save);

            return(toAlter);
        }
예제 #3
0
파일: Chart.cs 프로젝트: AkselH88/Endure
 public Chart(ChartConfigProfile config)
 {
     ConfigProfile = config;
 }