/// <summary>
        /// Initializes an new instance of the form. This constructor is used when a new workset is being created. Populates the 'Available' 
        /// <c>ListBox</c> controls with the appropriate watch variables.
        /// </summary>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        public FormWorksetDefineChartRecorderBackup(WorksetCollection worksetCollection)
            : base(worksetCollection)
        {
            InitializeComponent();

            // Only one column is required fot this workset so delete the tab pages associated with columns 2 and 3.
            m_TabControlWorkset.TabPages.Remove(m_TabPageColumn2);
            m_TabControlWorkset.TabPages.Remove(m_TabPageColumn3);

            // Initialize the column header text boxes, use the default values.
            m_TextBoxHeader1.Text = m_WorksetCollection.Worksets[0].Column[0].HeaderText;

            // ----------------------------
            // OK, Cancel and Apply buttons.
            // ----------------------------
            // Hide the Apply button in this mode and move the position of the OK and Cancel buttons.
            m_ButtonApply.Visible = false;
            m_ButtonOK.Location = m_ButtonCancel.Location;
            m_ButtonCancel.Location = m_ButtonApply.Location;

            // Enable the context menu that allows the user to configure the chart scaling.
            m_MenuItemChangeChartScaleFactor.Visible = true;

            m_ListBox1RowHeader.Items.Clear();
            m_ListBox1RowHeader.Items.AddRange(new object[] {
            " 1",
            " 2",
            " 3",
            " 4",
            " 5",
            " 6",
            " 7",
            " 8"});
        }
        /// <summary>
        /// Initializes a new instance of the class. Records the securty level of the user and enables/disables the 'Set as Default' context menu option accordingly.
        /// </summary>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        public FormWorksetManagerWatch(WorksetCollection worksetCollection) : base(worksetCollection)
        {
            InitializeComponent();

            // Display the default workset column.
            m_ColumnHeaderWorsetName.ImageIndex = ImageIndexBookmark;
        }
        /// <summary>
        /// Initializes an new instance of the form. This constructor is used when a new workset is being created. Populates the 'Available' 
        /// <c>ListBox</c> controls with the appropriate watch variables.
        /// </summary>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        public FormWorksetDefineWatch(WorksetCollection worksetCollection)
            : base(worksetCollection)
        {
            InitializeComponent();

            // Initialize the column header text boxes, use the default values.
            m_TextBoxHeader1.Text = m_WorksetCollection.Worksets[0].Column[0].HeaderText;
            m_TextBoxHeader2.Text = m_WorksetCollection.Worksets[0].Column[1].HeaderText;
            m_TextBoxHeader3.Text = m_WorksetCollection.Worksets[0].Column[2].HeaderText;
        }
        /// <summary>
        /// Initializes a new instance of the class. Records the securty level of the user and enables/disables the 'Set as Default' context menu option accordingly.
        /// </summary>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        public FormWorksetManagerFaultLog(WorksetCollection worksetCollection)
            : base(worksetCollection)
        {
            InitializeComponent();

            // Don't display the 'Set as Default' menu option for this form.
            m_ContextMenuItemSetAsDefault.Visible = false;

            // The default workset concept is not applicable to chart recorder worksets.
            m_ListView.SmallImageList = null;
        }
示例#5
0
        /// <summary>
        /// Initializes an new instance of the form.
        /// </summary>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        public FormConfigure(WorksetCollection worksetCollection)
            : base(worksetCollection)
        {
            InitializeComponent();

            // Only one column is required for this workset so delete the tab pages associated with columns 2 and 3.
            m_TabControlColumn.TabPages.Remove(m_TabPageColumn2);
            m_TabControlColumn.TabPages.Remove(m_TabPageColumn3);

            ComboBoxAddWorksets(m_ComboBoxWorkset, m_WorksetCollection);

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

            // Workset Selection.
            m_LegendName.Text = Resources.LegendWorkset;
            m_TextBoxName.Visible = false;

            ClearStatusMessage();
        }
