/// <summary> /// Initializes a new instance of the class. Initializes the: communication interface; main window interface; cyclic queues; max/min values and /// read/write locks. /// </summary> /// <param name="communicationInterface">Reference to the communication interface used to communicate with the target hardware.</param> /// <param name="cyclicQueueRecordSize">The required size of the cyclic buffer used to record watch data.</param> /// <param name="cyclicQueueLogSize">The required size of the cyclic buffer used to log watch data.</param> /// <param name="formWatchView">Reference to the form that called this form.</param> public ThreadPollWatch(ICommunicationWatch communicationInterface, int cyclicQueueRecordSize, int cyclicQueueLogSize, FormViewWatch formWatchView) { m_CommunicationInterface = communicationInterface; Debug.Assert(m_CommunicationInterface != null); m_FormViewWatch = formWatchView; Debug.Assert(m_FormViewWatch != null, "ThreadPollWatch.Ctor() - [m_FormViewWatch != null]"); m_CyclicQueueRecord = new CyclicQueue<WatchFrame_t>(cyclicQueueRecordSize); m_CyclicQueueLog = new CyclicQueue<WatchFrame_t>(cyclicQueueLogSize); m_MutexPause = new Mutex(); m_MutexPauseFeedback = new Mutex(); m_MutexCommunicationFault = new Mutex(); m_MutexRecord = new Mutex(); m_MutexAutoScaleWatchValues = new Mutex(); #region - [AutoScale] - m_AutoScaleWatchValues = new AutoScale_t[Parameter.WatchSize]; #endregion - [AutoScale] - m_PacketCount = 0; m_PollScheduler = new PollScheduler(); m_ReadTimeoutCountdown = ReadTimeoutCountdown; }
/// <summary> /// Show the multiple document interface child form which displays and records the watch variables. /// </summary> public void ViewWatchWindow() { MainWindow.CloseChildForms(); MainWindow.Cursor = Cursors.WaitCursor; try { FormViewWatch formViewViewWatch = new FormViewWatch(MainWindow.CommunicationInterface); MainWindow.ShowMdiChild(formViewViewWatch); } catch (Exception exception) { MessageBox.Show(exception.Message, Resources.MBCaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { MainWindow.Cursor = Cursors.Default; } }