Exemple #1
0
        /// <summary>
        /// Event handler for the <c>DataUpdate</c> event raised by the FormWorksetDefine class. This event is raised if the current test list is modified.
        /// </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 void FormWorksetDefine_DataUpdate(object sender, EventArgs e)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            // Check whether the current test list is one of the pre-defined test lists.
            if (m_TestListRecord.Identifier != short.MaxValue)
            {
                // Yes,  change the Text property of the ComboBox control to reflect that the user has changed the tests associated with the current pre defined
                // test list, however, leave the currently defined tests as they are.

                // Detach and then re-attach the 'SelectedIndexChanged' event handler to ensure that the event handler is not called when the Text property is modified.
                m_ComboBoxTestList.SelectedIndexChanged -= new System.EventHandler(m_ComboBoxTestList_SelectedIndexChanged);
                m_ComboBoxTestList.Text = m_UserDefinedTestListRecord.Description;
                m_ComboBoxTestList.SelectedIndexChanged += new System.EventHandler(m_ComboBoxTestList_SelectedIndexChanged);

                // Copy the fields of the user defined TestListRecord to the active test list record.
                m_TestListRecord = m_UserDefinedTestListRecord;

                // Display the name of the test list in the TabPage header.
                m_TabPageColumn1.Text = m_UserDefinedTestListRecord.Description;
            }

            // Keep the SelfTestRecordList properties of the TestListRecords up to date.
            m_UserDefinedTestListRecord.SelfTestRecordList = ConvertToSelfTestRecordList(m_ListBox1);
            m_TestListRecord.SelfTestRecordList            = ConvertToSelfTestRecordList(m_ListBox1);

            WinHlp32.HideHelpWindow(Handle.ToInt32());
        }
Exemple #2
0
        /// <summary>
        /// Event handler for the 'Show Definition' context menu. Show the help information associated with the 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>
        private void m_MenuItemShowDefinition_Click(object sender, EventArgs e)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            Cursor = Cursors.WaitCursor;

            EventStatus_t   eventStatus;
            DataGridViewRow dataGridViewRow;

            if (GetEventStatusElement(out eventStatus, out dataGridViewRow) == true)
            {
                // Get the help index associated with the event index.
                int helpIndex;
                try
                {
                    helpIndex = Lookup.EventTable.RecordList[eventStatus.Identifier].HelpIndex;
                }
                catch (Exception)
                {
                    helpIndex = CommonConstants.NotDefined;
                }

                if (helpIndex != CommonConstants.NotDefined)
                {
                    WinHlp32.ShowPopup(this.Handle.ToInt32(), helpIndex);
                }
            }

            Cursor = Cursors.Default;
        }
Exemple #3
0
        /// <summary>
        /// Show the watch variable definition using the Windows help pop-up.
        /// </summary>
        protected void ShowHelpPopup()
        {
            // Skip if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            // Get the help index associated with the watch variable.
            int helpIndex;

            try
            {
                helpIndex = Lookup.WatchVariableTableByOldIdentifier.Items[Identifier].HelpIndex;
            }
            catch (Exception)
            {
                helpIndex = CommonConstants.NotFound;
            }

            // If the help index exists, show the help topic associated with the index.
            if (helpIndex != CommonConstants.NotFound)
            {
                WinHlp32.ShowPopup(this.Handle.ToInt32(), helpIndex);
            }
        }
Exemple #4
0
        /// <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
            {
                // Close the help window if one is open.
                WinHlp32.HideHelpWindow(Handle.ToInt32());

                if (disposing)
                {
                    // Cleanup managed objects by calling their Dispose() methods.
                    if (components != null)
                    {
                        components.Dispose();
                    }

                    // Detach the event handlers.
                    TabPage tabPage;
                    ListBox listBox;
                    for (int tabPageIndex = 0; tabPageIndex < m_TabControlAvailable.TabPages.Count; tabPageIndex++)
                    {
                        tabPage = m_TabControlAvailable.TabPages[tabPageIndex];
                        listBox = (ListBox)tabPage.Controls[KeyListBoxAvailable + tabPage.Tag.ToString()];
                        listBox.SelectedIndexChanged -= new EventHandler(this.ListBoxAvailable_SelectedIndexChanged);
                        listBox.DoubleClick          -= new System.EventHandler(this.m_ButtonAdd_Click);
                        listBox.MouseDown            -= new System.Windows.Forms.MouseEventHandler(this.m_ListBoxSource_MouseDown);
                        listBox.MouseMove            -= new System.Windows.Forms.MouseEventHandler(this.m_ListBoxSource_MouseMove);
                        listBox.MouseUp -= new System.Windows.Forms.MouseEventHandler(this.m_ListBoxSource_MouseUp);
                        listBox.Items.Clear();
                    }
                    m_TabControlAvailable.TabPages.Clear();

                    // De-register the event handler for the DataUpdate event.
                    DataUpdate -= new EventHandler(FormWorksetDefine_DataUpdate);
                }

                // Whether called by consumer code or the garbage collector free all unmanaged resources and set the value of managed data members to null.
                m_TestItems                 = null;
                m_TestListRecord            = null;
                m_UserDefinedTestListRecord = 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);
            }
        }
