/// <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()); }
/// <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); } }
/// <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()); }
/// <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; }
/// <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()); }