/// <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(); } } // Whether called by consumer code or the garbage collector free all unmanaged resources and set the value of managed data members to null. m_WatchVariable = null; m_IChartScale = null; m_CalledFromAsFormConfigureChartRecorder = 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 Apply button <c>Click</c> event. Update the ListBox controls in the calling form with the modified limits. /// </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_ButtonApply_Click(object sender, EventArgs e) { // Skip, if the Dispose() method has been called. if (IsDisposed) { return; } try { if (m_HexFormat == true) { m_IChartScale.ListBoxChartScaleLowerLimit.Items[m_SelectedIndex] = CommonConstants.HexValueIdentifier + ((uint)m_ChartScaleLowerLimit).ToString(CommonConstants.FormatStringHex); m_IChartScale.ListBoxChartScaleUpperLimit.Items[m_SelectedIndex] = CommonConstants.HexValueIdentifier + ((uint)m_ChartScaleUpperLimit).ToString(CommonConstants.FormatStringHex); } else { m_IChartScale.ListBoxChartScaleLowerLimit.Items[m_SelectedIndex] = m_ChartScaleLowerLimit.ToString(CommonConstants.FormatStringNumeric); m_IChartScale.ListBoxChartScaleUpperLimit.Items[m_SelectedIndex] = m_ChartScaleUpperLimit.ToString(CommonConstants.FormatStringNumeric); } m_ButtonApply.Enabled = true; } catch (Exception) { MessageBox.Show(Resources.MBTModifyLimitFailed, Resources.MBCaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error); m_ButtonApply.Enabled = true; return; } // Check whether the form was called from the form used to configure the chart recorder and, if so, get the reference to it. m_CalledFromAsFormConfigureChartRecorder = CalledFrom as FormConfigureChartRecorder; if (m_CalledFromAsFormConfigureChartRecorder != null) { // Assert the Save ToolStripButton control. m_CalledFromAsFormConfigureChartRecorder.TSBSave.Enabled = true; } return; }
/// <summary> /// Show the form which allows the user the configure the chart recorder. /// </summary> public void ConfigureChartRecorder() { MainWindow.Cursor = Cursors.WaitCursor; // The PTU must be in on-line mode in order to configure the chart recorder. Debug.Assert(MainWindow.CommunicationInterface != null, "MenuInterfaceWatch.ConfigureChartRecorder() - [MainWindow.CommunicationInterface != null]"); try { FormConfigureChartRecorder formConfigureChartRecorder = new FormConfigureChartRecorder(MainWindow.CommunicationInterface, MainWindow, Workset.ChartRecorder); MainWindow.ShowDialog(formConfigureChartRecorder); } catch (Exception exception) { MessageBox.Show(exception.Message, Resources.MBCaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { MainWindow.Cursor = Cursors.Default; } }