private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            var config = SettingsData.Load();

            config.DisplaySettingsData.MinX = cmbMinX.Text;
            config.DisplaySettingsData.MaxX = cmbMaxX.Text;
            config.DisplaySettingsData.MinY = cmbMinY.Text;
            config.DisplaySettingsData.MaxY = cmbMaxY.Text;
            config.Save();

            // Accept the dialog and return the dialog result
            this.DialogResult = true;
            this.Close();
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StartMeasurement_Click(object sender, RoutedEventArgs e)
        {
            var config = SettingsData.Load();

            measurementInterval    = Convert.ToInt16(config.MeasurementSettingsData.Interval);
            plotViewModel.Interval = measurementInterval / 1000.0;
#if USE_DISPATCH_TIMER
            dispatchTimer.Interval = TimeSpan.FromMilliseconds(measurementInterval);
            dispatchTimer.Start();
#else
            measureThread = new System.Threading.Thread(new System.Threading.ThreadStart(StartMeasurement));
            measureThread.Start();
#endif
            measurementRunning = true;
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuItem_View_AdjustGraph_Click(object sender, RoutedEventArgs e)
        {
            DisplaySettingsWindow sw = new DisplaySettingsWindow();

            sw.Owner = this;
            Nullable <bool> dialogResult = sw.ShowDialog();

            if (dialogResult == true)
            {
                var config = SettingsData.Load();
                HorizontalScaleMin = Convert.ToInt16(config.DisplaySettingsData.MinX);
                HorizontalScaleMax = Convert.ToInt16(config.DisplaySettingsData.MaxX);
                VerticalScaleMin   = Convert.ToInt16(config.DisplaySettingsData.MinY);
                VerticalScaleMax   = Convert.ToInt16(config.DisplaySettingsData.MaxY);
            }
        }
예제 #4
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            var config = SettingsData.Load();

            config.SerialPortSettingsData.PortNum     = cmbPortNo.Text;
            config.SerialPortSettingsData.BaudRate    = int.Parse(cmbRate.Text);
            config.SerialPortSettingsData.Databit     = int.Parse(cmbData.Text);
            config.SerialPortSettingsData.Parity      = (Parity)Enum.Parse(typeof(Parity), cmbParity.Text);
            config.SerialPortSettingsData.StopBit     = (StopBits)Enum.Parse(typeof(StopBits), cmbStopBit.Text);
            config.SerialPortSettingsData.FlowControl = (Handshake)Enum.Parse(typeof(Handshake), cmbFlowCtl.Text);
            config.Save();

            // Accept the dialog and return the dialog result
            this.DialogResult = true;
            this.Close();
        }
예제 #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
#if false
            // Center window with respect to MainWindow
            Application curApp     = Application.Current;
            Window      mainWindow = curApp.MainWindow;
            this.Left = mainWindow.Left + (mainWindow.Width - this.ActualWidth) / 2;
            this.Top  = mainWindow.Top + (mainWindow.Height - this.ActualHeight) /
#endif
            var config = SettingsData.Load();
            cmbPortNo.Text  = config.SerialPortSettingsData.PortNum;
            cmbRate.Text    = config.SerialPortSettingsData.BaudRate.ToString();
            cmbData.Text    = config.SerialPortSettingsData.Databit.ToString();
            cmbParity.Text  = config.SerialPortSettingsData.Parity.ToString();
            cmbStopBit.Text = config.SerialPortSettingsData.StopBit.ToString();
            cmbFlowCtl.Text = config.SerialPortSettingsData.FlowControl.ToString();
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuItem_Settings_Measurement_Click(object sender, RoutedEventArgs e)
        {
            MeasurementSettingsWindow sw = new MeasurementSettingsWindow();

            sw.Owner = this;
            Nullable <bool> dialogResult = sw.ShowDialog();

            if (dialogResult == true && measurementRunning == true)
            {
                dispatchTimer.Stop();

                var config = SettingsData.Load();
                measurementInterval    = Convert.ToInt16(config.MeasurementSettingsData.Interval);
                dispatchTimer.Interval = TimeSpan.FromMilliseconds(measurementInterval);

                dispatchTimer.Start();
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var config = SettingsData.Load();

            cmbInterval.Text = config.MeasurementSettingsData.Interval.ToString();
        }