示例#6
0
        /// <summary>
        /// Add the worksets contained within the specified workset collection to the <c>Items</c> property of the specified <c>ComboBox</c> control.
        /// </summary>
        /// <param name="comboBox">The <c>ComboBox</c> control that it to be processed.</param>
        /// <param name="worksetCollection">The workset collection containing the worksets that are to be added.</param>
        private void ComboBoxAddWorksets(ComboBox comboBox, WorksetCollection worksetCollection)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            Debug.Assert(worksetCollection != null, "FormConfigure.ComboBoxAddWorksets() - [worksetCollection != null]");
            Debug.Assert(comboBox != null, "FormConfigure.ComboBoxAddWorksets() - [comboBox != null]");

            comboBox.Items.Clear();

            // Get the list of available worksets, the first entry should be the active workset. An entry should not be created for the baseline workset unless
            // it is defined as the active workset.
            for (int itemIndex = 0, worksetIndex = worksetCollection.ActiveIndex; itemIndex < worksetCollection.Worksets.Count; itemIndex++)
            {
                if (worksetCollection.ActiveIndex != 0)
                {
                    // Baseline workset is NOT the active workset, therefore don't create an entry for it.
                    if (worksetIndex == 0)
                    {
                        worksetIndex++;
                        worksetIndex %= worksetCollection.Worksets.Count;
                        continue;
                    }
                }

                comboBox.Items.Add(worksetCollection.Worksets[worksetIndex++]);

                // Add the remaining worksets, using a round-robin approach.
                worksetIndex %= worksetCollection.Worksets.Count;
            }
        }
        /// <summary>
        /// <para>
        /// Initializes an new instance of the form for use when EDITing a workset. Populates the 'Configuration' ListBoxes with the data associated with the 
        /// specified configuration and populates the 'Available' ListBoxes with the remaining data i.e. the difference between the configuration and the default data.
        /// </para>
        /// <para>
        /// If the <paramref name="applyVisible"/> parameter is set to true the form will include an apply button so that the user can update the workset without closing
        /// the form between updates. This is especially useful when modifying the active workset while the workset is on display.
        /// </para>
        /// </summary>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        /// <param name="workset">The workset that is to be edited.</param>
        /// <param name="applyVisible">Flag to specify whether the Apply button is to be visible; True, displays the Apply button, false, hides the Apply button.</param>
        public FormWorksetDefineChartRecorderBackup(WorksetCollection worksetCollection, Workset_t workset, bool applyVisible)
            : base(worksetCollection, workset, applyVisible)
        {
            InitializeComponent();

            // Only one column is required fot this workset so delete the tab pages associated with columns 2 and 3.
            m_TabControlWorkset.TabPages.Remove(m_TabPageColumn2);
            m_TabControlWorkset.TabPages.Remove(m_TabPageColumn3);

            // Initialize the column header text boxes, use the default values.
            m_TextBoxHeader1.Text = workset.Column[0].HeaderText;

            // ------------------------------------
            // Update the ListBox controls.
            // -------------------------------------
            WatchItemAddRange(workset.Column[0]);
            UpdateCount();

            // --------------------------
            // OK, Cancel and Apply buttons.
            // ----------------------------
            if (applyVisible == false)
            {
                // Hide the Apply button and move the position of the OK and Cancel buttons.
                m_ButtonApply.Visible = false;
                m_ButtonOK.Location = m_ButtonCancel.Location;
                m_ButtonCancel.Location = m_ButtonApply.Location;
            }
            else
            {
                // Display the Apply button.
                m_ButtonApply.Visible = true;

                // Disable the Apply button until the user modifies the workset.
                m_ButtonApply.Enabled = false;
            }

            // Enable the context menu that allows the user to configure the chart scaling.
            m_MenuItemChangeChartScaleFactor.Visible = true;
        }