Exemple #5
0
        /// <summary>
        /// Event handler for the 'Available' <c>TabControl</c> <c>SelectedIndexChanged</c> event. Activate the <c>ListBox</c> control associated with the
        /// selected tab page.
        /// </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_TabControlAvailable_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            TabPage tabPage = m_TabControlAvailable.TabPages[m_TabControlAvailable.SelectedIndex];

            m_ListBoxAvailable = (ListBox)tabPage.Controls[KeyListBoxAvailable + tabPage.Tag.ToString()];
            WinHlp32.HideHelpWindow(Handle.ToInt32());
        }
Exemple #6
0
        /// <summary>
        /// Show the event variable definition using the Windows help pop-up.
        /// </summary>
        protected void ShowHelpPopup()
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            // Get the help index associated with the event variable.
            int helpIndex = Lookup.SelfTestVariableTable.Items[Identifier].HelpIndex;

            // If the help index exists, show the help topic associated with the index.
            if (helpIndex != CommonConstants.NotFound)
            {
                WinHlp32.ShowPopup(this.Handle.ToInt32(), helpIndex);
            }
        }
Exemple #7
0
        /// <summary>
        /// Event handler for the <c>Click</c> event associated with the 'Show Definition' context menu option attached to the <c>ListBox</c> containing the available
        /// self tests.
        /// </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 m_MenuItemShowDefinitionAll_Click(object sender, EventArgs e)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            if (m_ListBoxAvailable.SelectedItems.Count == 1)
            {
                int selfTestIdentifier = ((TestItem_t)m_ListBoxAvailable.SelectedItem).SelfTestIdentifier;

                // Get the help index associated with the selected test.
                SelfTestRecord selfTestRecord;
                try
                {
                    selfTestRecord = Lookup.SelfTestTable.Items[selfTestIdentifier];
                    if (selfTestRecord != null)
                    {
                        int helpIndex = selfTestRecord.HelpIndex;

                        // If the help index exists, show the help topic associated with the index.
                        if (helpIndex != CommonConstants.NotFound)
                        {
                            WinHlp32.ShowHelpWindow(m_PanelHelpWindowAvailable.Handle.ToInt32(), helpIndex, WinHlp32.HWND_TOP);
                        }
                    }
                }
                catch (Exception)
                {
                    // Ensure that an exception is not thrown.
                }
            }
            else if (m_ListBoxAvailable.SelectedItems.Count > 1)
            {
                MessageBox.Show(Resources.MBTWorksetDefineMultipleSelection, Resources.MBCaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #8
0
        /// <summary>
        /// Event handler for the <c>SelectedIndexChanged</c> event associated with the <c>ComboBox</c> control used to select one of the pre-defined test lists.
        /// </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_ComboBoxTestList_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            Cursor = Cursors.WaitCursor;

            TestListRecord testListRecord = (TestListRecord)m_ComboBoxTestList.SelectedItem;

            m_TestListRecord = testListRecord;

            // Display the name of the selected test list in the TabPage header.
            m_TabPageColumn1.Text = m_TestListRecord.Description;

            LoadTestList(m_TestListRecord);

            // If the help window is open then hide it.
            WinHlp32.HideHelpWindow(Handle.ToInt32());
            Cursor = Cursors.Default;
        }
Exemple #9
0
 /// <summary>
 /// Event handler for the <c>SelectedIndexChanged</c> event associated with the <c>ListBox</c> controls that display the list of available tests.
 /// Close the help window.
 /// </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 ListBoxAvailable_SelectedIndexChanged(object sender, EventArgs e)
 {
     WinHlp32.HideHelpWindow(Handle.ToInt32());
 }