Exemplo n.º 1
0
        /// <summary>
        /// Event handler for the Apply button <c>Click</c> event. Update the workset.
        /// </summary>
        /// <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_ButtonApply_Click(object sender, EventArgs e)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            IWatchFile iWatchFile = CalledFrom as IWatchFile;

            Debug.Assert(iWatchFile != null, "FormPlotDefine.m_ButtonApply_Click() - [iWatchFile != null]");

            Cursor = Cursors.WaitCursor;

            // Yes - Update the WatchFile property with the new workset.
            WatchFile_t watchFile = iWatchFile.WatchFile;

            if (m_RestoreDefault == true)
            {
                watchFile.DataStream.Workset.PlotTabPages = null;
            }
            else
            {
                Workset_t workset = ConvertToWorkset(m_Workset.Name);
                watchFile.DataStream.Workset = workset;
            }
            iWatchFile.WatchFile = watchFile;
            iWatchFile.SaveWatchFile();

            m_ButtonApply.Enabled = false;

            // Let the calling form know that the watchfile has been modified.
            DialogResult = DialogResult.Yes;
            Cursor       = Cursors.Default;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Event handler for the OK button <c>Click</c> event. Closes the form.
        /// </summary>
        /// <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>
        private void m_ButtonOK_Click(object sender, EventArgs e)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            // Check whether the comments text of the header has been modified.
            if (m_TextBoxComments.Text != m_Header.Comments)
            {
                Cursor = Cursors.WaitCursor;

                // Check whether the calling form implements the IWatchFile interface.
                IWatchFile iWatchFile = CalledFrom as IWatchFile;
                if (iWatchFile != null)
                {
                    // Yes - Update the WatchFile property with the current header.
                    WatchFile_t watchFile = iWatchFile.WatchFile;
                    watchFile.Header.Comments = m_TextBoxComments.Text;
                    iWatchFile.WatchFile      = watchFile;
                    iWatchFile.SaveWatchFile();
                }
                else
                {
                    // No - Check whether the calling form implements the IEventLogFIle interface.
                    IEventLogFile iEventLogFile = CalledFrom as IEventLogFile;
                    if (iEventLogFile != null)
                    {
                        // Yes - Update the EventLogFile property with the current header.
                        EventLogFile_t eventLogFile = iEventLogFile.EventLogFile;
                        Header_t       header       = eventLogFile.Header;
                        header.Comments            = m_TextBoxComments.Text;
                        eventLogFile.Header        = header;
                        iEventLogFile.EventLogFile = eventLogFile;
                        iEventLogFile.SaveEventLogFile();
                    }
                }

                Cursor = Cursors.Default;
            }

            Close();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Event handler for the 'Show All' button <c>Click</c> event. Set the PlotTabPages field of the workset to the default values i.e. base the layout of the plot
        /// screen upon the contents of the Column field of the workset.
        /// </summary>
        /// <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>
        private void m_ButtonRestoreDefaults_Click(object sender, EventArgs e)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            IWatchFile iWatchFile = CalledFrom as IWatchFile;

            Debug.Assert(iWatchFile != null, "FormPlotDefine.m_ButtonRestoreDefaults_Click() - [iWatchFile != null]");

            Cursor           = Cursors.WaitCursor;
            m_RestoreDefault = true;
            m_ButtonRestoreDefault.Enabled = false;

            // Restore the default plot values.
            for (int columnIndex = 0; columnIndex < m_Workset.Column.Length; columnIndex++)
            {
                m_TextBoxHeaders[columnIndex].Text = m_Workset.Column[columnIndex].HeaderText;
                WatchItemAddRange(m_ListBoxes[columnIndex], m_Workset.Column[columnIndex]);
            }

            m_ListItemCount = m_Workset.Count;

            // Yes - Update the WatchFile property with the new workset.
            WatchFile_t watchFile = iWatchFile.WatchFile;

            if (watchFile.DataStream.Workset.PlotTabPages != null)
            {
                EnableApplyAndOKButtons();
            }
            else
            {
                DisableApplyAndOKButtons(string.Empty);
            }

            UpdateCount();

            Cursor = Cursors.Default;
        }
Exemplo n.º 4
0
 public FilesController(IWatchFile watchFile)
 {
     _watchFile = watchFile;
 }