/// <summary> /// Clean up the resources used by the form. /// </summary> /// <param name="disposing">True to release both managed and unmanaged resources; false to release only unmanaged resources.</param> protected override void Cleanup(bool disposing) { try { if (disposing) { // Cleanup managed objects by calling their Dispose() methods. if (components != null) { components.Dispose(); } if (m_TimerProgressBarUpdate != null) { m_TimerProgressBarUpdate.Stop(); m_TimerProgressBarUpdate.Tick -= new EventHandler(ProgressBarUpdate); m_TimerProgressBarUpdate.Dispose(); } if (m_BackgroundWorker != null) { m_BackgroundWorker.DoWork -= new DoWorkEventHandler(m_BackgroundWorker_DoWork); m_BackgroundWorker.Dispose(); } if (m_EventRecordList != null) { m_EventRecordList.Clear(); } } // Whether called by consumer code or the garbage collector free all unmanaged resources and set the value of managed data members to null. m_TimerProgressBarUpdate = null; m_CommunicationInterface = null; m_EventRecordList = null; m_BackgroundWorker = null; m_Log = null; #region --- Windows Form Designer Variables --- // Detach the event handler delegates. // Set the Windows Form Designer Variables to null. #endregion --- Windows Form Designer Variables --- } catch (Exception) { // Don't do anything, just ensure that an exception isn't thrown. } finally { base.Cleanup(disposing); } }
/// <summary> /// Initializes a new instance of the class. Initializes the communication interface and read/write locks. /// </summary> /// <param name="communicationInterface">Reference to the communication interface used to communicate with the target hardware.</param> /// <param name="formViewEventLog">Reference to the form that called this form.</param> public ThreadPollEvent(ICommunicationEvent communicationInterface, FormViewEventLog formViewEventLog) { CommunicationInterface = communicationInterface; Debug.Assert(m_CommunicationInterface != null, "ThreadPollEvent.Ctor() - [m_CommunicationInterface != null]"); m_FormViewEventLog = formViewEventLog; Debug.Assert(m_FormViewEventLog != null, "ThreadPollEvent.Ctor() - [m_FormViewEventLog != null]"); m_MutexPause = new Mutex(); m_MutexPauseFeedback = new Mutex(); m_MutexCommunicationFault = new Mutex(); m_PacketCount = 0; m_PollScheduler = new PollScheduler(); m_ReadTimeoutCountdown = ReadTimeoutCountdown; }
/// <summary> /// Initializes a new instance of the class. /// </summary> /// <param name="communicationInterface">Reference to the communicaton interface that is to be used to communicate with the VCU</param> /// <param name="eventRecordList">The list of event records associated with the current log.</param> /// <param name="log">The current event log.</param> public FormGetFltHistInfo(ICommunicationEvent communicationInterface, List <EventRecord> eventRecordList, Log log) { InitializeComponent(); CommunicationInterface = communicationInterface; Debug.Assert(CommunicationInterface != null); m_Log = log; Debug.Assert(m_Log != null); m_EventRecordList = eventRecordList; Debug.Assert(m_EventRecordList != null); m_LabelDescription.Text = Resources.TitleEventHistory; #region - [Background Worker] - // Instantiate a BackgroundWorker and attach handlers to its DoWork and RunWorkerCompleted events. m_BackgroundWorker = new BackgroundWorker(); m_BackgroundWorker.DoWork += new DoWorkEventHandler(m_BackgroundWorker_DoWork); //m_BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(m_BackgroundWorker_RunWorkerCompleted); #endregion - [Background Worker] - #region - [ProgressBar Timer] - m_TimerProgressBarUpdate = new System.Windows.Forms.Timer(); m_TimerProgressBarUpdate.Tick += new EventHandler(ProgressBarUpdate); m_TimerProgressBarUpdate.Interval = IntervalDisplayUpdateMs; m_TimerProgressBarUpdate.Enabled = true; m_TimerProgressBarUpdate.Stop(); #endregion - [ProgressBar Timer] - #region - [Progress Bar] - int updatesPerSec = (int)(CommonConstants.SecondMs / IntervalDisplayUpdateMs); int downloadDurationSec = (int)(m_EventRecordList.Count / RecordsPerSec); m_ProgressBarDownload.Maximum = downloadDurationSec * updatesPerSec; m_ProgressBarDownload.Minimum = 0; m_ProgressBarDownload.Value = 0; #endregion - [Progress Bar] - }
/// <summary> /// Clean up the resources used by the form. /// </summary> /// <param name="disposing">True to release both managed and unmanaged resources; false to release only unmanaged resources.</param> protected override void Cleanup(bool disposing) { try { if (disposing) { // Cleanup managed objects by calling their Dispose() methods. if (components != null) { components.Dispose(); } if (m_TimerProgressBarUpdate != null) { m_TimerProgressBarUpdate.Stop(); m_TimerProgressBarUpdate.Dispose(); } if (m_BackgroundWorker != null) { m_BackgroundWorker.Dispose(); } } // Whether called by consumer code or the garbage collector free all unmanaged resources and set the value of managed data members to null. m_TimerProgressBarUpdate = null; m_CommunicationInterface = null; m_EventRecord = null; m_BackgroundWorker = null; #region --- Windows Form Designer Variables --- // Detach the event handler delegates. // Set the Windows Form Designer Variables to null. #endregion --- Windows Form Designer Variables --- } catch (Exception) { // Don't do anything, just ensure that an exception isn't thrown. } finally { base.Cleanup(disposing); } }
/// <summary> /// Initializes a new instance of the class. /// </summary> /// <param name="communicationInterface">Reference to the communicaton interface that is to be used to communicate with the VCU</param> /// <param name="eventRecord">The event record associated with the data stream.</param> public FormGetStream(ICommunicationEvent communicationInterface, EventRecord eventRecord) { InitializeComponent(); CommunicationInterface = communicationInterface; Debug.Assert(CommunicationInterface != null); m_EventRecord = eventRecord; m_LabelDataStreamName.Text = string.Format("{0} {1} - {2}", m_EventRecord.Description, m_EventRecord.DateTime.ToShortDateString(), m_EventRecord.DateTime.ToString("HH:mm:ss")); #region - [Background Worker] - // Instantiate BackgroundWorker and attach handlers to its DoWork and RunWorkerCompleted events. m_BackgroundWorker = new BackgroundWorker(); m_BackgroundWorker.DoWork += new DoWorkEventHandler(m_BackgroundWorker_DoWork); //m_BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(m_BackgroundWorker_RunWorkerCompleted); #endregion - [Background Worker] - #region - [ProgressBar Timer] - m_TimerProgressBarUpdate = new System.Windows.Forms.Timer(); m_TimerProgressBarUpdate.Tick += new EventHandler(ProgressBarUpdate); m_TimerProgressBarUpdate.Interval = IntervalMsDisplayUpdate; m_TimerProgressBarUpdate.Enabled = true; m_TimerProgressBarUpdate.Stop(); #endregion - [ProgressBar Timer] - #region - [Progress Bar] - short dataStreamTypeIdentifier; try { dataStreamTypeIdentifier = Lookup.LogTable.Items[m_EventRecord.LogIdentifier].DataStreamTypeIdentifier; } catch (Exception) { dataStreamTypeIdentifier = 0; } int updatesPerSec = (int)(CommonConstants.SecondMs / IntervalMsDisplayUpdate); switch (dataStreamTypeIdentifier) { case DataStreamTypeStandardFaultLog: m_ProgressBarDownload.Maximum = DurationSecDownloadStandardFaultLog * updatesPerSec; m_TimeoutMsThreadComplete = (int)(DurationSecDownloadStandardFaultLog * TimeoutFactor); break; case DataStreamTypeFaultLogCTA: m_ProgressBarDownload.Maximum = DurationSecDownloadFaultLogCTA * updatesPerSec; m_TimeoutMsThreadComplete = (int)(DurationSecDownloadFaultLogCTA * TimeoutFactor); break; case DataStreamTypeSnapshotLog: m_ProgressBarDownload.Maximum = DurationSecDownloadSnapshotLog * updatesPerSec; m_TimeoutMsThreadComplete = (int)(DurationSecDownloadSnapshotLog * TimeoutFactor); break; default: m_ProgressBarDownload.Maximum = DurationSecDownloadStandardFaultLog * updatesPerSec; m_TimeoutMsThreadComplete = (int)(DurationSecDownloadStandardFaultLog * TimeoutFactor); break; } m_ProgressBarDownload.Minimum = 0; m_ProgressBarDownload.Value = 0; #endregion - [Progress Bar] - }
/// <summary> /// Initializes a new instance of the class. /// </summary> /// <param name="communicationInterface">Reference to the communicaton interface that is to be used to communicate with the VCU</param> /// <param name="eventRecordList">The list of event records associated with the current log.</param> /// <param name="log">The current event log.</param> public FormGetFltHistInfo(ICommunicationEvent communicationInterface, List<EventRecord> eventRecordList, Log log) { InitializeComponent(); CommunicationInterface = communicationInterface; Debug.Assert(CommunicationInterface != null); m_Log = log; Debug.Assert(m_Log != null); m_EventRecordList = eventRecordList; Debug.Assert(m_EventRecordList != null); m_LabelDescription.Text = Resources.TitleEventHistory; #region - [Background Worker] - // Instantiate a BackgroundWorker and attach handlers to its DoWork and RunWorkerCompleted events. m_BackgroundWorker = new BackgroundWorker(); m_BackgroundWorker.DoWork += new DoWorkEventHandler(m_BackgroundWorker_DoWork); //m_BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(m_BackgroundWorker_RunWorkerCompleted); #endregion - [Background Worker] - #region - [ProgressBar Timer] - m_TimerProgressBarUpdate = new System.Windows.Forms.Timer(); m_TimerProgressBarUpdate.Tick += new EventHandler(ProgressBarUpdate); m_TimerProgressBarUpdate.Interval = IntervalDisplayUpdateMs; m_TimerProgressBarUpdate.Enabled = true; m_TimerProgressBarUpdate.Stop(); #endregion - [ProgressBar Timer] - #region - [Progress Bar] - int updatesPerSec = (int)(CommonConstants.SecondMs / IntervalDisplayUpdateMs); int downloadDurationSec = (int)(m_EventRecordList.Count / RecordsPerSec); m_ProgressBarDownload.Maximum = downloadDurationSec * updatesPerSec; m_ProgressBarDownload.Minimum = 0; m_ProgressBarDownload.Value = 0; #endregion - [Progress Bar] - }