示例#1
0
        private void OnUserEnteredLoggingTime(object sender, KeyEventArgs e)
        {
            double loggingTime = -1;

            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    loggingTime = Convert.ToDouble(this.LoggingTimeRichTextBox.Text);
                    if (loggingTime <= 0)
                    {
                        throw new Exception();
                    }
                }
                catch
                {
                    this.LoggingTimeRichTextBox.Text = "";
                    loggingTime = -1;
                    System.Windows.Forms.MessageBox.Show("Logging Time entered was invalid!", "Invalid Log Time Entered", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                finally
                {
                    if (loggingTime != -1)
                    {
                        LogTimeChangedEventArgs args = new LogTimeChangedEventArgs(loggingTime);
                        UserEnteredLoggingTime?.Invoke(sender, args);
                    }
                }
            }
        }
示例#2
0
 private void HandleUserEnteredLoggingTIme(object sender, LogTimeChangedEventArgs args)
 {
     DataLogManager.LoggingTime = args.LoggingTime;
 }