示例#8
0
        /// <summary> 
        /// Load the specified workset collection file from disk and then set the active workset to be the default workset. If the workset collection 
        /// file does not exist or is corrupt, then an empty workset collection file is created.
        /// </summary>
        /// <remarks>
        /// The workset collection filename is derived as follows: {project identifier}.{workset collection type}.{extension} and it is assumed that it is located in 
        /// the 'DirectoryManager.PathwWorksetFiles' directory.
        /// </remarks>
        /// <param name="worksetCollection">The workset collection that is to be loaded from disk.</param>
        /// <param name="projectIdentifier">The project identifier used to generate the workset filename.</param>
        private void LoadWorksetCollection(WorksetCollection worksetCollection, string projectIdentifier)
        {
            Debug.Assert(projectIdentifier != string.Empty, "MdiPTU.Support.LoadWorkset - [projectIdentifier != string.Empty]");
            Debug.Assert(worksetCollection != null, "MdiPTU.Support.LoadWorkset - [worksetCollection != null]");

            // Keep a record of the base parameters so that a new workset collection can be re-generated if the attempt to load the workset collection from disk fails.
            WorksetCollectionType worksetCollectionType = worksetCollection.WorksetCollectionType;
            short entryCountMax = worksetCollection.EntryCountMax;
            short columnCountMax = worksetCollection.ColumnCountMax;

            // ----------------------------------------------------------------------------------
            // Attempt to load the workset file associated with the specified project identifier.
            // ----------------------------------------------------------------------------------
            string qualifier = "." + worksetCollection.WorksetCollectionType.ToString();

            // Generate the name of the file containing the serialized workset information i.e. [ProjectID].set.
            string filename = projectIdentifier + qualifier + CommonConstants.ExtensionWorksetFile;

            // Generate the fully qualified file name of the file containing the serialized data.
            string fullFilename = DirectoryManager.PathWorksetFiles + CommonConstants.BindingFilename + filename;

            try
            {
                //Deserialize the specified workset collection file.
                worksetCollection.Load(fullFilename);
            }
            catch (SerializationException serializationException)
            {
                worksetCollection.Initialize(worksetCollectionType, entryCountMax, columnCountMax);
                throw new SerializationException(serializationException.Message);
            }
            catch (FileNotFoundException fileNotFoundException)
            {
                worksetCollection.Initialize(worksetCollectionType, entryCountMax, columnCountMax);
                throw new FileNotFoundException(fileNotFoundException.Message);
            }
            catch (UnauthorizedAccessException unauthorizedAccessException)
            {
                worksetCollection.Initialize(worksetCollectionType, entryCountMax, columnCountMax);
                throw new UnauthorizedAccessException(unauthorizedAccessException.Message);
            }

            // Ensure that the default workset is selected.
            worksetCollection.Reset();
        }
        /// <summary>
        /// Initializes a new instance of the class. Records the securty level of the user and enables/disables the 'Set as Default' context menu option accordingly.
        /// </summary>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        public FormWorksetManager(WorksetCollection worksetCollection)
        {
            InitializeComponent();

            m_WorksetCollection = worksetCollection;

            Debug.Assert(Security != null);

            // Check that the user has sufficient privileges to modify the default setting account.
            if (Security.SecurityLevelCurrent >= Security.SecurityLevelHighest)
            {
                m_ContextMenuItemSetAsDefault.Enabled = true;
                m_ContextMenuItemOverrideSecurity.Enabled = true;
            }
            else
            {
                m_ContextMenuItemSetAsDefault.Enabled = false;
                m_ContextMenuItemOverrideSecurity.Enabled = false;
            }
        }
示例#10
0
        /// <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();
                    }

                    m_WorksetCollection = null;
                }

                // Whether called by consumer code or the garbage collector free all unmanaged resources and set the value of managed data members to 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);
            }
        }
