TimeSpan tspnMaxQueueEmptyingDuration; //=TimeSpan(default); // perform actions needed when we start monitoring battery parameters public bool bOnStartMonitoring() { bool bResult = false; Debug.WriteLine("++Form1::bOnStartMonitoring()"); m_lSerPortErrCnt = 0; m_slMeasIterCnt = 0; // do not clear the chart - let it stay // CurrentVoltageChart.Series.Clear(); vResetVoltCurrNFilters(); // if stopped, change name to Stop StartStopButton.Text = "Stop"; // disable entry to serial port SerPortNameTextBox.Enabled = false; bIsRunning = true; // assign radio button selections LiveDataRadioButton1.Checked = true; FromFileRadioButton1.Checked = false; LiveDataRadioButton1.Enabled = false; FromFileRadioButton1.Enabled = false; // start worker thread to communicate with our form, which will talk to microcontroller device // Create the thread object. This does not start the thread. workerObject = new Ser_Port_Listener(this, m_cBattMonSettings.strCOMPortName); // check results in bSerPortOkay workerThread = new Thread(workerObject.DoWork); // Start the worker thread manually workerThread.Start(); // will enter workerThread.DoWork() function // Loop until worker thread activates. while (false == workerThread.IsAlive) { Debug.WriteLine("Form1::bOnStartMonitoring() waiting for serial port worker thread to speed up..."); } ; // let worker thread connect to serial port , give it a little bit of time System.Threading.Thread.Sleep(150); if (true == workerObject.bSerPortOkay) { m_DataFastRefreshTimer.Start(); m_UIRefreshTimer.Start(); tspnMaxQueueEmptyingDuration = new TimeSpan(0, 0, 0, ((80 * m_UIRefreshTimer.Interval) / 100)); } ; this.Text = "Battery Monitor - Live data from " + SerPortNameTextBox.Text; Debug.WriteLine("--Form1::bOnStartMonitoring()=" + bResult.ToString()); return(bResult); } // end of bOnStartMonitoring()
TimeSpan tspnMaxQueueEmptyingDuration; //=TimeSpan(default); #endregion Fields #region Methods // perform actions needed when we start monitoring battery parameters public bool bOnStartMonitoring() { bool bResult=false; Debug.WriteLine("++Form1::bOnStartMonitoring()"); m_lSerPortErrCnt=0; m_slMeasIterCnt=0; // do not clear the chart - let it stay // CurrentVoltageChart.Series.Clear(); vResetVoltCurrNFilters(); // if stopped, change name to Stop StartStopButton.Text="Stop"; // disable entry to serial port SerPortNameTextBox.Enabled=false; bIsRunning=true; // assign radio button selections LiveDataRadioButton1.Checked=true; FromFileRadioButton1.Checked=false; LiveDataRadioButton1.Enabled=false; FromFileRadioButton1.Enabled=false; // start worker thread to communicate with our form, which will talk to microcontroller device // Create the thread object. This does not start the thread. workerObject = new Ser_Port_Listener(this, m_cBattMonSettings.strCOMPortName); // check results in bSerPortOkay workerThread = new Thread(workerObject.DoWork); // Start the worker thread manually workerThread.Start(); // will enter workerThread.DoWork() function // Loop until worker thread activates. while(false==workerThread.IsAlive) { Debug.WriteLine("Form1::bOnStartMonitoring() waiting for serial port worker thread to speed up..."); }; // let worker thread connect to serial port , give it a little bit of time System.Threading.Thread.Sleep(150); if(true==workerObject.bSerPortOkay) { m_DataFastRefreshTimer.Start(); m_UIRefreshTimer.Start(); tspnMaxQueueEmptyingDuration=new TimeSpan(0,0,0, ((80 * m_UIRefreshTimer.Interval)/100) ); }; this.Text="Battery Monitor - Live data from " + SerPortNameTextBox.Text; Debug.WriteLine("--Form1::bOnStartMonitoring()="+bResult.ToString()); return bResult; }