/// <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> /// 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); } }
/// <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> /// <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> /// 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; }
/// <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(); }
/// <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; } }
/// <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 FormWorksetDefineChartRecorder(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_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 ListBox controls. // ------------------------------------- WatchItemAddRange(m_ListBox1, 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; }
/// <summary> /// Initializes an new instance of the form. Retrieve the chart recorder configuration from the VCU. /// </summary> /// <remarks>The reference to the main application window is also derived from the CalledFrom parameter, however, this is not obtained until after the form /// has been shown. As a number of multiple document interface child forms (mdi child) may be polling the VCU when this form is instantiated, the /// call to the PauseCommunication() method must be made before the chart configuration data can be retrieved from the VCU from within the constructor code. /// A requirement of the PauseCommunication() method is that the reference to the main application window must be defined. /// </remarks> /// <param name="communicationInterface">Reference to the communication interface that is to be used to communicate with the VCU.</param> /// <param name="mainWindow">Reference to the main application window, this is required for the call to the PauseCommunication() method in the constructor /// code.</param> /// <param name="worksetCollection">The workset collection associated with the chart recorder.</param> public FormConfigureChartRecorder(ICommunicationParent communicationInterface, IMainWindow mainWindow, WorksetCollection worksetCollection) : base(worksetCollection) { InitializeComponent(); // Move the position of the Cancel buttons. m_ButtonCancel.Location = m_ButtonApply.Location; // Initialize the communication interface. if (communicationInterface is CommunicationParent) { CommunicationInterface = new CommunicationWatch(communicationInterface); } else { CommunicationInterface = new CommunicationWatchOffline(communicationInterface); } Debug.Assert(CommunicationInterface != null); m_MainWindow = mainWindow; PauseCommunication <ICommunicationWatch>(CommunicationInterface, true); // Show the context menu that allows the user to configure the chart scaling, however, disable it until the form is in edit mode. m_MenuItemChangeChartScaleFactor.Visible = true; m_MenuItemChangeChartScaleFactor.Enabled = false; // Don't allow the user to edit the workset until the security level of the workset has been established. ModifyEnabled = false; m_CreateMode = false; // Set the structure containing the workset that was downloaded from the VCU to be an empty workset. m_WorksetFromVCU = new Workset_t(); // Get the default chart recorder workset. Workset_t workset = worksetCollection.Worksets[worksetCollection.DefaultIndex]; // Keep a record of the selected workset. This must be set up before the call to SetEnabledEditNewCopyRename(). m_SelectedWorkset = workset; SetEnabledEditNewCopyRename(true); // Display the name of the default workset on the ComboBox control. // Ensure that the SelectionChanged event is not triggered as a result of specifying the Text property of the ComboBox control. m_ComboBoxWorkset.SelectedIndexChanged -= new EventHandler(m_ComboBoxWorkset_SelectedIndexChanged); m_ComboBoxWorkset.Text = workset.Name; m_ComboBoxWorkset.SelectedIndexChanged += new EventHandler(m_ComboBoxWorkset_SelectedIndexChanged); LoadWorkset(workset); // Allow the user to download the workset. m_TSBDownload.Enabled = true; }
/// <summary> /// Initializes an new instance of the form. Retrieve the chart recorder configuration from the VCU. /// </summary> /// <remarks>The reference to the main application window is also derived from the CalledFrom parameter, however, this is not obtained until after the form /// has been shown. As a number of multiple document interface child forms (mdi child) may be polling the VCU when this form is instantiated, the /// call to the PauseCommunication() method must be made before the chart configuration data can be retrieved from the VCU from within the constructor code. /// A requirement of the PauseCommunication() method is that the reference to the main application window must be defined. /// </remarks> /// <param name="communicationInterface">Reference to the communication interface that is to be used to communicate with the VCU.</param> /// <param name="mainWindow">Reference to the main application window, this is required for the call to the PauseCommunication() method in the constructor /// code.</param> /// <param name="worksetCollection">The workset collection associated with the chart recorder.</param> public FormConfigureWatchWindow(ICommunicationParent communicationInterface, IMainWindow mainWindow, WorksetCollection worksetCollection) : base(worksetCollection) { InitializeComponent(); Debug.Assert(mainWindow != null, "FormConfigureWatchWindow.Ctor() - [mainWindow != null]"); m_MainWindow = mainWindow; // Move the position of the Cancel buttons. m_ButtonCancel.Location = m_ButtonApply.Location; NoRowHeader(); // Check the mode of the PTU. if (communicationInterface == null) { CommunicationInterface = null; } else if (communicationInterface is CommunicationParent) { // The PTU is in online mode. CommunicationInterface = new CommunicationWatch(communicationInterface); PauseCommunication <ICommunicationWatch>(CommunicationInterface, true); } else { // The PTU is in simulation mode (originally referred to as offline mode). CommunicationInterface = new CommunicationWatchOffline(communicationInterface); PauseCommunication <ICommunicationWatch>(CommunicationInterface, true); } #region - [ToolTipText] - m_ToolStrip.Items[CommonConstants.KeyToolStripButtonUpload].ToolTipText = Resources.FunctionKeyToolTipChartRecorderUpload; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonSave].ToolTipText = Resources.FunctionKeyToolTipChartRecorderSave; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonEdit].ToolTipText = Resources.FunctionKeyToolTipChartRecorderConfigure; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonNew].ToolTipText = Resources.FunctionKeyToolTipChartRecorderCreate; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonCopy].ToolTipText = Resources.FunctionKeyToolTipChartRecorderCopy; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonRename].ToolTipText = Resources.FunctionKeyToolTipChartRecorderRename; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonDelete].ToolTipText = Resources.FunctionKeyToolTipChartRecorderDelete; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonSetAsDefault].ToolTipText = Resources.FunctionKeyToolTipChartRecorderSetAsDefault; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonOverrideSecurity].ToolTipText = Resources.FunctionKeyToolTipChartRecorderOverrideSecurity; #endregion - [ToolTipText] - // Don't allow the user to edit the workset until the security level of the workset has been established. ModifyEnabled = false; m_CreateMode = false; // Set the structure containing the workset that was downloaded from the VCU to be an empty workset. m_WorksetFromVCU = new Workset_t(); }
/// <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. this.m_ContextMenu.Opened -= new System.EventHandler(this.m_ContextMenu_Opened); this.m_ContextMenuItemEdit.Click -= new System.EventHandler(this.m_ContextMenuItemEdit_Click); this.m_ContextMenuItemNew.Click -= new System.EventHandler(this.m_ContextMenuItemNew_Click); this.m_ContextMenuItemCopy.Click -= new System.EventHandler(this.m_ContextMenuItemCopy_Click); this.m_ContextMenuItemDelete.Click -= new System.EventHandler(this.m_ContextMenuItemDelete_Click); this.m_ContextMenuItemRename.Click -= new System.EventHandler(this.m_ContextMenuItemRename_Click); this.m_ContextMenuItemSetAsDefault.Click -= new System.EventHandler(this.m_ContextMenuItemSetAsDefault_Click); this.m_ContextMenuItemOverrideSecurity.Click -= new System.EventHandler(this.m_ContextMenuItemOverrideSecurity_Click); this.m_ButtonOK.Click -= new System.EventHandler(this.m_ButtonOK_Click); this.m_ListView.AfterLabelEdit -= new System.Windows.Forms.LabelEditEventHandler(this.m_ListView_AfterLabelEdit); this.m_ListView.DoubleClick -= new System.EventHandler(this.m_ListView_DoubleClick); this.Activated -= new System.EventHandler(this.FormIODisplay_Activated); // Set the Windows Form Designer Variables to null. m_ContextMenu = null; m_ContextMenuItemEdit = null; m_ContextMenuItemNew = null; m_ContextMenuItemCopy = null; m_ContextMenuItemDelete = null; m_ContextMenuItemSetAsDefault = null; m_ContextMenuItemOverrideSecurity = null; m_ColumnHeaderWorsetName = null; m_ColumnHeaderSecurityLevel = null; m_TextBoxNotes = null; m_ImageList = null; m_SeparatorNew = null; m_SeparatorCopy = null; m_SeparatorRename = null; m_PanelOuter = null; m_GroupBoxNotes = null; m_ButtonOK = 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> /// 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> /// Initializes an new instance of the form. Defines the communication interface and then downloads the current default data stream parameters and displays these /// on the form. /// </summary> /// <param name="communicationInterface">Reference to the communication interface that is to be used to communicate with the VCU.</param> /// <param name="worksetCollection">The workset collection that is to be managed.</param> /// <param name="log">The selected event log.</param> public FormConfigureFaultLogParameters(ICommunicationParent communicationInterface, WorksetCollection worksetCollection, Log log) : base(worksetCollection) { InitializeComponent(); // Move the position of the Cancel buttons. m_ButtonCancel.Location = m_ButtonApply.Location; // Initialize the communication interface. if (communicationInterface is CommunicationParent) { CommunicationInterface = new CommunicationEvent(communicationInterface); } else { CommunicationInterface = new CommunicationEventOffline(communicationInterface); } Debug.Assert(CommunicationInterface != null); // Don't allow the user to edit the workset until the security level of the workset has been established. ModifyEnabled = false; m_NumericUpDownSampleMultiple.Enabled = ModifyEnabled; // ---------------------------------------------------- // Get the current data stream parameters from the VCU. // ---------------------------------------------------- short variableCount, pointCount, sampleMultiple; short[] watchIdentifiers, dataTypes; try { CommunicationInterface.GetDefaultStreamInformation(out variableCount, out pointCount, out sampleMultiple, out watchIdentifiers, out dataTypes); } catch (Exception) { MessageBox.Show(Resources.MBTGetDefaultStreamParametersFailed, Resources.MBCaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Convert the parameters to a workset. Workset_t workset = CommunicationInterface.ConvertToWorkset("GetDefaultStreamInformation()", watchIdentifiers, sampleMultiple); // Search the list of worksets for a match. m_WorksetFromVCU = workset; m_WorksetToCompare = workset; Workset_t matchedWorkset = Workset.FaultLog.Worksets.Find(CompareWorkset); // Check whether a match was found. if (matchedWorkset.WatchItems == null) { // No - Create a new workset. workset.Name = DefaultNewWorksetName; // Set the flag to indicate that the workset does not exist and that any changes will be saved as a new workset. m_CreateMode = true; m_ComboBoxWorkset.DropDownStyle = ComboBoxStyle.DropDown; // 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 = true; } else { // Yes - Update the name and security level of the workset. workset = matchedWorkset; // Set the flag to indicate that the form already exists and any changes will result in the existing workset being modified. m_CreateMode = false; m_ComboBoxWorkset.DropDownStyle = ComboBoxStyle.DropDownList; // 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; } // Keep a record of the selected workset. This must be set up before the call to SetEnabledEditNewCopyRename(). m_SelectedWorkset = workset; SetEnabledEditNewCopyRename(true); // Display the name of the default workset on the ComboBox control. // Ensure that the SelectionChanged event is not triggered as a result of specifying the Text property of the ComboBox control. m_ComboBoxWorkset.SelectedIndexChanged -= new EventHandler(m_ComboBoxWorkset_SelectedIndexChanged); m_ComboBoxWorkset.Text = workset.Name; m_ComboBoxWorkset.SelectedIndexChanged += new EventHandler(m_ComboBoxWorkset_SelectedIndexChanged); LoadWorkset(workset); // Update the EntryCountMax property to reflect the actual number of watch variables associated with the current event log. m_EntryCountMax = log.DataStreamTypeParameters.WatchVariablesMax; UpdateCount(); // 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(); } // Disable all options other than save if the downloaded workset doesn't exist. if (m_CreateMode == true) { SetEnabledEditNewCopyRename(false); } // Allow the user to save the workset if it doesn't already exist. m_TSBSave.Enabled = (m_CreateMode == true) ? true : false; }
/// <summary> /// Initializes an new instance of the form. Defines the communication interface and then downloads the current default data stream parameters and displays these /// on the form. /// </summary> /// <param name="communicationInterface">Reference to the communication interface that is to be used to communicate with the VCU.</param> /// <param name="worksetCollection">The workset collection that is to be managed.</param> /// <param name="log">The selected event log.</param> public FormConfigureFaultLogParameters(ICommunicationParent communicationInterface, WorksetCollection worksetCollection, Log log) : 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); // Move the position of the Cancel buttons. m_ButtonCancel.Location = m_ButtonApply.Location; // Check the mode of the PTU. if (communicationInterface == null) { CommunicationInterface = null; } else if (communicationInterface is CommunicationParent) { // The PTU is in online mode. CommunicationInterface = new CommunicationEvent(communicationInterface); } else { // The PTU is in simulation mode (originally referred to as offline mode). CommunicationInterface = new CommunicationEventOffline(communicationInterface); } // Don't allow the user to edit the workset until the security level of the workset has been established. ModifyEnabled = false; m_NumericUpDownSampleMultiple.Enabled = ModifyEnabled; #region - [ToolTipText] - m_ToolStrip.Items[CommonConstants.KeyToolStripButtonUpload].ToolTipText = Resources.FunctionKeyToolTipDataStreamUpload; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonSave].ToolTipText = Resources.FunctionKeyToolTipDataStreamSave; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonEdit].ToolTipText = Resources.FunctionKeyToolTipDataStreamConfigure; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonNew].ToolTipText = Resources.FunctionKeyToolTipDataStreamCreate; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonCopy].ToolTipText = Resources.FunctionKeyToolTipDataStreamCopy; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonRename].ToolTipText = Resources.FunctionKeyToolTipDataStreamRename; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonDelete].ToolTipText = Resources.FunctionKeyToolTipDataStreamDelete; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonSetAsDefault].ToolTipText = Resources.FunctionKeyToolTipDataStreamSetAsDefault; m_ToolStrip.Items[CommonConstants.KeyToolStripButtonOverrideSecurity].ToolTipText = Resources.FunctionKeyToolTipDataStreamOverrideSecurity; #endregion - [ToolTipText] - #region - [Get the Current Data Stream from the VCU] - // This only applies if the PTU is online. Workset_t workset; if (CommunicationInterface != null) { short variableCount, pointCount, sampleMultiple; short[] watchIdentifiers, dataTypes; try { CommunicationInterface.GetDefaultStreamInformation(out variableCount, out pointCount, out sampleMultiple, out watchIdentifiers, out dataTypes); } catch (Exception) { MessageBox.Show(Resources.MBTGetDefaultStreamParametersFailed, Resources.MBCaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Convert the parameters to a workset. workset = CommunicationInterface.ConvertToWorkset("GetDefaultStreamInformation()", watchIdentifiers, sampleMultiple); // Search the list of worksets for a match. m_WorksetFromVCU = workset; m_WorksetToCompare = workset; Workset_t matchedWorkset = Workset.FaultLog.Worksets.Find(CompareWorkset); // Check whether a match was found. if (matchedWorkset.WatchItems == null) { // No - Create a new workset. workset.Name = DefaultNewWorksetName; // Set the flag to indicate that the workset does not exist and that any changes will be saved as a new workset. m_CreateMode = true; m_ComboBoxWorkset.DropDownStyle = ComboBoxStyle.DropDown; // 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 = true; } else { // Yes - Update the name and security level of the workset. workset = matchedWorkset; // Set the flag to indicate that the form already exists and any changes will result in the existing workset being modified. m_CreateMode = false; m_ComboBoxWorkset.DropDownStyle = ComboBoxStyle.DropDownList; // 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; } } else { // Load the default workset. workset = worksetCollection.Worksets[worksetCollection.DefaultIndex]; // Set the flag to indicate that the form already exists and any changes will result in the existing workset being modified. m_CreateMode = false; m_ComboBoxWorkset.DropDownStyle = ComboBoxStyle.DropDownList; // 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; } #endregion - [Get the Current Data Stream from the VCU] - // Keep a record of the selected workset. This must be set up before the call to SetEnabledToolStripButtons(). m_SelectedWorkset = workset; SetEnabledToolStripButtons(true); // Update the 'Default' Image that identifies whether the selected workset is the default workset or not. m_PictureBoxDefault.Visible = (m_SelectedWorkset.Name.Equals(m_WorksetCollection.DefaultName)) ? true : false; // Display the name of the workset on the ComboBox control. // Ensure that the SelectionChanged event is not triggered as a result of specifying the Text property of the ComboBox control. m_ComboBoxWorkset.SelectedIndexChanged -= new EventHandler(m_ComboBoxWorkset_SelectedIndexChanged); m_ComboBoxWorkset.Text = workset.Name; m_ComboBoxWorkset.SelectedIndexChanged += new EventHandler(m_ComboBoxWorkset_SelectedIndexChanged); LoadWorkset(m_SelectedWorkset); // If an event log was specified, update the EntryCountMax property to reflect the actual number of watch variables associated with the current event log. if (log != null) { m_EntryCountMax = log.DataStreamTypeParameters.WatchVariablesMax; } UpdateCount(); // 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(); } // Disable all options other than save if the downloaded workset doesn't exist. if (m_CreateMode == true) { SetEnabledToolStripButtons(false); } // Allow the user to save the workset if it doesn't already exist. m_TSBSave.Enabled = (m_CreateMode == true) ? true : false; }