示例#11
0
 /// <summary>
 /// Initializes the static instances of the workset collection classes corresponding to each sub-system.
 /// </summary>
 public static void Initialize()
 {
     m_WorksetCollectionRecordedWatch = new WorksetCollection(WorksetCollectionType.RecordedWatch, Parameter.WatchSize, ColumnCountMaxRecordedWatch);
     m_WorksetCollectionFaultLog = new WorksetCollection(WorksetCollectionType.FaultLog, Parameter.WatchSizeFaultLog, ColumnCountMaxFaultLog);
     m_WorksetCollectionChartRecorder = new WorksetCollection(WorksetCollectionType.Chart, Parameter.WatchSizeChartRecorder, ColumnCountMaxChartRecorder);
 }
        /// <summary>
        /// <para>
        /// Initializes an new instance of the form for use when EDITing a workset. Populates the 'Configuration' ListBoxes with the data associated with the 
        /// specified configuration and populates the 'Available' ListBoxes with the remaining data i.e. the difference between the configuration and the default data.
        /// </para>
        /// <para>
        /// If the <paramref name="applyVisible"/> parameter is set to true the form will include an apply button so that the user can update the workset without closing
        /// the form between updates. This is especially useful when modifying the active workset while the workset is on display.
        /// </para>
        /// </summary>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        /// <param name="workset">The workset that is to be edited.</param>
        /// <param name="applyVisible">Flag to specify whether the Apply button is to be visible; True, displays the Apply button, false, hides the Apply button.</param>
        public FormWorksetDefineFaultLog(WorksetCollection worksetCollection, Workset_t workset, bool applyVisible)
            : base(worksetCollection, workset, applyVisible)
        {
            InitializeComponent();

            // Check whether the 'Row Header' ListBox can be used to display the channel numbers. This is only possible if
            // the project doesn't support multiple data stream types and the number of parameters supported by the data
            // stream can be displayed on the TabPage without the need for scroll bars i.e. <= WatchSizeFaultLogMax.
            if ((Parameter.SupportsMultipleDataStreamTypes == false) && (Parameter.WatchSizeFaultLog <= WatchSizeFaultLogMax))
            {
                AddRowHeader();
            }
            else
            {
                NoRowHeader();
            }

            // Only one column is required fot this workset so delete the tab pages associated with columns 2 and 3.
            m_TabControlColumn.TabPages.Remove(m_TabPageColumn2);
            m_TabControlColumn.TabPages.Remove(m_TabPageColumn3);

            // Initialize the column header text boxes, use the default values.
            m_TextBoxHeader1.Text = workset.Column[0].HeaderText;

            // ------------------------------------
            // Update the 'Column' ListBox control.
            // -------------------------------------
            WatchItemAddRange(m_ListBox1, workset.Column[0]);
            UpdateCount();

            UpdateSampleMultiple(workset.SampleMultiple);
        }
        /// <summary>
        /// <para>
        /// Initializes an new instance of the form for use when EDITing a workset. Populates the 'Configuration' ListBoxes with the data associated with the 
        /// specified configuration and populates the 'Available' ListBoxes with the remaining data i.e. the difference between the configuration and the default data.
        /// </para>
        /// <para>
        /// If the <paramref name="applyVisible"/> parameter is set to true the form will include an apply button so that the user can update the workset without closing
        /// the form between updates. This is especially useful when modifying the active workset while the workset is on display.
        /// </para>
        /// </summary>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        /// <param name="workset">The workset that is to be edited.</param>
        /// <param name="applyVisible">Flag to specify whether the Apply button is to be visible; True, displays the Apply button, false, hides the Apply button.</param>
        public FormWorksetDefineWatch(WorksetCollection worksetCollection, Workset_t workset, bool applyVisible)
            : base(worksetCollection, workset, applyVisible)
        {
            InitializeComponent();

            // Initialize the column header text boxes, use the default values.
            m_TextBoxHeader1.Text = workset.Column[0].HeaderText;
            m_TextBoxHeader2.Text = workset.Column[1].HeaderText;
            m_TextBoxHeader3.Text = workset.Column[2].HeaderText;

            // ------------------------------------
            // Update the 'Column' ListBox controls.
            // -------------------------------------
            WatchItemAddRange(m_ListBox1, workset.Column[0]);
            WatchItemAddRange(m_ListBox2, workset.Column[1]);
            WatchItemAddRange(m_ListBox3, workset.Column[2]);

            UpdateCount();
        }
