/// <summary> /// Clean up the resources used by the user control. /// </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_ClientAsFormPTU = null; #region - [Detach the event handler methods.] - #endregion - [Detach the event handler methods.] - #region - [Component Designer Variables] - #endregion - [Component 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 'Change Value' context menu option <c>Click</c> event. If applicable, shows the form which allows the user to change the value of the /// enumerator watch variable. /// </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_MenuItemChangeValue_Click(object sender, EventArgs e) { // Skip, if the Dispose() method has been called. if (IsDisposed) { return; } FormPTU clientAsFormPTU = ClientForm as FormPTU; if (clientAsFormPTU != null) { try { FormChangeBitmask formChangeBitmask = new FormChangeBitmask(this); formChangeBitmask.CalledFrom = m_ClientForm; formChangeBitmask.ShowDialog(); } catch (Exception exception) { MessageBox.Show(exception.Message, Resources.MBCaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } }
/// <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_ClientAsFormPTU = null; #region - [Detach the event handler methods.] - this.m_LabelNameField.DoubleClick -= new System.EventHandler(this.m_MenuItemShowDefinition_Click); this.m_LabelValueField.DoubleClick -= new System.EventHandler(this.m_LabelValueField_DoubleClick); this.m_MenuItemShowDefinition.Click -= new System.EventHandler(this.m_MenuItemShowDefinition_Click); this.m_MenuItemChangeValue.Click -= new System.EventHandler(this.m_MenuItemChangeValue_Click); #endregion - [Detach the event handler methods.] - } catch (Exception) { // Don't do anything, just ensure that an exception isn't thrown. } finally { base.Cleanup(disposing); } }
/// <summary> /// Initializes a new instance of the form. (1) Positions the form; (2) displays the watch variable and current value; (3) displays the flag state /// corresponding to the current value of the watch variable. /// </summary> /// <param name="bitmaskControl">Reference to the bit mask control that called this form.</param> public FormShowFlags(VariableControl bitmaskControl) { InitializeComponent(); m_VariableControl = bitmaskControl; // Add this form to the list of opened dialog forms associated with the client form. m_ClientAsFormPTU = m_VariableControl.ClientForm as FormPTU; if (m_ClientAsFormPTU != null) { m_ClientAsFormPTU.OpenedDialogBoxList.Add(this); } // Register the event handler for the data update event. m_ClientAsIDataUpdate = m_VariableControl.ClientForm as IDataUpdate; if (m_ClientAsIDataUpdate != null) { m_ClientAsIDataUpdate.DataUpdate += new EventHandler(DataUpdate); } m_OldIdentifier = (short)m_VariableControl.Identifier; try { m_WatchVariable = Lookup.WatchVariableTableByOldIdentifier.Items[m_OldIdentifier]; if (m_WatchVariable == null) { throw new ArgumentException(Resources.MBTWatchVariableNotDefined); } } catch (Exception) { throw new ArgumentException(Resources.MBTWatchVariableNotDefined); } m_WatchVariableName = m_VariableControl.VariableNameFieldText; // Get a list of the current state of each flag and keep a record to determine if there is a change in state. List <FlagState_t> flagStateList = Lookup.WatchVariableTableByOldIdentifier.GetFlagStateList(m_OldIdentifier, m_PreviousValue = GetValue()); m_TableLayoutPanel = ConstructLayoutPanel(); m_PanelFlagList.Controls.Add(m_TableLayoutPanel); ConfigureTableLayoutPanel(m_TableLayoutPanel, flagStateList); UpdateTitle(m_WatchVariableName, GetValue()); UpdateFlagStates(m_TableLayoutPanel.Controls, flagStateList); CheckHeight(); PositionTheForm(m_VariableControl); }
/// <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(); } if (m_ClientAsIDataUpdate != null) { // De-register the event handler for the data update event. m_ClientAsIDataUpdate.DataUpdate -= new EventHandler(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_TableLayoutPanel = null; m_VariableControl = null; m_ClientAsFormPTU = 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); } }