コード例 #1
0
ファイル: FormPlotDefine.cs プロジェクト: SiGenixDave/PtuPc
        /// <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;
        }
コード例 #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();
        }