コード例 #1
0
        private void logEventInformationButton_Click(object sender, EventArgs e)
        {
            EventInformationForm eventForm = new EventInformationForm();

            DialogResult result = eventForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;

                    // Creates and fills the log entry with user information
                    LogEntry logEntry = new LogEntry();
                    logEntry.EventId  = eventForm.EventId;
                    logEntry.Priority = eventForm.Priority;
                    logEntry.Message  = eventForm.Message;
                    logEntry.Categories.Clear();

                    // Add the categories selected by the user
                    foreach (string category in eventForm.Categories)
                    {
                        logEntry.Categories.Add(category);
                    }

                    DisplayScenarioStart(String.Format(Properties.Resources.LogEventStartMessage, logEntry.ToString()));

                    // Writes the log entry.
                    Logger.Write(logEntry);

                    this.DisplayResults(String.Format(Properties.Resources.EventProcessedMessage, logEntry.EventId));
                }
                catch (Exception ex)
                {
                    ProcessUnhandledException(ex);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }
        }
コード例 #2
0
ファイル: QuickStartForm.cs プロジェクト: bnantz/NCS-V2-0
        private void logEventInformationButton_Click(object sender, EventArgs e)
        {
            EventInformationForm eventForm = new EventInformationForm();

            DialogResult result = eventForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;

                    // Creates and fills the log entry with user information
                    LogEntry logEntry = new LogEntry();
                    logEntry.EventId = eventForm.EventId;
                    logEntry.Priority = eventForm.Priority;
                    logEntry.Message = eventForm.Message;
                    logEntry.Categories.Clear();

                    // Add the categories selected by the user
                    foreach (string category in eventForm.Categories)
                    {
                        logEntry.Categories.Add(category);
                    }

                    DisplayScenarioStart(String.Format(Properties.Resources.LogEventStartMessage, logEntry.ToString()));

                    // Writes the log entry.
                    Logger.Write(logEntry);

                    this.DisplayResults(String.Format(Properties.Resources.EventProcessedMessage, logEntry.EventId));
                }
                catch (Exception ex)
                {
                    ProcessUnhandledException(ex);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }
        }