示例#1
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();
        }
示例#2
0
 public void Add(IEventLogFile file)
 {
     _eventLogFiles.Add(file);
 }