/// <summary>
        /// Initializes a new instance of the class. 
        /// </summary>
        /// <param name="communicationInterface">The communication interface that is to be used to communicate with the VCU.</param>
        /// <param name="log">The current event log.</param>
        public FormShowEventHistory(ICommunicationParent communicationInterface, Log log)
        {
            InitializeComponent();

            // Initialize the communication interface.
            if (communicationInterface is CommunicationParent)
            {
                CommunicationInterface = new CommunicationEvent(communicationInterface);
            }
            else
            {
                CommunicationInterface = new CommunicationEventOffline(communicationInterface);
            }
            Debug.Assert(CommunicationInterface != null);

            #region - [Size] -
            m_DataGridViewTextColumnEnableEvent.Visible = false;
            m_DataGridViewTextColumnStreamTriggered.Visible = false;
            m_DataGridViewTextColumnCumulativeHistory.Visible = true;
            m_DataGridViewTextColumnRecentHistory.Visible = true;

            // Get the combined width of all visible DataGridView columns.
            int dataGridViewWidth = 0;
            DataGridViewColumn dataGridViewColumn;
            for (int columnIndex = 0; columnIndex < m_DataGridViewEventStatus.Columns.Count; columnIndex++)
            {
                dataGridViewColumn = m_DataGridViewEventStatus.Columns[columnIndex];
                if (dataGridViewColumn.Visible == true)
                {
                    dataGridViewWidth += dataGridViewColumn.Width;
                }
            }

            m_PanelDataGridViewEventStatus.Width = dataGridViewWidth + MarginRightDataGridViewControl;

            Width = m_PanelDataGridViewEventStatus.Width + MarginRightPanelControl;
            #endregion - [Size] -

            #region - [Buttons] -
            // Only the OK button is required for this form, move the position of the OK button so that it hides the cancel button.
            m_ButtonCancel.Visible = false;
            m_ButtonOK.Location = m_ButtonCancel.Location;
            #endregion - [Buttons] -

            #region - [Context Menu] -
            // Disable those context menu options that are not applicable to this form.
            m_ContextMenuStripFlags.Items[ContextMenuItemIndexEnabled].Visible = false;
            m_ContextMenuStripFlags.Items[ContextMenuItemIndexStreamTriggered].Visible = false;
            #endregion - [Context Menu] -

            // ------------------------------------------------------------------
            // Get the list of events associated with the current event log.
            // ------------------------------------------------------------------
            List<EventRecord> foundEventRecordList = Lookup.EventTable.RecordList.FindAll(delegate(EventRecord eventRecord)
            {
                // Include a try/catch block in case an event record has not been defined.
                try
                {
                    // The LOGID field of the EVENTS table actually uses the log index value which is equal to the log identifier - 1.
                    return (eventRecord.LogIdentifier == log.Identifier - 1);
                }
                catch (Exception)
                {
                    return false;
                }
            });

            foundEventRecordList.Sort(CompareByTaskIDByEventIDAscending);

            try
            {
                FormGetFltHistInfo formGetFltHistInfo = new FormGetFltHistInfo(CommunicationInterface, foundEventRecordList, log);
                formGetFltHistInfo.CalledFrom = this;
                formGetFltHistInfo.ShowDialog();
            }
            catch (Exception)
            {
                throw new CommunicationException(Resources.EMGetFltHistInfoFailed);
            }

            AddList(EventStatusList);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="communicationInterface">The communication interface that is to be used to communicate with the VCU.</param>
        /// <param name="log">The current event log.</param>
        public FormShowEventHistory(ICommunicationParent communicationInterface, Log log)
        {
            InitializeComponent();

            // Initialize the communication interface.
            if (communicationInterface is CommunicationParent)
            {
                CommunicationInterface = new CommunicationEvent(communicationInterface);
            }
            else
            {
                CommunicationInterface = new CommunicationEventOffline(communicationInterface);
            }
            Debug.Assert(CommunicationInterface != null);

            #region - [Size] -
            m_DataGridViewTextColumnEnableEvent.Visible       = false;
            m_DataGridViewTextColumnStreamTriggered.Visible   = false;
            m_DataGridViewTextColumnCumulativeHistory.Visible = true;
            m_DataGridViewTextColumnRecentHistory.Visible     = true;

            // Get the combined width of all visible DataGridView columns.
            int dataGridViewWidth = 0;
            DataGridViewColumn dataGridViewColumn;
            for (int columnIndex = 0; columnIndex < m_DataGridViewEventStatus.Columns.Count; columnIndex++)
            {
                dataGridViewColumn = m_DataGridViewEventStatus.Columns[columnIndex];
                if (dataGridViewColumn.Visible == true)
                {
                    dataGridViewWidth += dataGridViewColumn.Width;
                }
            }

            m_PanelDataGridViewEventStatus.Width = dataGridViewWidth + MarginRightDataGridViewControl;

            Width = m_PanelDataGridViewEventStatus.Width + MarginRightPanelControl;
            #endregion - [Size] -

            #region - [Buttons] -
            // Only the OK button is required for this form, move the position of the OK button so that it hides the cancel button.
            m_ButtonCancel.Visible = false;
            m_ButtonOK.Location    = m_ButtonCancel.Location;
            #endregion - [Buttons] -

            #region - [Context Menu] -
            // Disable those context menu options that are not applicable to this form.
            m_ContextMenuStripFlags.Items[ContextMenuItemIndexEnabled].Visible         = false;
            m_ContextMenuStripFlags.Items[ContextMenuItemIndexStreamTriggered].Visible = false;
            #endregion - [Context Menu] -

            // ------------------------------------------------------------------
            // Get the list of events associated with the current event log.
            // ------------------------------------------------------------------
            List <EventRecord> foundEventRecordList = Lookup.EventTable.RecordList.FindAll(delegate(EventRecord eventRecord)
            {
                // Include a try/catch block in case an event record has not been defined.
                try
                {
                    // The LOGID field of the EVENTS table actually uses the log index value which is equal to the log identifier - 1.
                    return(eventRecord.LogIdentifier == log.Identifier - 1);
                }
                catch (Exception)
                {
                    return(false);
                }
            });

            foundEventRecordList.Sort(CompareByTaskIDByEventIDAscending);

            try
            {
                FormGetFltHistInfo formGetFltHistInfo = new FormGetFltHistInfo(CommunicationInterface, foundEventRecordList, log);
                formGetFltHistInfo.CalledFrom = this;
                formGetFltHistInfo.ShowDialog();
            }
            catch (Exception)
            {
                throw new CommunicationException(Resources.EMGetFltHistInfoFailed);
            }

            AddList(EventStatusList);
        }