/// <summary> /// Event handler for the <c>Click</c> event associated with the 'Configure Bitmask Plot' context menu option. Show the form that allows the user to define /// which bits of the selected bitmask watch variable are to be plotted. /// </summary> /// <remarks>This menu option is only relevant to the child form used to configure the plot layout.</remarks> /// <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_MenuItemConfigureBitmaskPlot_Click(object sender, EventArgs e) { // Skip, if the Dispose() method has been called. if (IsDisposed) { return; } if (m_ListBoxSelected.SelectedItems.Count == 1) { int oldIdentifier = ((WatchItem_t)m_ListBoxSelected.SelectedItem).OldIdentifier; // Get the watch variable associated with the selected item. WatchVariable watchVariable; try { watchVariable = Lookup.WatchVariableTableByOldIdentifier.Items[oldIdentifier]; if (watchVariable != null) { // Check whether the selected watch variable is a bitmask. if (watchVariable.IsBitMask == true) { try { // Yes - Show the form that allows the user to configure the plot. FormPlotDefineBitmask formPlotDefineBitmask = new FormPlotDefineBitmask(ref m_ListBoxes[m_TabControlColumn.SelectedIndex]); // The CalledFrom property is used to allow the called form to reference back to this form. formPlotDefineBitmask.CalledFrom = this; DialogResult dialogResult = formPlotDefineBitmask.ShowDialog(); // Check whether the bitmask value has been modified. if (dialogResult == DialogResult.Yes) { EnableApplyAndOKButtons(); OnDataUpdate(this, new EventArgs()); } } catch (Exception exception) { MessageBox.Show(exception.Message, Resources.MBCaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show(Resources.MBTBitmaskOnly, Resources.MBCaptionWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception) { // Ensure that an exception is not thrown. } } else if (m_ListBoxSelected.SelectedItems.Count > 1) { MessageBox.Show(Resources.MBTWorksetDefineMultipleSelection, Resources.MBCaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Event handler for the <c>Click</c> event associated with the 'Configure Bitmask Plot' context menu option. Show the form that allows the user to define /// which bits of the selected bitmask watch variable are to be plotted. /// </summary> /// <remarks>This menu option is only relevant to the child form used to configure the plot layout.</remarks> /// <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_MenuItemConfigureBitmaskPlot_Click(object sender, EventArgs e) { // Skip, if the Dispose() method has been called. if (IsDisposed) { return; } if (m_ListBoxSelected.SelectedItems.Count == 1) { int oldIdentifier = ((WatchItem_t)m_ListBoxSelected.SelectedItem).OldIdentifier; // Get the watch variable associated with the selected item. WatchVariable watchVariable; try { watchVariable = Lookup.WatchVariableTableByOldIdentifier.Items[oldIdentifier]; if (watchVariable != null) { // Check whether the selected watch variable is a bitmask. if (watchVariable.IsBitMask == true) { try { // Yes - Show the form that allows the user to configure the plot. FormPlotDefineBitmask formPlotDefineBitmask = new FormPlotDefineBitmask(ref m_ListBoxes[m_TabControlColumn.SelectedIndex]); // The CalledFrom property is used to allow the called form to reference back to this form. formPlotDefineBitmask.CalledFrom = this; DialogResult dialogResult = formPlotDefineBitmask.ShowDialog(); // Check whether the bitmask value has been modified. if (dialogResult == DialogResult.Yes) { EnableApplyAndOKButtons(); OnDataUpdate(this, new EventArgs()); } } catch (Exception exception) { MessageBox.Show(exception.Message, Resources.MBCaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show(Resources.MBTBitmaskOnly, Resources.MBCaptionWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception) { // Ensure that an exception is not thrown. } } else if (m_ListBoxSelected.SelectedItems.Count > 1) { MessageBox.Show(Resources.MBTWorksetDefineMultipleSelection, Resources.MBCaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Information); } }