public settings_tab() { evt_cancel_settings_tab = new MarkerEvent1(); evt_apply_settings = new MarkerEvent1(); program_settings = new ProgramSettings(); pattern = new Template(); tdb = new tassDB(); InitializeComponent(); }
public Grid training_tab_draw(ProgramSettings program_settings) { plotter_cntrl.closePlotter(); Grid grid_main = new Grid(); RowDefinition row_def = new RowDefinition(); row_def.Height = new GridLength(150); RowDefinition row_def_1 = new RowDefinition(); RowDefinition row_def_2 = new RowDefinition(); row_def_2.Height = new GridLength(100); ColumnDefinition col_def = new ColumnDefinition(); grid_main.RowDefinitions.Add(row_def); grid_main.RowDefinitions.Add(row_def_1); grid_main.RowDefinitions.Add(row_def_2); grid_main.ColumnDefinitions.Add(col_def); TextBlock train_text = new TextBlock(); train_text.Inlines.Add(new Bold(new Run("Тренировка мышечного восприятия "))); train_text.Inlines.Add(new Run("\n\n Повторение по шаблону циклов развития усилия с параметрами: \n\n")); train_text.Inlines.Add(new Bold(new Run(" Fш = " + program_settings.f_max.ToString() + " Н.; tш = " + program_settings.time_incr.ToString() + " c.; tпаузы = " + program_settings.t_pause.ToString() + " c.; Количество циклов = " + program_settings.num_of_attempts.ToString()))); Grid.SetRow(train_text, 0); Grid.SetColumn(train_text, 0); train_text.Height = 80; Thickness margin = train_text.Margin; margin.Bottom = 25; margin.Left = 25; margin.Top = 25; margin.Right = 0; train_text.Margin = margin; plotter_cntrl.plotter = new ChartPlotter(); plotter_cntrl.plotter.Legend.Remove(); plotter_cntrl.plotter.FitToView(); Grid.SetRow(plotter_cntrl.plotter, 1); Grid.SetColumn(plotter_cntrl.plotter, 0); Button step_3_button = AuxiliaryFunc.getNewButton("Стоп", 150, 25); step_3_button.Click += new RoutedEventHandler(train_done); step_3_button.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; AuxiliaryFunc.setMargin((Control)step_3_button, 25, 10, 0, 10); Grid.SetRow(step_3_button, 2); Grid.SetColumn(step_3_button, 0); grid_main.Children.Add(train_text); grid_main.Children.Add(step_3_button); grid_main.Children.Add(plotter_cntrl.plotter); Grid.SetRow(grid_main, 1); Grid.SetColumn(grid_main, 0); plotter_cntrl.StartGettingData(); plotter_cntrl.StartPlotter(); return grid_main; }
public void save_to_excel_file(string file_name, float[] channel_2, int count_channel_2, float[] timeCoordinate, ProgramSettings program_settings) { DataSet ds = new DataSet("DataSet"); DataTable dt = new DataTable("Cигнал"); string[] str_arr_2 = new string[2] { "Сила, [Н]", "Время, [c]" }; for (int c = 0; c < 2; c++) dt.Columns.Add(str_arr_2[c], typeof(double)); double[,] array = new double[count_channel_2, 2]; for (int i = 0; i < count_channel_2; i++) array[i, 0] = channel_2[i]; for (int i = 0; i < count_channel_2; i++) array[i, 1] = timeCoordinate[i]; dt.BeginLoadData(); DataTable dt_ = new DataTable("Параметры шаблона"); string[] str_arr = new string[3] { "Сила, [Н]", "Длительность прикладываемого усилия, [c]", "Количество попыток" }; for (int c = 0; c < 3; c++) dt_.Columns.Add(str_arr[c], typeof(double)); object[] newRow_ = new object[3]; newRow_[0] = program_settings.f_max; newRow_[1] = program_settings.time_incr; newRow_[2] = program_settings.num_of_attempts; dt_.LoadDataRow(newRow_, true); for (int r = 0; r < count_channel_2; r++) { object[] newRow = new object[2]; newRow[0] = array[r, 0]; newRow[1] = array[r, 1]; dt.LoadDataRow(newRow, true); } ds.Tables.Add(dt); ds.Tables.Add(dt_); ExcelLibrary.DataSetHelper.CreateWorkbook(file_name + ".xls", ds); MessageBox.Show("Результаты измерений сохранены"); }
public void insert_(ProgramSettings program_settings, String template_name) { db = new SQLiteDatabase(); Dictionary<String, String> data = new Dictionary<String, String>(); data.Add("f_max", program_settings.f_max.ToString()); data.Add("template_name", template_name); data.Add("t_increase", program_settings.time_incr.ToString()); data.Add("time_pause", program_settings.t_pause.ToString()); data.Add("number_of_attempts", program_settings.num_of_attempts.ToString()); data.Add("allow_digit", program_settings.digitization.ToString()); data.Add("allow_auto_calculate", program_settings.calculation.ToString()); data.Add("template_color_num", program_settings.template_color_num.ToString()); data.Add("template_line_width", program_settings.template_line_width.ToString()); data.Add("measurement_color_num", program_settings.measurement_color_num.ToString()); data.Add("measurement_line_width", program_settings.measurement_line_width.ToString()); data.Add("grid_color_num", program_settings.grid_color_num.ToString()); data.Add("grid_line_width", program_settings.grid_line_width.ToString()); data.Add("axis_color_num", program_settings.axis_color_num.ToString()); data.Add("axis_line_width", program_settings.axis_line_width.ToString()); try { db.Insert("settings", data); } catch (Exception crap) { MessageBox.Show(crap.Message); } }
public Grid auto_calculate(ProgramSettings program_settings_in) { program_settings = program_settings_in; /// Автоматический режим Grid grid_main = new Grid(); RowDefinition row_def_1 = new RowDefinition(); RowDefinition row_def_2 = new RowDefinition(); RowDefinition row_def_3 = new RowDefinition(); RowDefinition row_def_4 = new RowDefinition(); row_def_1.Height = new GridLength(80); row_def_4.Height = new GridLength(80); ColumnDefinition col_def_1 = new ColumnDefinition(); grid_main.RowDefinitions.Add(row_def_1); grid_main.RowDefinitions.Add(row_def_2); grid_main.RowDefinitions.Add(row_def_3); grid_main.RowDefinitions.Add(row_def_4); grid_main.ColumnDefinitions.Add(col_def_1); StackPanel stack_panel_1 = new StackPanel(); stack_panel_1.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; stack_panel_1.Orientation = Orientation.Horizontal; StackPanel stack_panel_2 = new StackPanel(); stack_panel_2.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; stack_panel_2.Orientation = Orientation.Horizontal; TextBlock header = new TextBlock(); header.Inlines.Add(new Bold(new Run(" Расчеты\n\n "))); header.Inlines.Add(new Run(" Автоматический режим\n\n ")); header.Width = 300; header.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; Thickness margin = header.Margin; margin.Bottom = 0; margin.Left = 25; margin.Top = 25; margin.Right = 0; header.Margin = margin; Grid.SetRow(header, 0); Grid.SetColumn(header, 0); plotter_cntrl.plotter = new ChartPlotter(); Grid.SetRow(plotter_cntrl.plotter, 1); Grid.SetColumn(plotter_cntrl.plotter, 0); plotter_cntrl.plotter.Legend.Remove(); plotter_cntrl.plotter.FitToView(); int[] temp_array = calculation_op.time_force_array; grid_table_print_2 = new Grid(); //grid_table.ShowGridLines = true; RowDefinition row_1 = new RowDefinition(); row_1.Height = new GridLength(40); ColumnDefinition col_1 = new ColumnDefinition(); ColumnDefinition col_2 = new ColumnDefinition(); ColumnDefinition col_3 = new ColumnDefinition(); ColumnDefinition col_4 = new ColumnDefinition(); ColumnDefinition col_5 = new ColumnDefinition(); ColumnDefinition col_6 = new ColumnDefinition(); ColumnDefinition col_7 = new ColumnDefinition(); ColumnDefinition col_8 = new ColumnDefinition(); ColumnDefinition col_9 = new ColumnDefinition(); ColumnDefinition col_10 = new ColumnDefinition(); grid_table_print_2.RowDefinitions.Add(row_1); grid_table_print_2.ColumnDefinitions.Add(col_1); grid_table_print_2.ColumnDefinitions.Add(col_2); grid_table_print_2.ColumnDefinitions.Add(col_3); grid_table_print_2.ColumnDefinitions.Add(col_4); grid_table_print_2.ColumnDefinitions.Add(col_5); grid_table_print_2.ColumnDefinitions.Add(col_6); grid_table_print_2.ColumnDefinitions.Add(col_7); grid_table_print_2.ColumnDefinitions.Add(col_8); grid_table_print_2.ColumnDefinitions.Add(col_9); grid_table_print_2.ColumnDefinitions.Add(col_10); Rectangle rect = new Rectangle(); rect.Stroke = Brushes.Black; Grid.SetRow(rect, 0); Grid.SetColumn(rect, 0); Label lb_ = AuxiliaryFunc.getNewLabel("## цикла", 30, 25, 2); Grid.SetRow(lb_, 0); Grid.SetColumn(lb_, 0); Rectangle rect0 = new Rectangle(); rect0.Stroke = Brushes.Black; Grid.SetRow(rect0, 0); Grid.SetColumn(rect0, 1); Label lb0_ = AuxiliaryFunc.getNewLabel("F2 (Н)", 30, 25, 2); lb0_.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb0_.VerticalAlignment = System.Windows.VerticalAlignment.Center; lb_.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb_.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb0_, 0); Grid.SetColumn(lb0_, 1); Rectangle rect01 = new Rectangle(); rect01.Stroke = Brushes.Black; Grid.SetRow(rect01, 0); Grid.SetColumn(rect01, 2); Label lb1_ = AuxiliaryFunc.getNewLabel("t1 (с)", 30, 25, 2); lb1_.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb1_.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb1_, 0); Grid.SetColumn(lb1_, 2); Rectangle rect02 = new Rectangle(); rect02.Stroke = Brushes.Black; Grid.SetRow(rect02, 0); Grid.SetColumn(rect02, 3); Label lb2_ = AuxiliaryFunc.getNewLabel("t2 (с)", 30, 25, 2); lb2_.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb2_.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb2_, 0); Grid.SetColumn(lb2_, 3); Rectangle rect03 = new Rectangle(); rect03.Stroke = Brushes.Black; Grid.SetRow(rect03, 0); Grid.SetColumn(rect03, 4); Label lb3_ = AuxiliaryFunc.getNewLabel("\x0394t(с)", 30, 25, 2); lb3_.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb3_.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb3_, 0); Grid.SetColumn(lb3_, 4); Rectangle rect04 = new Rectangle(); rect04.Stroke = Brushes.Black; Grid.SetRow(rect04, 0); Grid.SetColumn(rect04, 5); Label lb4_ = AuxiliaryFunc.getNewLabel("G2 (Н/с)", 30, 25, 2); lb4_.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb4_.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb4_, 0); Grid.SetColumn(lb4_, 5); Rectangle rect05 = new Rectangle(); rect05.Stroke = Brushes.Black; Grid.SetRow(rect05, 0); Grid.SetColumn(rect05, 6); Label lb5_ = AuxiliaryFunc.getNewLabel("\x222BF(t)dt (Н \x02D9 с)", 30, 25, 2); lb5_.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb5_.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb5_, 0); Grid.SetColumn(lb5_, 6); Rectangle rect06 = new Rectangle(); rect06.Stroke = Brushes.Black; Grid.SetRow(rect06, 0); Grid.SetColumn(rect06, 7); Label lb6_ = AuxiliaryFunc.getNewLabel("\x0394F (Н)", 30, 25, 2); lb6_.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb6_.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb6_, 0); Grid.SetColumn(lb6_, 7); Rectangle rect07 = new Rectangle(); rect07.Stroke = Brushes.Black; Grid.SetRow(rect07, 0); Grid.SetColumn(rect07, 8); Label lb7_ = AuxiliaryFunc.getNewLabel("\x0394G (Н/с)", 30, 25, 2); lb7_.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb7_.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb7_, 0); Grid.SetColumn(lb7_, 8); Rectangle rect08 = new Rectangle(); rect08.Stroke = Brushes.Black; Grid.SetRow(rect08, 0); Grid.SetColumn(rect08, 9); Label lb8_ = AuxiliaryFunc.getNewLabel("\x0394\x222BF(t)dt (Н \x02D9 с)", 30, 25, 2); lb8_.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb8_.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb8_, 0); Grid.SetColumn(lb8_, 9); grid_table_print_2.Children.Add(rect); grid_table_print_2.Children.Add(rect0); grid_table_print_2.Children.Add(rect01); grid_table_print_2.Children.Add(rect02); grid_table_print_2.Children.Add(rect03); grid_table_print_2.Children.Add(rect04); grid_table_print_2.Children.Add(rect05); grid_table_print_2.Children.Add(rect06); grid_table_print_2.Children.Add(rect07); grid_table_print_2.Children.Add(rect08); grid_table_print_2.Children.Add(lb0_); grid_table_print_2.Children.Add(lb_); grid_table_print_2.Children.Add(lb1_); grid_table_print_2.Children.Add(lb2_); grid_table_print_2.Children.Add(lb3_); grid_table_print_2.Children.Add(lb4_); grid_table_print_2.Children.Add(lb5_); grid_table_print_2.Children.Add(lb6_); grid_table_print_2.Children.Add(lb7_); grid_table_print_2.Children.Add(lb8_); int num_of_rows = 1; for (int f = 1; f < 300; f = f + 2) { if (temp_array[f] == 0) break; num_of_rows++; RowDefinition row = new RowDefinition(); row.Height = new GridLength(40); grid_table_print_2.RowDefinitions.Add(row); // номер строки в таблице Rectangle rect_1 = new Rectangle(); rect_1.Stroke = Brushes.Gray; Grid.SetRow(rect_1, num_of_rows - 1); Grid.SetColumn(rect_1, 0); Label lb0 = AuxiliaryFunc.getNewLabel((num_of_rows - 1).ToString(), 30, 25, 5); lb0.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb0.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb0, num_of_rows - 1); Grid.SetColumn(lb0, 0); // Максимальная приложенная сила Rectangle rect_2 = new Rectangle(); rect_2.Stroke = Brushes.Gray; Grid.SetRow(rect_2, num_of_rows - 1); Grid.SetColumn(rect_2, 1); Label lb = AuxiliaryFunc.getNewLabel(plotter_cntrl.channel_2[temp_array[f + 1]].ToString(), 30, 25, 5); lb.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb, num_of_rows - 1); Grid.SetColumn(lb, 1); //t1 Rectangle rect_3 = new Rectangle(); rect_3.Stroke = Brushes.Gray; Grid.SetRow(rect_3, num_of_rows - 1); Grid.SetColumn(rect_3, 2); Label lb1 = AuxiliaryFunc.getNewLabel(plotter_cntrl.timeCoordinate[temp_array[f]].ToString(), 30, 25, 5); lb1.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb1.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb1, num_of_rows - 1); Grid.SetColumn(lb1, 2); //t2 Rectangle rect_4 = new Rectangle(); rect_4.Stroke = Brushes.Gray; Grid.SetRow(rect_4, num_of_rows - 1); Grid.SetColumn(rect_4, 3); Label lb2 = AuxiliaryFunc.getNewLabel(plotter_cntrl.timeCoordinate[temp_array[f + 1]].ToString(), 30, 25, 5); lb2.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb2.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb2, num_of_rows - 1); Grid.SetColumn(lb2, 3); /////////// float t_ = program_settings.time_incr; float F_2 = plotter_cntrl.channel_2[temp_array[f + 1]]; float delta_t = (plotter_cntrl.timeCoordinate[temp_array[f + 1]] - plotter_cntrl.timeCoordinate[temp_array[f]]); float G2 = F_2 / delta_t; float F = program_settings.f_max; float integral_F_2 = 0; for (int l = temp_array[f]; l < temp_array[f + 1]; l++) { integral_F_2 += plotter_cntrl.channel_2[l]; } float delta_F = Math.Abs(F - F_2); float G = F / t_; float delta_G = G2 - G; float integral_F = F * t_ / 2; float delta_integral = Math.Abs(integral_F_2 - integral_F); /////////// //delta_t Rectangle rect_5 = new Rectangle(); rect_5.Stroke = Brushes.Gray; Grid.SetRow(rect_5, num_of_rows - 1); Grid.SetColumn(rect_5, 4); Label lb3 = AuxiliaryFunc.getNewLabel(delta_t.ToString(), 30, 25, 5); lb3.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb3.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb3, num_of_rows - 1); Grid.SetColumn(lb3, 4); // G2 Rectangle rect_6 = new Rectangle(); rect_6.Stroke = Brushes.Gray; Grid.SetRow(rect_6, num_of_rows - 1); Grid.SetColumn(rect_6, 5); Label lb4 = AuxiliaryFunc.getNewLabel(G2.ToString(), 30, 25, 5); lb4.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb4.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb4, num_of_rows - 1); Grid.SetColumn(lb4, 5); // integral_F Rectangle rect_7 = new Rectangle(); rect_7.Stroke = Brushes.Gray; Grid.SetRow(rect_7, num_of_rows - 1); Grid.SetColumn(rect_7, 6); Label lb5 = AuxiliaryFunc.getNewLabel(integral_F_2.ToString(), 30, 25, 5); lb5.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb5.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb5, num_of_rows - 1); Grid.SetColumn(lb5, 6); // delta_F Rectangle rect_8 = new Rectangle(); rect_8.Stroke = Brushes.Gray; Grid.SetRow(rect_8, num_of_rows - 1); Grid.SetColumn(rect_8, 7); Label lb6 = AuxiliaryFunc.getNewLabel(delta_F.ToString(), 30, 25, 5); lb6.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb6.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb6, num_of_rows - 1); Grid.SetColumn(lb6, 7); // delta_G Rectangle rect_9 = new Rectangle(); rect_9.Stroke = Brushes.Gray; Grid.SetRow(rect_9, num_of_rows - 1); Grid.SetColumn(rect_9, 8); Label lb7 = AuxiliaryFunc.getNewLabel(delta_G.ToString(), 30, 25, 5); lb7.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb7.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb7, num_of_rows - 1); Grid.SetColumn(lb7, 8); // delta_integarl Rectangle rect_10 = new Rectangle(); rect_10.Stroke = Brushes.Gray; Grid.SetRow(rect_10, num_of_rows - 1); Grid.SetColumn(rect_10, 9); Label lb8 = AuxiliaryFunc.getNewLabel(delta_integral.ToString(), 30, 25, 5); lb8.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; lb8.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(lb8, num_of_rows - 1); Grid.SetColumn(lb8, 9); grid_table_print_2.Children.Add(rect_1); grid_table_print_2.Children.Add(rect_2); grid_table_print_2.Children.Add(rect_3); grid_table_print_2.Children.Add(rect_4); grid_table_print_2.Children.Add(rect_5); grid_table_print_2.Children.Add(rect_6); grid_table_print_2.Children.Add(rect_7); grid_table_print_2.Children.Add(rect_8); grid_table_print_2.Children.Add(rect_9); grid_table_print_2.Children.Add(rect_10); grid_table_print_2.Children.Add(lb0); grid_table_print_2.Children.Add(lb); grid_table_print_2.Children.Add(lb1); grid_table_print_2.Children.Add(lb2); grid_table_print_2.Children.Add(lb3); grid_table_print_2.Children.Add(lb4); grid_table_print_2.Children.Add(lb5); grid_table_print_2.Children.Add(lb6); grid_table_print_2.Children.Add(lb7); grid_table_print_2.Children.Add(lb8); } margin = grid_table_print_2.Margin; margin.Bottom = 10; margin.Left = 25; margin.Top = 25; margin.Right = 0; grid_table_print_2.Margin = margin; Grid.SetRow(grid_table_print_2, 2); Grid.SetColumn(grid_table_print_2, 0); Button button_1 = AuxiliaryFunc.getNewButton("Повторить оцифровку в ручном режиме", 300, 25); button_1.Click += new RoutedEventHandler(digitization); button_1.IsEnabled = false; AuxiliaryFunc.setMargin((Control)button_1, 25, 10, 0, 10); Button button_2 = AuxiliaryFunc.getNewButton("Печать", 200, 25); button_2.Click += new RoutedEventHandler(printing_3); AuxiliaryFunc.setMargin((Control)button_2, 25, 10, 0, 10); stack_panel_2.Children.Add(button_1); stack_panel_2.Children.Add(button_2); stack_panel_2.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; Grid.SetRow(stack_panel_2, 3); Grid.SetColumn(stack_panel_2, 0); grid_main.Children.Add(grid_table_print_2); grid_main.Children.Add(header); grid_main.Children.Add(plotter_cntrl.plotter); grid_main.Children.Add(stack_panel_1); grid_main.Children.Add(stack_panel_2); plotter_cntrl.plot_measured_data(); digitize_measurement(); return grid_main; }
public MainWindow() { try { InitializeComponent(); //SplashScreen splashScreen = new SplashScreen("logo.bmp"); //splashScreen.Show(true); InitializeCOMInterface(); create_training_tab(out tr_tab); create_tarirovka_tab(out tar_tab); create_calc_tab(out calc_tab); create_setings_tab(out set_tab); create_measuring_tab(out meas_tab); main_pg = new main_page(); main_pg.evt_tarirovka_click.someEvent += new _MarkerEventHandler(tarirovka_click); main_pg.evt_Training_Click.someEvent += new _MarkerEventHandler(Training_Click); main_pg.evt_draw_calc_choise.someEvent += new _MarkerEventHandler(draw_calc_choise); main_pg.evt_Measuring_Click.someEvent += new _MarkerEventHandler(Measuring_Click); tdb = new tassDB(); program_settings = new ProgramSettings(); SetParametersFromSettings(tdb.get_default_settings()); device = new DeviceTune(); pattern = new Template(); //Прорисовка главного меню MainMenuDraw(); // прорисовка заставки //TimeSpan timeSp = new TimeSpan(0, 0, 3); //splashScreen.Close(timeSp); //Thread.Sleep(1000); } catch (Exception fail) { String error = "The following error has occurred:\n\n"; error += fail.Message.ToString() + "\n\n"; MessageBox.Show(error); } }
public void getTunedDevice(out DeviceTune device_in, ref ProgramSettings program_settings_in) { // установка параметров после успешной тарировки program_settings_in.set_parameters(ref device); device_in = device; }
public Grid measuring_tab_3alternatives(ProgramSettings program_settings_in, Template pattern_in) { program_settings = program_settings_in; pattern = pattern_in; Grid grid_main = new Grid(); RowDefinition row_def_1 = new RowDefinition(); RowDefinition row_def_2 = new RowDefinition(); RowDefinition row_def_3 = new RowDefinition(); RowDefinition row_def_4 = new RowDefinition(); row_def_1.Height = new GridLength(100); row_def_2.Height = new GridLength(150); row_def_4.Height = new GridLength(80); ColumnDefinition col_def_1 = new ColumnDefinition(); grid_main.RowDefinitions.Add(row_def_1); grid_main.RowDefinitions.Add(row_def_2); grid_main.RowDefinitions.Add(row_def_3); grid_main.RowDefinitions.Add(row_def_4); grid_main.ColumnDefinitions.Add(col_def_1); StackPanel stack_panel_1 = new StackPanel(); stack_panel_1.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; stack_panel_1.Orientation = Orientation.Horizontal; StackPanel stack_panel_2 = new StackPanel(); stack_panel_2.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; stack_panel_2.Orientation = Orientation.Horizontal; StackPanel stack_panel_3 = new StackPanel(); stack_panel_3.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; stack_panel_3.Orientation = Orientation.Horizontal; TextBlock header = new TextBlock(); header.Inlines.Add(new Bold(new Run(" Режим измерения\n\n "))); header.Width = 300; header.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; Thickness margin = header.Margin; margin.Bottom = 25; margin.Left = 25; margin.Top = 25; margin.Right = 0; header.Margin = margin; stack_panel_1.Children.Add(header); Grid.SetRow(stack_panel_1, 0); Grid.SetColumn(stack_panel_1, 0); StackPanel stack_panel_4 = new StackPanel(); stack_panel_4.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; stack_panel_4.Orientation = Orientation.Vertical; TextBlock parameters_info = new TextBlock(); parameters_info.Inlines.Add((new Run(" Повторить циклы развития усилия с параметрами:"))); margin = parameters_info.Margin; margin.Bottom = 5; margin.Left = 50; margin.Top = 25; margin.Right = 0; parameters_info.Margin = margin; parameters_info.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; Label label_f = new Label(); label_f.Height = 25; label_f.Width = 200; label_f.Content = "F = " + program_settings.f_max.ToString() + " [Н], t = " + program_settings.time_incr.ToString() + " [c], n = " + program_settings.num_of_attempts.ToString(); AuxiliaryFunc.setMargin((Control)label_f, 0, 50, 25, 0); label_f.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; stack_panel_4.Children.Add(parameters_info); stack_panel_4.Children.Add(label_f); Grid.SetRow(stack_panel_4, 1); Grid.SetColumn(stack_panel_4, 0); rb_1 = new RadioButton(); rb_1.Content = "Слепой режим измерений"; rb_2 = new RadioButton(); rb_2.Content = "Режим измерений с выключенным шаблоном"; rb_3 = new RadioButton(); rb_3.Content = "Режим измерений с включенным шаблоном"; stack_panel_2.Children.Add(rb_1); stack_panel_2.Children.Add(rb_2); stack_panel_2.Children.Add(rb_3); stack_panel_2.Orientation = Orientation.Vertical; Grid.SetRow(stack_panel_2, 2); Grid.SetColumn(stack_panel_2, 0); Button button_1 = AuxiliaryFunc.getNewButton("Старт", 200, 25); AuxiliaryFunc.setMargin((Control)button_1, 25, 10, 0, 10); button_1.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; button_1.Click += new RoutedEventHandler(go_to_measuring); Button button_2 = AuxiliaryFunc.getNewButton("Отмена", 200, 25); AuxiliaryFunc.setMargin((Control)button_2, 25, 10, 0, 10); button_2.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; button_2.Click += new RoutedEventHandler(cancel_measuring); stack_panel_3.Children.Add(button_1); stack_panel_3.Children.Add(button_2); stack_panel_3.Orientation = Orientation.Horizontal; stack_panel_3.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; Grid.SetRow(stack_panel_3, 3); Grid.SetColumn(stack_panel_3, 0); grid_main.Children.Add(stack_panel_1); grid_main.Children.Add(stack_panel_2); grid_main.Children.Add(stack_panel_3); grid_main.Children.Add(stack_panel_4); return grid_main; }
public PlotterControl(Dispatcher disp) { evt_1 = new MarkerEvent1(); evt_2 = new MarkerEvent1(); m_smplQueue = new Queue(); device = new DeviceTune(); pattern = new Template(); // Создание шаблона для тренировки pattern.create_template(); program_settings = new ProgramSettings(); dp_test = disp; }
public Grid drawSetings(ref ProgramSettings program_settings_in) { base_grid = new Grid(); //base_grid.ShowGridLines = true; RowDefinition row_def_1_ = new RowDefinition(); RowDefinition row_def_2_ = new RowDefinition(); RowDefinition row_def_3_ = new RowDefinition(); row_def_3_.Height = new GridLength(80); ColumnDefinition col_def_1_ = new ColumnDefinition(); col_def_1_.Width = new GridLength(600); ColumnDefinition col_def_2_ = new ColumnDefinition(); //col_def_1_.Width = System.Windows.GridLength.Auto; //col_def_2_.Width = System.Windows.GridLength.Auto; base_grid.RowDefinitions.Add(row_def_1_); base_grid.RowDefinitions.Add(row_def_2_); base_grid.RowDefinitions.Add(row_def_3_); base_grid.ColumnDefinitions.Add(col_def_1_); base_grid.ColumnDefinitions.Add(col_def_2_); // Основные настройки Grid grid_1 = new Grid(); // grid_1.ShowGridLines = true; RowDefinition row_def_grid_1 = new RowDefinition(); RowDefinition row_def_grid_2 = new RowDefinition(); RowDefinition row_def_grid_3 = new RowDefinition(); RowDefinition row_def_grid_4 = new RowDefinition(); RowDefinition row_def_grid_5 = new RowDefinition(); RowDefinition row_def_grid_6 = new RowDefinition(); RowDefinition row_def_grid_7 = new RowDefinition(); RowDefinition row_def_grid_8 = new RowDefinition(); ColumnDefinition col_def_grid_1_1 = new ColumnDefinition(); ColumnDefinition col_def_grid_1_2 = new ColumnDefinition(); col_def_grid_1_1.Width = System.Windows.GridLength.Auto; col_def_grid_1_2.Width = System.Windows.GridLength.Auto; grid_1.RowDefinitions.Add(row_def_grid_1); grid_1.RowDefinitions.Add(row_def_grid_2); grid_1.RowDefinitions.Add(row_def_grid_3); grid_1.RowDefinitions.Add(row_def_grid_4); grid_1.RowDefinitions.Add(row_def_grid_5); grid_1.RowDefinitions.Add(row_def_grid_6); grid_1.RowDefinitions.Add(row_def_grid_7); grid_1.RowDefinitions.Add(row_def_grid_8); grid_1.ColumnDefinitions.Add(col_def_grid_1_1); grid_1.ColumnDefinitions.Add(col_def_grid_1_2); Thickness margin = grid_1.Margin; margin.Bottom = 5; margin.Left = 10; margin.Top = 20; margin.Right = 5; grid_1.Margin = margin; Grid.SetRow(grid_1, 0); Grid.SetColumn(grid_1, 0); Label force_max_label = AuxiliaryFunc.getNewLabel("Максимальное значение прикладываемой силы Fmax, [Н.]", 300, 25, 0); force_max_label.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(force_max_label, 0); Grid.SetColumn(force_max_label, 0); force_max_text = new TextBox(); force_max_text = (TextBox)AuxiliaryFunc.setNewControl("force_max", (Control)force_max_text, 200, 25); force_max_text.VerticalAlignment = System.Windows.VerticalAlignment.Center; force_max_text.TextAlignment = System.Windows.TextAlignment.Right; AuxiliaryFunc.setMargin(force_max_text, 0, 25, 5, 0); Grid.SetRow(force_max_text, 0); Grid.SetColumn(force_max_text, 1); Label time_increase = AuxiliaryFunc.getNewLabel("Время развития усилия t, [c.]", 300, 25, 0); time_increase.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(time_increase, 1); Grid.SetColumn(time_increase, 0); time_value = new TextBox(); time_value = ((TextBox)AuxiliaryFunc.setNewControl("time_value", (Control)time_value, 200, 25)); time_value.TextAlignment = System.Windows.TextAlignment.Right; AuxiliaryFunc.setMargin(time_value, 0, 25, 5, 0); time_value.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(time_value, 1); Grid.SetColumn(time_value, 1); Label time_pause = AuxiliaryFunc.getNewLabel("Интервал между попытками t, [c.]", 200, 25, 0); time_pause.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(time_pause, 2); Grid.SetColumn(time_pause, 0); time_pause_text = new TextBox(); time_pause_text = (TextBox)AuxiliaryFunc.setNewControl("time_pause_text", (Control)time_pause_text, 200, 25); time_pause_text.TextAlignment = System.Windows.TextAlignment.Right; time_pause_text.VerticalAlignment = System.Windows.VerticalAlignment.Center; AuxiliaryFunc.setMargin(time_pause_text, 0, 25, 5, 0); Grid.SetRow(time_pause_text, 2); Grid.SetColumn(time_pause_text, 1); Label number_of_attempts = AuxiliaryFunc.getNewLabel("Количество попыток", 200, 25, 0); number_of_attempts.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(number_of_attempts, 3); Grid.SetColumn(number_of_attempts, 0); attempts_num = new TextBox(); attempts_num = (TextBox)AuxiliaryFunc.setNewControl("attempts_num", (Control)attempts_num, 200, 25); attempts_num.TextAlignment = System.Windows.TextAlignment.Right; attempts_num.VerticalAlignment = System.Windows.VerticalAlignment.Center; AuxiliaryFunc.setMargin(attempts_num, 0, 25, 5, 0); Grid.SetRow(attempts_num, 3); Grid.SetColumn(attempts_num, 1); Label allow_digit = AuxiliaryFunc.getNewLabel("Разрешить оцифровку", 200, 25, 0); allow_digit.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(allow_digit, 4); Grid.SetColumn(allow_digit, 0); allow_digit_check = new CheckBox(); allow_digit_check = (CheckBox)AuxiliaryFunc.setNewControl("allow_digit_check", (Control)allow_digit_check, 100, 25); allow_digit_check.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; allow_digit_check.VerticalAlignment = System.Windows.VerticalAlignment.Center; allow_digit_check.Checked += allow_digit_check_Checked; AuxiliaryFunc.setMargin(allow_digit_check, 0, 125, 0, 0); Grid.SetRow(allow_digit_check, 4); Grid.SetColumn(allow_digit_check, 1); Label allow_auto_calculate = AuxiliaryFunc.getNewLabel("Разрешить автоматические расчеты", 200, 25, 0); allow_auto_calculate.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(allow_auto_calculate, 5); Grid.SetColumn(allow_auto_calculate, 0); allow_auto_check = new CheckBox(); allow_auto_check.Checked += allow_auto_check_Checked; allow_auto_check.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; allow_auto_check.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; AuxiliaryFunc.setMargin(allow_auto_check, 0, 125, 0, 0); allow_auto_check = (CheckBox)AuxiliaryFunc.setNewControl("allow_auto_check", (Control)allow_auto_check, 100, 25); Grid.SetRow(allow_auto_check, 5); Grid.SetColumn(allow_auto_check, 1); template_name_text = new TextBox(); template_name_text = (TextBox)AuxiliaryFunc.setNewControl("template_name_text", (Control)template_name_text, 200, 25); template_name_text.TextAlignment = System.Windows.TextAlignment.Right; AuxiliaryFunc.setMargin(template_name_text, 0, 25, 5, 0); template_name_text.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(template_name_text, 6); Grid.SetColumn(template_name_text, 1); StackPanel stack_p = new StackPanel(); Label template_name_lb = AuxiliaryFunc.getNewLabel("Имя шаблона", 200, 25, 0); template_name_lb.VerticalAlignment = System.Windows.VerticalAlignment.Center; Grid.SetRow(template_name_lb, 6); Grid.SetColumn(template_name_lb, 0); grid_1.Children.Add(force_max_label); grid_1.Children.Add(force_max_text); grid_1.Children.Add(time_increase); grid_1.Children.Add(time_value); grid_1.Children.Add(number_of_attempts); grid_1.Children.Add(time_pause); grid_1.Children.Add(time_pause_text); grid_1.Children.Add(attempts_num); grid_1.Children.Add(allow_digit); grid_1.Children.Add(allow_digit_check); grid_1.Children.Add(allow_auto_calculate); grid_1.Children.Add(allow_auto_check); grid_1.Children.Add(template_name_lb); grid_1.Children.Add(template_name_text); // заполнение полей настроек force_max_text.Text = program_settings_in.f_max.ToString(); attempts_num.Text = program_settings_in.num_of_attempts.ToString(); allow_digit_check.IsChecked = program_settings_in.digitization; allow_auto_check.IsChecked = program_settings_in.calculation; time_value.Text = program_settings_in.time_incr.ToString(); time_pause_text.Text = program_settings_in.t_pause.ToString(); //////////////////////// вспомогательные настройки StackPanel expander_panel = new StackPanel(); expander_panel.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; expander_panel.Background = Brushes.Bisque; Grid grid_2 = new Grid(); margin = grid_2.Margin; margin.Bottom = 5; margin.Left = 10; margin.Top = 20; margin.Right = 5; grid_2.Margin = margin; //grid_2.ShowGridLines = true; RowDefinition row_def_grid_2_1 = new RowDefinition(); RowDefinition row_def_grid_2_2 = new RowDefinition(); RowDefinition row_def_grid_2_3 = new RowDefinition(); RowDefinition row_def_grid_2_4 = new RowDefinition(); RowDefinition row_def_grid_2_5 = new RowDefinition(); RowDefinition row_def_grid_2_6 = new RowDefinition(); RowDefinition row_def_grid_2_7 = new RowDefinition(); RowDefinition row_def_grid_2_8 = new RowDefinition(); ColumnDefinition col_def_grid_2_1 = new ColumnDefinition(); ColumnDefinition col_def_grid_2_2 = new ColumnDefinition(); ColumnDefinition col_def_grid_2_3 = new ColumnDefinition(); col_def_grid_2_1.Width = System.Windows.GridLength.Auto; col_def_grid_2_2.Width = System.Windows.GridLength.Auto; col_def_grid_2_3.Width = System.Windows.GridLength.Auto; grid_2.RowDefinitions.Add(row_def_grid_2_1); grid_2.RowDefinitions.Add(row_def_grid_2_2); grid_2.RowDefinitions.Add(row_def_grid_2_3); grid_2.RowDefinitions.Add(row_def_grid_2_4); grid_2.RowDefinitions.Add(row_def_grid_2_5); grid_2.RowDefinitions.Add(row_def_grid_2_6); grid_2.RowDefinitions.Add(row_def_grid_2_7); grid_2.RowDefinitions.Add(row_def_grid_2_8); grid_2.ColumnDefinitions.Add(col_def_grid_2_1); grid_2.ColumnDefinitions.Add(col_def_grid_2_2); grid_2.ColumnDefinitions.Add(col_def_grid_2_3); Label template_label = AuxiliaryFunc.getNewLabel("Шаблон", 175, 25, 5); template_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(template_label, 0); Grid.SetColumn(template_label, 0); Label template_color_label = AuxiliaryFunc.getNewLabel("цвет", 150, 25, 5); template_color_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(template_color_label, 0); Grid.SetColumn(template_color_label, 1); color_list_box = AuxiliaryFunc.get_color_combo_box(); AuxiliaryFunc.setMargin(color_list_box, 0, 0, 5, 0); color_list_box.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; color_list_box.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; color_list_box.SelectedIndex = program_settings_in.template_color_num; Grid.SetRow(color_list_box, 0); Grid.SetColumn(color_list_box, 2); Label template_width_label = AuxiliaryFunc.getNewLabel("толщина линии", 100, 25, 5); template_width_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(template_width_label, 1); Grid.SetColumn(template_width_label, 1); widths_list_box = AuxiliaryFunc.get_line_width_combo_box(); widths_list_box.SelectedIndex = program_settings_in.template_line_width; AuxiliaryFunc.setMargin(widths_list_box, 0, 0, 5, 0); color_list_box.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; color_list_box.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(widths_list_box, 1); Grid.SetColumn(widths_list_box, 2); Label curve_label = AuxiliaryFunc.getNewLabel("Кривая", 100, 25, 5); curve_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(curve_label, 2); Grid.SetColumn(curve_label, 0); Label curve_color_label = AuxiliaryFunc.getNewLabel("цвет", 100, 25, 5); curve_color_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(curve_color_label, 2); Grid.SetColumn(curve_color_label, 1); color_list_box_1 = AuxiliaryFunc.get_color_combo_box(); AuxiliaryFunc.setMargin(color_list_box_1, 0, 0, 5, 0); color_list_box_1.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; color_list_box_1.SelectedIndex = program_settings_in.measurement_color_num; Grid.SetRow(color_list_box_1, 2); Grid.SetColumn(color_list_box_1, 2); Label curve_width_label = AuxiliaryFunc.getNewLabel("толщина линии", 100, 25, 5); curve_width_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(curve_width_label, 3); Grid.SetColumn(curve_width_label, 1); widths_list_box_1 = AuxiliaryFunc.get_line_width_combo_box(); AuxiliaryFunc.setMargin(widths_list_box_1, 0, 0, 5, 0); widths_list_box_1.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; widths_list_box_1.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; widths_list_box_1.SelectedIndex = program_settings_in.measurement_line_width; Grid.SetRow(widths_list_box_1, 3); Grid.SetColumn(widths_list_box_1, 2); Label grid_label = AuxiliaryFunc.getNewLabel("Координатная сетка", 100, 25, 5); grid_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(grid_label, 4); Grid.SetColumn(grid_label, 0); Label grid_color_label = AuxiliaryFunc.getNewLabel("цвет", 100, 25, 5); grid_color_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(grid_color_label, 4); Grid.SetColumn(grid_color_label, 1); color_list_box_2 = AuxiliaryFunc.get_color_combo_box(); color_list_box_2.SelectedIndex = program_settings_in.grid_color_num; AuxiliaryFunc.setMargin(color_list_box_2, 0, 0, 5, 0); color_list_box_2.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(color_list_box_2, 4); Grid.SetColumn(color_list_box_2, 2); Label grid_width_label = AuxiliaryFunc.getNewLabel("толщина линий", 100, 25, 5); grid_width_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(grid_width_label, 5); Grid.SetColumn(grid_width_label, 1); widths_list_box_2 = AuxiliaryFunc.get_line_width_combo_box(); AuxiliaryFunc.setMargin(widths_list_box_2, 0, 0, 5, 0); widths_list_box_2.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; widths_list_box_2.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; widths_list_box_2.SelectedIndex = program_settings_in.grid_line_width; Grid.SetRow(widths_list_box_2, 5); Grid.SetColumn(widths_list_box_2, 2); Label axis_label = AuxiliaryFunc.getNewLabel("Оси координат", 100, 25, 5); axis_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(axis_label, 6); Grid.SetColumn(axis_label, 0); Label axis_color_label = AuxiliaryFunc.getNewLabel("цвет", 100, 25, 5); axis_color_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(axis_color_label, 6); Grid.SetColumn(axis_color_label, 1); color_list_box_3 = AuxiliaryFunc.get_color_combo_box(); AuxiliaryFunc.setMargin(color_list_box_3, 0, 0, 5, 0); color_list_box_3.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; color_list_box_3.SelectedIndex = program_settings_in.axis_color_num; Grid.SetRow(color_list_box_3, 6); Grid.SetColumn(color_list_box_3, 2); Label axis_width_label = AuxiliaryFunc.getNewLabel("толщина линий", 100, 25, 5); axis_width_label.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Grid.SetRow(axis_width_label, 7); Grid.SetColumn(axis_width_label, 1); widths_list_box_3 = AuxiliaryFunc.get_line_width_combo_box(); AuxiliaryFunc.setMargin(widths_list_box_3, 0, 0, 5, 0); widths_list_box_3.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; widths_list_box_3.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; widths_list_box_3.SelectedIndex = program_settings_in.axis_line_width; Grid.SetRow(widths_list_box_3, 7); Grid.SetColumn(widths_list_box_3, 2); StackPanel button_panel_1 = new StackPanel(); button_panel_1.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; button_panel_1.Orientation = Orientation.Horizontal; Button save_settings_button = AuxiliaryFunc.getNewButton("save", 200, 25); save_settings_button.Content = "Сохранить шаблон"; AuxiliaryFunc.setMargin((Control)save_settings_button, 25, 10, 0, 10); save_settings_button.Click += new RoutedEventHandler(save_settings); button_panel_1.Children.Add(save_settings_button); Grid.SetRow(button_panel_1, 2); Grid.SetColumn(button_panel_1, 0); StackPanel button_panel_2 = new StackPanel(); button_panel_2.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; button_panel_2.Orientation = Orientation.Horizontal; Grid.SetRow(button_panel_2, 2); Grid.SetColumn(button_panel_2, 1); Button apply_settings_button = AuxiliaryFunc.getNewButton("apply", 200, 25); apply_settings_button.Content = "Применить"; AuxiliaryFunc.setMargin((Control)apply_settings_button, 25, 10, 0, 10); apply_settings_button.Click += new RoutedEventHandler(apply_settings); Button cancel_settings_button = AuxiliaryFunc.getNewButton("cancel", 200, 25); cancel_settings_button.Content = "Выход"; AuxiliaryFunc.setMargin((Control)cancel_settings_button, 25, 10, 0, 10); cancel_settings_button.Click += new RoutedEventHandler(cancel_settings); button_panel_2.Children.Add(apply_settings_button); button_panel_2.Children.Add(cancel_settings_button); GroupBox gb_1 = new GroupBox(); Grid.SetRow(gb_1, 0); Grid.SetColumn(gb_1, 0); gb_1.Content = grid_1; gb_1.Background = Brushes.Snow; gb_1.Header = "Основные настройки"; margin = gb_1.Margin; margin.Bottom = 5; margin.Left = 5; margin.Top = 5; margin.Right = 5; gb_1.Margin = margin; GroupBox gb_2 = new GroupBox(); Grid.SetRow(gb_2, 1); Grid.SetColumn(gb_2, 0); gb_2.Content = grid_2; gb_2.Background = Brushes.Snow; gb_2.Header = "Вспомогательные настройки"; margin = gb_2.Margin; margin.Bottom = 5; margin.Left = 5; margin.Top = 5; margin.Right = 5; gb_2.Margin = margin; grid_2.Children.Add(curve_label); grid_2.Children.Add(curve_color_label); grid_2.Children.Add(curve_width_label); grid_2.Children.Add(grid_label); grid_2.Children.Add(grid_color_label); grid_2.Children.Add(grid_width_label); grid_2.Children.Add(axis_label); grid_2.Children.Add(axis_color_label); grid_2.Children.Add(axis_width_label); grid_2.Children.Add(template_label); grid_2.Children.Add(template_color_label); grid_2.Children.Add(color_list_box); grid_2.Children.Add(color_list_box_1); grid_2.Children.Add(color_list_box_2); grid_2.Children.Add(color_list_box_3); grid_2.Children.Add(widths_list_box); grid_2.Children.Add(widths_list_box_1); grid_2.Children.Add(widths_list_box_2); grid_2.Children.Add(widths_list_box_3); grid_2.Children.Add(template_width_label); list_of_templates = new ListView(); GridView myGridView = new GridView(); myGridView.AllowsColumnReorder = true; myGridView.ColumnHeaderToolTip = "Шаблоны настроек"; GridViewColumn gvc1 = new GridViewColumn(); gvc1.DisplayMemberBinding = new Binding("Template_number"); gvc1.Header = "Номер шаблона"; gvc1.Width = 100; myGridView.Columns.Add(gvc1); GridViewColumn gvc2 = new GridViewColumn(); gvc2.DisplayMemberBinding = new Binding("Template_name"); gvc2.Header = "Имя шаблона"; gvc2.Width = 100; myGridView.Columns.Add(gvc2); GridViewColumn gvc3 = new GridViewColumn(); gvc3.DisplayMemberBinding = new Binding("F_max"); gvc3.Header = "Сила"; gvc3.Width = 80; myGridView.Columns.Add(gvc3); GridViewColumn gvc4 = new GridViewColumn(); gvc4.DisplayMemberBinding = new Binding("T_increase"); gvc4.Header = "Время развития усилия"; gvc4.Width = 140; myGridView.Columns.Add(gvc4); GridViewColumn gvc5 = new GridViewColumn(); gvc5.DisplayMemberBinding = new Binding("Number_of_attempts"); gvc5.Header = "Количество попыток"; gvc5.Width = 130; myGridView.Columns.Add(gvc5); list_of_templates.View = myGridView; margin = list_of_templates.Margin; margin.Bottom = 5; margin.Left = 5; margin.Top = 5; margin.Right = 5; list_of_templates.Margin = margin; list_of_templates.SelectionChanged += list_of_templates_SelectionChanged; query_template(); GroupBox gb_3 = new GroupBox(); //gb_1.Content = "Основные настройки"; Grid.SetRow(gb_3, 0); Grid.SetColumn(gb_3, 1); Grid.SetRowSpan(gb_3, 2); gb_3.Content = list_of_templates; gb_3.Background = Brushes.Snow; gb_3.Header = "Список шаблонов настроек"; margin = gb_3.Margin; margin.Bottom = 5; margin.Left = 5; margin.Top = 5; margin.Right = 5; gb_3.Margin = margin; base_grid.Children.Add(gb_1); base_grid.Children.Add(gb_2); base_grid.Children.Add(button_panel_1); base_grid.Children.Add(gb_3); base_grid.Children.Add(button_panel_2); return base_grid; }
public void getProgramSettings(ref Template pattern_in, ref ProgramSettings program_settings_in) { program_settings_in.f_max = (float)Double.Parse(force_max_text.Text.ToString()); program_settings_in.num_of_attempts = Int16.Parse(attempts_num.Text.ToString()); program_settings_in.digitization = allow_digit_check.IsChecked.Value; program_settings_in.calculation = allow_auto_check.IsChecked.Value; program_settings_in.time_incr = (float)Double.Parse(time_value.Text.ToString()); program_settings_in.t_pause = (float)Double.Parse(time_pause_text.Text.ToString()); program_settings_in.template_color_num = color_list_box.SelectedIndex; program_settings_in.template_line_width = widths_list_box.SelectedIndex; program_settings_in.measurement_color_num = color_list_box_1.SelectedIndex; program_settings_in.measurement_line_width = widths_list_box_1.SelectedIndex; program_settings_in.grid_color_num = color_list_box_2.SelectedIndex; program_settings_in.grid_line_width = widths_list_box_2.SelectedIndex; program_settings_in.axis_color_num = color_list_box_3.SelectedIndex; program_settings_in.axis_line_width = widths_list_box_3.SelectedIndex; pattern_in.A = program_settings_in.f_max; pattern_in.num_of_pulses = program_settings_in.num_of_attempts; pattern_in.t_pulse = program_settings_in.time_incr; pattern_in.t_zero = program_settings_in.t_pause; tdb.replace_set(program_settings_in.num_of_set_template.ToString()); }