/// <summary>
        /// Event handler for the form <c>Shown</c> event.  Before calling the <c>Shown</c> event handler associated with the parent form, check whether this form was
        /// called from the form used to display the event log and, if so, modify the image and text associated with the escape key as if this is the case, pressing
        /// this key should return the user to the event log form rather than home.
        /// </summary>
        /// <param name="sender">Reference to the object that raised the event.</param>
        /// <param name="e">Parameter passed from the object that raised the event.</param>
        protected override void FormDataStreamPlot_Shown(object sender, EventArgs e)
        {
            FormViewEventLog calledFromAsFormViewEventLog = CalledFrom as FormViewEventLog;

            if (calledFromAsFormViewEventLog != null)
            {
                DisplayFunctionKey(Escape, Resources.FunctionKeyTextEsc, Resources.FunctionKeyToolTipEsc, Resources.Edit_Undo);
            }

            base.FormDataStreamPlot_Shown(sender, e);

            // Hide the 'Remove Selected Plot(s)' context menu option as this is not supported on live fault log data. This feature
            // is only available once the fault log has been saved to disk.

            // Reference to the TableLayoutPanel associated with each TabPage.
            TableLayoutPanel tableLayoutPanel;

            for (int index = 0; index < m_TabControl.TabPages.Count; index++)
            {
                tableLayoutPanel = m_TabControl.TabPages[index].Controls[KeyTableLayoutPanel] as TableLayoutPanel;
                for (int rowIndex = 0; rowIndex < tableLayoutPanel.RowCount; rowIndex++)
                {
                    IPlotterWatch plotterWatch = (tableLayoutPanel.Controls[rowIndex] as IPlotterWatch);
                    plotterWatch.RemoveSelectedPlot.Enabled = false;
                    plotterWatch.RemoveSelectedPlot.Visible = false;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The background worker task. Download the data stream corresponding to the event record specified in the constructor and update the DataSteamCurrent property
        /// of the FormViewEventLog class.
        /// </summary>
        /// <param name="sender">Reference to the object that raised the event.</param>
        /// <param name="e">Parameter passed from the object that raised the event.</param>
        private void m_BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            DataStream_t dataStream;

            try
            {
                dataStream = CommunicationInterface.GetStream(m_EventRecord);
            }
            catch (Exception)
            {
                DialogResult = DialogResult.Abort;
                return;
            }

            // Get the reference to the calling form.
            FormViewEventLog calledFromAsFormViewEventLog = CalledFrom as FormViewEventLog;

            if (calledFromAsFormViewEventLog != null)
            {
                // Update the DataStreamCurrent property of the form.
                calledFromAsFormViewEventLog.DataStreamCurrent = dataStream;
            }
        }
        /// <summary>
        /// Event handler for the form <c>Shown</c> event.  Before calling the <c>Shown</c> event handler associated with the parent form, check whether this form was
        /// called from the form used to display the event log and, if so, modify the image and text associated with the escape key as if this is the case, pressing
        /// this key should return the user to the event log form rather than home.
        /// </summary>
        /// <param name="sender">Reference to the object that raised the event.</param>
        /// <param name="e">Parameter passed from the object that raised the event.</param>
        protected override void FormDataStreamPlot_Shown(object sender, EventArgs e)
        {
            FormViewEventLog calledFromAsFormViewEventLog = CalledFrom as FormViewEventLog;

            if (calledFromAsFormViewEventLog != null)
            {
                DisplayFunctionKey(Escape, Resources.FunctionKeyTextEsc, Resources.FunctionKeyToolTipEsc, Resources.Edit_Undo);
            }

            base.FormDataStreamPlot_Shown(sender, e);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Event handler for the form <c>Shown</c> event.
        /// </summary>
        /// <param name="sender">Reference to the object that raised the event.</param>
        /// <param name="e">Parameter passed from the object that raised the event.</param>
        protected override void FormPTUDialog_Shown(object sender, EventArgs e)
        {
            base.FormPTUDialog_Shown(sender, e);

            // If this Form is called from the 'Configure/Data Stream' menu option then the 'Visible' property of the 'Upload' ToolStripButton should be cleared.
            FormViewEventLog calledFrom = this.CalledFrom as FormViewEventLog;

            if (calledFrom == null)
            {
                // This Form was not called from the FormViewWatch Form i.e. it was called from the 'Configure/Watch Window' menu option.
                m_TSBUpload.Visible = false;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Show the child form which displays the current event logs.
        /// </summary>
        public void ViewEventLog()
        {
            MainWindow.CloseChildForms();
            MainWindow.Cursor = Cursors.WaitCursor;

            // ---------------------------------------------------------------
            // Inform the user of the name of the log that is being retrieved.
            // ---------------------------------------------------------------
            // Retrieve the first valid log from the LogTable as this is the log that will be displayed by the FormViewEventLog class.
            Log log = null;
            for (int recordIndex = 0; recordIndex < Lookup.LogTable.RecordList.Count; recordIndex++)
            {
                // Check that a valid entry exists.
                if (Lookup.LogTable.Items[recordIndex] != null)
                {
                    log = Lookup.LogTable.Items[recordIndex];
                    break;
                }
            }

            MainWindow.WriteStatusMessage(string.Format(Resources.SMEventLogRetrieve, log.Description));
            
            // --------------
            // Show the form.
            // --------------
            try
            {
                FormViewEventLog formEventLog = new FormViewEventLog(MainWindow.CommunicationInterface, MainWindow);
                MainWindow.ShowMdiChild(formEventLog);
            }
            catch (Exception exception)
            {
                MessageBox.Show(Resources.MBTViewEventLogFailed + CommonConstants.NewLine + CommonConstants.NewLine + exception.Message, Resources.MBCaptionError,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            finally
            {
                MainWindow.WriteStatusMessage(string.Empty);
                MainWindow.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 6
0
        /// <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;
        }