/// <summary>
        /// Initialize a new instance of the class.
        /// </summary>
        public FormPlotDefineBitmask(ref ListBox listBox)
        {
            InitializeComponent();

            m_ListBox = listBox;
            if (m_ListBox.SelectedItems.Count != 1)
            {
                throw new Exception(Resources.EMListBoxMultipleSelectionNotSupported);
            }

            m_OldIdentifier = ((WatchItem_t)m_ListBox.SelectedItem).OldIdentifier;
            m_DisplayMask   = ((WatchItem_t)m_ListBox.SelectedItem).DisplayMask;
            try
            {
                m_WatchVariable = Lookup.WatchVariableTableByOldIdentifier.Items[m_OldIdentifier];
                if (m_WatchVariable == null)
                {
                    throw new ArgumentException(Resources.MBTWatchVariableNotDefined);
                }
            }
            catch (Exception)
            {
                throw new ArgumentException(Resources.MBTWatchVariableNotDefined);
            }

            Debug.Assert(m_WatchVariable.VariableType == VariableType.Bitmask, "FormPlotDefineBitmask.Ctor() - [m_WatchVariable.VariableType == VariableType.Bitmask]");

            Text = m_WatchVariable.Name;

            #region - [ICheckBoxUInt32] -
            m_ICheckBoxUInt32 = new CheckBoxUInt32();
            CheckBox[] checkBoxes;
            ConfigureCheckBoxes(out checkBoxes);
            m_ICheckBoxUInt32.CheckBoxes = checkBoxes;
            m_ICheckBoxUInt32.SetText(m_OldIdentifier);
            m_ICheckBoxUInt32.SetChecked((uint)m_DisplayMask);
            #endregion - [ICheckBoxUInt32] -

            m_GroupBoxCurrentValue.Visible = false;
            m_GroupBoxNewValue.Visible     = false;
            m_GroupBoxFormat.Visible       = false;

            // OK, Cancel, Apply
            m_ButtonOK.Location     = m_ButtonCancel.Location;
            m_ButtonCancel.Location = m_ButtonApply.Location;
            m_ButtonApply.Visible   = false;

            // Now that the display has been initialized, disable the apply button. This will only be re-enabled when the user has modified one or more Checked
            // properties.
            m_ButtonApply.Enabled = false;

            // Set the default DialogResult value.
            DialogResult = DialogResult.No;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize a new instance of the class.
        /// </summary>
        public FormPlotDefineBitmask(ref ListBox listBox)
        {
            InitializeComponent();

            m_ListBox = listBox;
            if (m_ListBox.SelectedItems.Count != 1)
            {
                throw new Exception(Resources.EMListBoxMultipleSelectionNotSupported);
            }

            m_OldIdentifier = ((WatchItem_t)m_ListBox.SelectedItem).OldIdentifier;
            m_DisplayMask = ((WatchItem_t)m_ListBox.SelectedItem).DisplayMask;
            try
            {
                m_WatchVariable = Lookup.WatchVariableTableByOldIdentifier.Items[m_OldIdentifier];
                if (m_WatchVariable == null)
                {
                    throw new ArgumentException(Resources.MBTWatchVariableNotDefined);
                }
            }
            catch (Exception)
            {
                throw new ArgumentException(Resources.MBTWatchVariableNotDefined);
            }

            Debug.Assert(m_WatchVariable.VariableType == VariableType.Bitmask, "FormPlotDefineBitmask.Ctor() - [m_WatchVariable.VariableType == VariableType.Bitmask]");

            Text = m_WatchVariable.Name;

            #region - [ICheckBoxUInt32] -
            m_ICheckBoxUInt32 = new CheckBoxUInt32();
            CheckBox[] checkBoxes;
            ConfigureCheckBoxes(out checkBoxes);
            m_ICheckBoxUInt32.CheckBoxes = checkBoxes;
            m_ICheckBoxUInt32.SetText(m_OldIdentifier);
            m_ICheckBoxUInt32.SetChecked((uint)m_DisplayMask);
            #endregion - [ICheckBoxUInt32] -

            m_GroupBoxCurrentValue.Visible = false;
            m_GroupBoxNewValue.Visible = false;
            m_GroupBoxFormat.Visible = false;

            // OK, Cancel, Apply
            m_ButtonOK.Location = m_ButtonCancel.Location;
            m_ButtonCancel.Location = m_ButtonApply.Location;
            m_ButtonApply.Visible = false;

            // Now that the display has been initialized, disable the apply button. This will only be re-enabled when the user has modified one or more Checked 
            // properties.
            m_ButtonApply.Enabled = false;

            // Set the default DialogResult value.
            DialogResult = DialogResult.No;
        }