// Загрузка конфигурации
        private void ConfigLoad()
        {
            string path = @"..\..\datafile.txt";

            using (StreamReader sr = new StreamReader(path, Encoding.Default))
            {
                string lineRow;
                for (int index = id; ; index++)
                {
                    strobe = new StrobeCharacteristic();
                    if ((lineRow = sr.ReadLine()) == null)
                    {
                        return;
                    }

                    strobe.Id = id++;

                    if ((lineRow = sr.ReadLine()) != null)
                    {
                        if (Int32.TryParse(lineRow, out int time_start))
                        {
                            strobe.Time_start = time_start;
                        }
                        else
                        {
                            return;
                        }
                    }
                    if ((lineRow = sr.ReadLine()) != null)
                    {
                        if (Int32.TryParse(lineRow, out int time_stop))
                        {
                            strobe.Time_stop = time_stop;
                        }
                        else
                        {
                            return;
                        }
                    }
                    if ((lineRow = sr.ReadLine()) != null)
                    {
                        if (Int32.TryParse(lineRow, out int amplitude))
                        {
                            strobe.Amplitude = amplitude;
                        }
                        else
                        {
                            return;
                        }
                    }
                    if ((lineRow = sr.ReadLine()) != null)
                    {
                        strobe.Color = lineRow;
                    }
                    listStrobe.Insert(index, strobe);
                    table.Items.Insert(index, strobe);
                    FillLineGraph(strobe);
                }
            }
        }
        //private void LeftLine_MouseDown(object sender, MouseButtonEventArgs mouseArgs)
        //{
        //    var item = sender as FrameworkElement;

        //}
        //private void LeftLine_MouseUp(object sender, MouseButtonEventArgs mouseArgs)
        //{

        //}
        //private void LeftLine_MouseMove(object sender, MouseButtonEventArgs mouseArgs)
        //{

        //}
        //private void Bind ()
        //{
        //    MinMaxGraphControl graphControl = new MinMaxGraphControl();
        //    Binding bindingLeftLine = new Binding();
        //    bindingLeftLine.Source = graphControl.LowerSlider;
        //    bindingLeftLine.Path = new PropertyPath("Canvas.SetLeft");
        //    bindingLeftLine.Mode = BindingMode.TwoWay;
        //    leftLine.SetBinding(Canvas.LeftProperty, bindingLeftLine);
        //}
        //private void TaskUpdateMinMaxLine()
        //{
        //    leftLine.Dispatcher.Invoke(new Action(() =>
        //    {
        //        if (minMaxGraphControl.LowerValue == -25)
        //        {
        //            leftLine.Margin = new Thickness(0, 0, 207, 0);
        //        }
        //        Thread.Sleep(200);
        //    }));
        //    rightLine.Dispatcher.Invoke(new Action(() =>
        //    {
        //        rightLine.Visibility = Visibility;
        //        if (minMaxGraphControl.UpperValue == 25)
        //        {
        //            rightLine.Margin = new Thickness(258, 0, 0, 0);
        //        }
        //        Thread.Sleep(200);
        //    }));
        //}
        //private void MinMaxLineMove ()
        //{
        //    MinMaxGraphControl minMaxGraphControl = new MinMaxGraphControl();
        //    leftLine.Dispatcher.Invoke(new Action(() =>
        //    {
        //        leftLine.Visibility = Visibility;
        //        if (minMaxGraphControl.LowerValue == 0 || minMaxGraphControl.UpperValue == 0)
        //        {
        //            leftLine.Margin = new Thickness(0, 0, 0, 0);
        //        }
        //        if (minMaxGraphControl.LowerValue == -1 || minMaxGraphControl.UpperValue == -1)
        //        {
        //            leftLine.Margin = new Thickness(0, 0, 8, 0);
        //        }
        //        if (minMaxGraphControl.LowerValue == -2 || minMaxGraphControl.UpperValue == -2)
        //        {
        //            leftLine.Margin = new Thickness(0, 0, 16, 0);
        //        }
        //        if (minMaxGraphControl.LowerValue == -3 || minMaxGraphControl.UpperValue == -3)
        //        {
        //            leftLine.Margin = new Thickness(0, 0, 24, 0);
        //        }
        //        if (minMaxGraphControl.LowerValue == -4 || minMaxGraphControl.UpperValue == -4)
        //        {
        //            leftLine.Margin = new Thickness(0, 0, 32, 0);
        //        }
        //    }));
        //    rightLine.Dispatcher.Invoke(new Action(() =>
        //    {
        //        rightLine.Visibility = Visibility;
        //        if (minMaxGraphControl.LowerValue == 0 || minMaxGraphControl.UpperValue == 0)
        //        {
        //            rightLine.Margin = new Thickness(0, 0, 0, 0);
        //        }
        //        if (minMaxGraphControl.LowerValue == 1 || minMaxGraphControl.UpperValue == 1)
        //        {
        //            rightLine.Margin = new Thickness(10, 0, 0, 0);
        //        }
        //        if (minMaxGraphControl.LowerValue == 2 || minMaxGraphControl.UpperValue == 2)
        //        {
        //            rightLine.Margin = new Thickness(20, 0, 0, 0);
        //        }
        //        if (minMaxGraphControl.LowerValue == 3 || minMaxGraphControl.UpperValue == 3)
        //        {
        //            rightLine.Margin = new Thickness(30, 0, 0, 0);
        //        }
        //        if (minMaxGraphControl.LowerValue == 4 || minMaxGraphControl.UpperValue == 4)
        //        {
        //            rightLine.Margin = new Thickness(40, 0, 0, 0);
        //        }
        //    }));
        //    Task.Run(() => TaskUpdateMinMaxLine());
        //}
        //private void TaskUpdateMinMaxLine()
        //{
        //    leftLine.Dispatcher.Invoke(new Action(() =>
        //    {
        //        if (minMaxGraphControl.LowerValue == -25)
        //        {
        //            leftLine.Margin = new Thickness(0, 0, 207, 0);
        //        }
        //        Thread.Sleep(200);
        //    }));
        //    rightLine.Dispatcher.Invoke(new Action(() =>
        //    {
        //        rightLine.Visibility = Visibility;
        //        if (minMaxGraphControl.UpperValue == 25)
        //        {
        //            rightLine.Margin = new Thickness(258, 0, 0, 0);
        //        }
        //        Thread.Sleep(200);
        //    }));
        //}
        private void FillLineGraph(StrobeCharacteristic strobe)
        {
            List <int> xCoords = new List <int>();
            List <int> yCoords = new List <int>();

            xCoords.Add(strobe.Amplitude);
            yCoords.Add(strobe.Time_start);
            xCoords.Add(strobe.Amplitude);
            yCoords.Add(strobe.Time_stop);
            line = new LineGraph();
            line.StrokeThickness = 3;
            line.Description     = "Строб " + listStrobe.Count;
            line.Plot(xCoords, yCoords);
            linesPlot.Children.Add(line);
            switch (strobe.Color)
            {
            case "Красный":
            {
                line.Stroke = new SolidColorBrush(Colors.Firebrick);
                break;
            }

            case "Синий":
            {
                line.Stroke = new SolidColorBrush(Colors.DarkBlue);
                break;
            }

            case "Зелёный":
            {
                line.Stroke = new SolidColorBrush(Colors.DarkGreen);
                break;
            }

            case "Оранжевый":
            {
                line.Stroke = new SolidColorBrush(Colors.DarkOrange);
                break;
            }

            case "Фиолетовый":
            {
                line.Stroke = new SolidColorBrush(Colors.DarkMagenta);
                break;
            }

            case "Другой цвет":
            {
                line.Stroke = new SolidColorBrush(Colors.BlueViolet);
                break;
            }
            }
        }
        // Добавление строк в таблицу и строб на график
        private void PlusClick(object sender, RoutedEventArgs e)
        {
            t_start  = int.Parse(timeStart.textBox.Text);
            t_stop   = int.Parse(timeStop.textBox.Text);
            val_ampl = int.Parse(amplit.textBox.Text);
            if (t_start >= t_stop)
            {
                string messageBoxText = "Время начала должно быть меньше времени конца!";
                string caption        = "Ошибка";
                MessageBox.Show(messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            strobe = new StrobeCharacteristic
            {
                //Id = id++,
                Id         = listStrobe.Count + id++,
                Time_start = t_start,
                Time_stop  = t_stop,
                Amplitude  = val_ampl,
                Color      = color_box.Text
            };
            // Проверка уникальности строб
            bool isUnique = true;

            for (int i = 0; i < listStrobe.Count; i++)
            {
                if (listStrobe.ElementAt(i).Color == strobe.Color)
                {
                    string messageBoxText = "Строб такого цвета уже существует!\nВыберете любой другой цвет!";
                    string caption        = "Предупреждение";
                    MessageBox.Show(messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }
                if (listStrobe.ElementAt(i).Time_start == strobe.Time_start &&
                    listStrobe.ElementAt(i).Time_stop == strobe.Time_stop &&
                    listStrobe.ElementAt(i).Amplitude == strobe.Amplitude &&
                    listStrobe.ElementAt(i).Color == strobe.Color)
                {
                    isUnique = false;
                    break;
                }
            }
            if (isUnique)
            {
                listStrobe.Add(strobe);
                table.Items.Add(listStrobe.Last());
                FillLineGraph(strobe);
            }
        }