public SamplingConfig(ViewModel viewModel)
        {
            string[] portNames;

            InitializeComponent();

            this.viewModel = viewModel;
            portNames = SerialPort.GetPortNames();
            if (portNames != null)
            {
                foreach (string p in portNames)
                    serialPortName.Items.Add(p);
            }

            for (int i = 8; i >= 1; i--)
                this.channels.Items.Add(i);

            foreach (string r in rates)
                this.samplingRate.Items.Add(r);
        }
示例#2
0
        /// <summary>
        /// Form Load event handler.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            // Create our viewModel
            viewModel = new ViewModel();

            // Show the default settings.
            this.activeChannels.Text = Convert.ToString(viewModel.Settings.SamplingChannels);
            this.samplingRate.Text = Convert.ToString(viewModel.Settings.SamplingRate);

            customLaDisplayControl1.SetSamplingRate(viewModel.Settings.SamplingRate);

            // Wire-up the mouse-over event so we can tell when to change the channel and time.
            customLaDisplayControl1.OnMouseOver += customLaDisplayControl1_OnMouseOver;

            // Wire-up the event handlers for status, progress, errors, and plots.
            viewModel.OnStatusMessage += viewModel_StatusMessage;
            viewModel.OnProgress += viewModel_Progress;
            viewModel.OnPlot += viewModel_Plot;
            viewModel.OnError += viewModel_Error;

            // This will attempt to open the controller.
            viewModel.Open();
        }