示例#14
0
        /// <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_ListBoxSelected != null)
                    {
                        m_ListBoxSelected.ClearSelected();
                        m_ListBox1.Dispose();
                    }

                    if (m_AddedWatchVariables != null)
                    {
                        m_AddedWatchVariables.Clear();
                    }

                    if (m_RemovedWatchVariables != null)
                    {
                        m_RemovedWatchVariables.Clear();
                    }
                }

                // Whether called by consumer code or the garbage collector free all unmanaged resources and set the value of managed data members to null.
                m_ListBoxSelected = null;
                m_WatchItems = null;
                m_WorksetCollection = null;
                m_AddedWatchVariables = null;
                m_RemovedWatchVariables = null;

                #region --- Windows Form Designer Variables ---
                // Detach the event handler delegates.
                this.m_MenuItemShowDefinitionAll.Click -= new System.EventHandler(this.m_MenuItemShowDefinitionAll_Click);
                this.m_ContextMenuColumns.Opened -= new System.EventHandler(this.m_ContextMenuColumns_Opened);
                this.m_MenuItemShowDefinition.Click -= new System.EventHandler(this.m_MenuItemShowDefinitionColumn_Click);
                this.m_MenuItemChangeChartScaleFactor.Click -= new System.EventHandler(this.m_MenuItemChangeChartScaleFactor_Click);
                this.m_MenuItemConfigureBitmaskPlot.Click -= new System.EventHandler(this.m_MenuItemConfigureBitmaskPlot_Click);
                this.m_ButtonCancel.Click -= new System.EventHandler(this.m_ButtonCancel_Click);
                this.m_TextBoxName.TextChanged -= new System.EventHandler(this.m_TextBoxName_TextChanged);
                this.m_TabControlColumn.SelectedIndexChanged -= new System.EventHandler(this.m_TabControlColumns_SelectedIndexChanged);
                this.m_TextBoxHeader1.KeyPress -= new System.Windows.Forms.KeyPressEventHandler(this.TextBoxColumnHeader_KeyPress);
                this.m_ListBox1.DragDrop -= new System.Windows.Forms.DragEventHandler(this.m_ListBoxTarget_DragDrop);
                this.m_ListBox1.DragEnter -= new System.Windows.Forms.DragEventHandler(this.m_ListBoxTarget_DragEnter);
                this.m_TextBoxHeader2.KeyPress -= new System.Windows.Forms.KeyPressEventHandler(this.TextBoxColumnHeader_KeyPress);
                this.m_ListBox2.DragDrop -= new System.Windows.Forms.DragEventHandler(this.m_ListBoxTarget_DragDrop);
                this.m_ListBox2.DragEnter -= new System.Windows.Forms.DragEventHandler(this.m_ListBoxTarget_DragEnter);
                this.m_TextBoxHeader3.KeyPress -= new System.Windows.Forms.KeyPressEventHandler(this.TextBoxColumnHeader_KeyPress);
                this.m_ListBox3.DragDrop -= new System.Windows.Forms.DragEventHandler(this.m_ListBoxTarget_DragDrop);
                this.m_ListBox3.DragEnter -= new System.Windows.Forms.DragEventHandler(this.m_ListBoxTarget_DragEnter);
                this.m_ButtonMoveUp.Click -= new System.EventHandler(this.m_ButtonMoveUp_Click);
                this.m_ButtonMoveDown.Click -= new System.EventHandler(this.m_ButtonMoveDown_Click);
                this.m_ButtonRemove.Click -= new System.EventHandler(this.m_ButtonRemove_Click);
                this.m_ButtonClear.Click -= new System.EventHandler(this.m_ButtonClear_Click);
                this.m_TextBoxSearch.TextChanged -= new System.EventHandler(this.m_TxtSearch_TextChanged);
                this.m_ListBoxAvailable.DoubleClick -= new System.EventHandler(this.m_ButtonAdd_Click);
                this.m_ListBoxAvailable.MouseDown -= new System.Windows.Forms.MouseEventHandler(this.m_ListBoxSource_MouseDown);
                this.m_ListBoxAvailable.MouseMove -= new System.Windows.Forms.MouseEventHandler(this.m_ListBoxSource_MouseMove);
                this.m_ListBoxAvailable.MouseUp -= new System.Windows.Forms.MouseEventHandler(this.m_ListBoxSource_MouseUp);
                this.m_ButtonAdd.Click -= new System.EventHandler(this.m_ButtonAdd_Click);
                this.m_ButtonApply.Click -= new System.EventHandler(this.m_ButtonApply_Click);
                this.m_ButtonOK.Click -= new System.EventHandler(this.m_ButtonOK_Click);
                this.KeyDown -= new System.Windows.Forms.KeyEventHandler(this.FormWorksetDefine_KeyDown);


                // 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);
            }
        }
