Exemple #1
0
        public W_Measurements(C_Logic v_Logic)
        {
            InitializeComponent();

            V_Logic = v_Logic;

            foreach (var v_type in V_Logic.Fv_Options.F_GetTypeMeasurement())
            {
                CB_TypeMeasurement.Items.Add(v_type);
            }

            foreach (C_ParametorGrid.S_ParameterGrid v_grid in C_ParametorGrid.F_GridGet())
            {
                CB_MonochromatorDynamicGrid.Items.Add(v_grid.Fv_NumberStrokes);
                CB_MonochromatorStaticGrid.Items.Add(v_grid.Fv_NumberStrokes);
            }

            CB_TypeMeasurement.SelectionChanged += delegate(object sender, SelectionChangedEventArgs e)
            {
                if (CB_TypeMeasurement.SelectedIndex == 0)
                {
                    T_MonochromatorStaticOrDynamic.Text = "Длина волны возбуждения";
                }
                else
                {
                    T_MonochromatorStaticOrDynamic.Text = "Длина волны эмиссии";
                }
                V_Logic.Fv_Options.Fv_NumTypeMeasurement = CB_TypeMeasurement.SelectedIndex;

                TB_MonochromatorStatic.Text     = V_Logic.Fv_Options.V_WaveStatic.Fv_wave.ToString("F3", CultureInfo.InvariantCulture);
                TB_MonochromatorDynamic.Text    = V_Logic.Fv_Options.V_WaveDynamic.Fv_wave.ToString("F3", CultureInfo.InvariantCulture);
                TB_MonochromatorMinDynamic.Text = V_Logic.Fv_Options.V_WaveDynamic.Fv_ParameterGrid.Fv_Min.ToString("F3", CultureInfo.InvariantCulture);

                CB_MonochromatorDynamicGrid.SelectedIndex = C_ParametorGrid.F_GridGet().FindIndex(x => x.Equals(V_Logic.Fv_Options.V_WaveDynamic.Fv_ParameterGrid));
                CB_MonochromatorStaticGrid.SelectedIndex  = C_ParametorGrid.F_GridGet().FindIndex(x => x.Equals(V_Logic.Fv_Options.V_WaveStatic.Fv_ParameterGrid));
            };
            CB_TypeMeasurement.SelectedIndex = V_Logic.Fv_Options.Fv_NumTypeMeasurement;

            CB_MonochromatorDynamicGrid.LostFocus       += delegate(object sender, RoutedEventArgs e) { F_NewOptions(); };           // Применение новых настроек
            CB_MonochromatorStaticGrid.SelectionChanged += delegate(object sender, SelectionChangedEventArgs e) { F_NewOptions(); }; // Применение новых настроек
            TB_MonochromatorStatic.LostFocus            += delegate(object sender, RoutedEventArgs e) { F_NewOptions(); };           // Применение новых настроек
            TB_MonochromatorDynamic.LostFocus           += delegate(object sender, RoutedEventArgs e) { F_NewOptions(); };           // Применение новых настроек
            TB_MonochromatorMinDynamic.LostFocus        += delegate(object sender, RoutedEventArgs e) { F_NewOptions(); };           // Применение новых настроек

            V_Logic.E_CloseException += delegate() { this.Close(); };                                                                // Закрытие из за ошибок

            V_Logic.E_MeasurementOnSuccess += delegate()
            {
                B_Correction.IsEnabled    = B_Free.IsEnabled = B_Save.IsEnabled = B_Stop.IsEnabled = TB_Name.IsEnabled = Gr_OptionsD01.IsEnabled = true;
                B_Сalibration02.IsEnabled = B_On.IsEnabled = B_D01.IsEnabled = B_D02.IsEnabled = false;
            }; // Блокировка/Активация элементов интерфейса при успешном подключении

            V_Logic.E_MeasurementCorrectionSuccess += delegate()
            {
                B_Start.IsEnabled = B_WaveSattic.IsEnabled = B_Dynamic.IsEnabled = Gr_OptionsD01.IsEnabled = Gr_OptionsD02.IsEnabled = true;
                B_D01.IsEnabled   = B_D02.IsEnabled = B_On.IsEnabled = false;
            }; // Блокировка/Активация элементов интерфейса при успешной корекции

            V_Logic.E_MeasurementOffSuccess += delegate()
            {
                B_Сalibration02.IsEnabled = B_D01.IsEnabled = B_D02.IsEnabled = B_On.IsEnabled = true;
                B_Correction.IsEnabled    = B_Free.IsEnabled = B_Start.IsEnabled = B_Save.IsEnabled = B_WaveSattic.IsEnabled = B_Dynamic.IsEnabled = B_Stop.IsEnabled = TB_Name.IsEnabled = Gr_OptionsD02.IsEnabled = Gr_OptionsD01.IsEnabled = false;
            }; // Блокировка/Активация элементов интерфейса при успешном отключении

            V_Logic.E_MeasurementNew += delegate(int V_PMTOut, int v_ReferenceOut, int v_ProbeOut, double v_OutExcitation, double v_OutEmission, double v_WaveDynamic, double v_WaveStatic, C_Calibration02 v_Calibration02)
            {
                TB_NumberRequest.Text = (int.Parse(TB_NumberRequest.Text) + 1).ToString(); TB_PMTOut.Text = V_PMTOut.ToString();
                TB_ReferenceOut.Text  = v_ReferenceOut.ToString();
                TB_ProbeOut.Text      = v_ProbeOut.ToString();

                TB_OutEmission.Text   = v_OutEmission.ToString("e2");
                TB_OutExcitation.Text = v_OutExcitation.ToString("e2");
            };

            WinFH_Paint = new System.Windows.Forms.Integration.WindowsFormsHost();
        }
Exemple #2
0
 /// <summary>
 /// Установка настроек
 /// </summary>
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     V_Logic = new C_Logic();
     this.Close();
 }