/// <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> /// Set the mode of the chart recorder to the specified mode. /// </summary> /// <param name="chartMode">The requested chart recorder mode.</param> private void SetChartMode(ChartMode chartMode) { ICommunicationWatch communicationInterface; if (MainWindow.CommunicationInterface.CommunicationSetting.Protocol == Protocol.SIMULATOR) { communicationInterface = new CommunicationWatchOffline(MainWindow.CommunicationInterface); } else { communicationInterface = new CommunicationWatch(MainWindow.CommunicationInterface); } PauseCommunication <ICommunicationWatch>(communicationInterface, true); communicationInterface.SetChartMode(chartMode); PauseCommunication <ICommunicationWatch>(communicationInterface, false); return; }