示例#15
0
        /// <summary>
        /// <para>
        /// Initializes an new instance of the form for use when EDITing a workset. Populates the 'Configuration' ListBoxes with the data associated with the 
        /// specified configuration and populates the 'Available' ListBoxes with the remaining data i.e. the difference between the configuration and the default data.
        /// </para>
        /// <para>
        /// If the <paramref name="applyVisible"/> parameter is set to true the form will include an apply button so that the user can update the workset without closing
        /// the form between updates. This is especially useful when modifying the active workset while the workset is on display.
        /// </para>
        /// </summary>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        /// <param name="workset">The workset that is to be edited.</param>
        /// <param name="applyVisible">Flag to specify whether the Apply button is to be visible; True, displays the Apply button, false, hides the Apply button.</param>
        public FormWorksetDefine(WorksetCollection worksetCollection, Workset_t workset, bool applyVisible)
        {
            InitializeComponent();

            m_WorksetCollection = worksetCollection;
            m_EntryCountMax = m_WorksetCollection.EntryCountMax;

            // Set the flag to indicate that the form has been called in order to edit a new workset.
            m_CreateMode = false;

            // Ensure that the TextChanged event is not triggered as a result of specifying the Text property of the TextBox control.
            m_TextBoxName.TextChanged -= new EventHandler(m_TextBoxName_TextChanged);
            m_TextBoxName.Text = workset.Name;
            m_TextBoxName.TextChanged += new EventHandler(m_TextBoxName_TextChanged);
            
            m_TextBoxName.Enabled = false;

            // Update the security description to reflect the security level of the selected workset.
            m_TextBoxSecurityLevel.Text = Security.GetSecurityDescription(workset.SecurityLevel);
            
            m_ListItemCount = workset.Count;
            m_WatchItems = workset.WatchItems;

            UpdateListBoxAvailable(m_WatchItems);

            // Update the m_ListBoxSelected reference to point at the ListBox control associated with the default TabPage.
            m_ListBoxSelected = m_ListBox1;

            // --------------------------
            // OK, Cancel and Apply buttons.
            // ----------------------------
            if (applyVisible == false)
            {
                // Hide the Apply button and move the position of the OK and Cancel buttons.
                m_ButtonApply.Visible = false;
                m_ButtonOK.Location = m_ButtonCancel.Location;
                m_ButtonCancel.Location = m_ButtonApply.Location;
            }
            else
            {
                // Display the Apply button.
                m_ButtonApply.Visible = true;
            }

            // Check whether the watch variable count is within the permitted limits.
            if (m_ListItemCount > EntryCountMax)
            {
                // Disable the Apply and OK buttons and show the specified error message.
                DisableApplyAndOKButtons(Resources.MBTWorksetWatchSizeExceeded);
            }
            else
            {
                // Don't enable the OK and Apply buttons until the workset has been modified.
                DisableApplyAndOKButtons(string.Empty);
            }
        }
示例#16
0
        /// <summary>
        /// Initializes an new instance of the form. This constructor is used when a new workset is being created. Populates the 'Available' 
        /// <c>ListBox</c> controls with the appropriate watch variables.
        /// </summary>
        /// <param name="worksetCollection">The workset collection that is to be managed.</param>
        public FormWorksetDefine(WorksetCollection worksetCollection)
        {
            InitializeComponent();

            m_WorksetCollection = worksetCollection;
            m_EntryCountMax = m_WorksetCollection.EntryCountMax;

            // Set the flag to indicate that the form has been called in order to add a new workset.
            m_CreateMode = true;

            // Use the default new name for the workset.
            m_DefaultNewWorksetName = Resources.NameNewWorksetDefault;

            // Ensure that the TextChanged event is not triggered as a result of specifying the Text property of the TextBox control.
            m_TextBoxName.TextChanged -= new EventHandler(m_TextBoxName_TextChanged);
            m_TextBoxName.Text = m_DefaultNewWorksetName;
            m_TextBoxName.TextChanged += new EventHandler(m_TextBoxName_TextChanged);

            // Update the security description to reflect the current security level.
            m_TextBoxSecurityLevel.Text = Security.Description;
            
            // ---------
            // WatchItem
            // ---------
            // Populate the array defining which watch variables have been added to the workset.
            m_WatchItems = new WatchItem_t[Lookup.WatchVariableTableByOldIdentifier.RecordList.Count];
            WatchItem_t watchItem;
            WatchVariable watchVariable;
            for (short oldIdentifier = 0; oldIdentifier < Lookup.WatchVariableTableByOldIdentifier.RecordList.Count; oldIdentifier++)
            {
                watchItem = new WatchItem_t();
                watchItem.OldIdentifier = oldIdentifier;
                watchItem.Added = false;

                try
                {
                    watchVariable = Lookup.WatchVariableTableByOldIdentifier.Items[oldIdentifier];

                    if (watchVariable == null)
                    {
                        watchItem.Exists = false;
                    }
                    else
                    {
                        watchItem.Exists = true;
                    }
                }
                catch(Exception)
                {
                    watchItem.Exists = false;
                }

                m_WatchItems[oldIdentifier] = watchItem;
            }

            UpdateListBoxAvailable(m_WatchItems);
            UpdateCount();

            // Update the m_ListBoxSelected reference to point at the ListBox control associated with the default TabPage.
            m_ListBoxSelected = m_ListBox1;
            
            // ----------------------------
            // OK, Cancel and Apply buttons.
            // ----------------------------
            // Hide the Apply button in this mode and move the position of the OK and Cancel buttons.
            m_ButtonApply.Visible = false;
            m_ButtonOK.Location = m_ButtonCancel.Location;
            m_ButtonCancel.Location = m_ButtonApply.Location;

            EnableApplyAndOKButtons();
        }