コード例 #1
0
        private void deleteFunction_Click(object sender, RoutedEventArgs e)
        {
            InputIndex i = new InputIndex(controller)
            {
                Title = "Удаление по индексу"
            };

            i.ShowDialog();
            if (!i.IsOK)
            {
                return;
            }
            ChartingObject tmp = controller.getAllChartings()[i.Index - 1];

            controller.deleteFunctionById(i.Index - 1);
            elementsPanel.Children.RemoveAt(i.Index - 1);
            List <ChartingObject> list = controller.getAllChartings();

            for (int j = i.Index - 1; j < list.Count; j++)
            {
                elementsPanel.Children.RemoveAt(j);
                GraphicsElement ge = showFunction(j + 1,
                                                  list[j].Name, list[j].Function, list[j].Step,
                                                  list[j].Min, list[j].Max);
                elementsPanel.Children.Insert(j, ge);
            }
            MessageBox.Show("График функции '" + tmp.Name + "' удалён!");
        }
コード例 #2
0
        private GraphicsElement showFunction(int id, string name, string function, int step, double min, double max)
        {
            GraphicsElement ge = new GraphicsElement(id, name, function, step, min, max);

            ge.Margin = new Thickness(1);
            ge.Width  = elementsPanel.Width - scrollViewer.Width;
            return(ge);
        }
コード例 #3
0
        private void alterFunction_Click(object sender, RoutedEventArgs e)
        {
            InputIndex i = new InputIndex(controller)
            {
                Title = "Изменение по индексу"
            };

            i.ShowDialog();
            if (!i.IsOK)
            {
                return;
            }
            AddFunction alter = new AddFunction()
            {
                Title = "Изменение"
            };

            ChartingObject obj = controller.getAllChartings()[i.Index - 1];

            alter.name_txt.Text     = obj.Name;
            alter.function_txt.Text = obj.Function;
            alter.step_txt.Text     = obj.Step.ToString();
            alter.min_txt.Text      = obj.Min.ToString();
            alter.max_txt.Text      = obj.Max.ToString();
            alter.ShowDialog();
            if (!alter.IsOK)
            {
                return;
            }
            if (!controller.alterFunction(i.Index - 1, alter.Name, alter.Function,
                                          alter.Step, alter.Min, alter.Max))
            {
                MessageBox.Show("Не могу изменить функцию: индекс = " + i.Index +
                                " за пределами диапазона!");
                return;
            }
            elementsPanel.Children.RemoveAt(i.Index - 1);
            GraphicsElement ge = showFunction(i.Index,
                                              alter.Name, alter.Function, alter.Step,
                                              alter.Min, alter.Max);

            elementsPanel.Children.Insert(i.Index - 1, ge);
            MessageBox.Show("График функции '" + alter.Name + "' изменен!");
        }
コード例 #4
0
        private void addGraphic(int id, string name, string function, int step, double min, double max)
        {
            GraphicsElement ge = showFunction(id, name, function, step, min, max);

            elementsPanel.Children.Add(ge);
        }