Mercurial > servermonitor
annotate ServerMonitor/Forms/SettingsForm.cs @ 6:c1dffaac66fa
- Don't show multiple password dialogs for the same key if the first one was cancelled.
- Add option to trim log files.
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Fri, 01 Mar 2019 21:38:22 -0500 |
parents | 3142e52cbe69 |
children | 052aa62cb42a |
rev | line source |
---|---|
4 | 1 using ServerMonitorApp.Properties; |
2 using System; | |
3 using System.Collections.Generic; | |
4 using System.ComponentModel; | |
5 using System.Data; | |
6 using System.Drawing; | |
7 using System.Linq; | |
8 using System.Text; | |
9 using System.Text.RegularExpressions; | |
10 using System.Threading.Tasks; | |
11 using System.Windows.Forms; | |
12 | |
13 namespace ServerMonitorApp | |
14 { | |
15 public partial class SettingsForm : Form | |
16 { | |
17 public SettingsForm() | |
18 { | |
19 InitializeComponent(); | |
20 } | |
21 | |
22 private void SettingsForm_Load(object sender, EventArgs e) | |
23 { | |
24 foreach (ComboBox comboBox in new object[] { ErrorComboBox, WarningComboBox, InformationComboBox }) | |
25 { | |
26 comboBox.DataSource = Enum.GetValues(typeof(FailAction)); | |
27 comboBox.Format += FailActionComboBox_Format; | |
28 } | |
6
c1dffaac66fa
- Don't show multiple password dialogs for the same key if the first one was cancelled.
Brad Greco <brad@bgreco.net>
parents:
4
diff
changeset
|
29 KeepLogDaysInput.Value = Settings.Default.KeepLogDays; |
4 | 30 ErrorComboBox.SelectedItem = Settings.Default.ErrorAction; |
31 WarningComboBox.SelectedItem = Settings.Default.WarningAction; | |
32 InformationComboBox.SelectedItem = Settings.Default.InformationAction; | |
33 } | |
34 | |
35 private void FailActionComboBox_Format(object sender, ListControlConvertEventArgs e) | |
36 { | |
37 e.Value = e.Value.ToString().Substring(0, 1) + Regex.Replace(e.Value.ToString(), "(\\B[A-Z])", " $1").ToLower().Substring(1); | |
38 } | |
39 | |
40 private void OkButton_Click(object sender, EventArgs e) | |
41 { | |
6
c1dffaac66fa
- Don't show multiple password dialogs for the same key if the first one was cancelled.
Brad Greco <brad@bgreco.net>
parents:
4
diff
changeset
|
42 Settings.Default.KeepLogDays = (int)KeepLogDaysInput.Value; |
4 | 43 Settings.Default.ErrorAction = (FailAction)ErrorComboBox.SelectedItem; |
44 Settings.Default.WarningAction = (FailAction)WarningComboBox.SelectedItem; | |
45 Settings.Default.InformationAction = (FailAction)InformationComboBox.SelectedItem; | |
46 Settings.Default.Save(); | |
47 Close(); | |
48 } | |
49 | |
50 private void CancelSettingsButton_Click(object sender, EventArgs e) | |
51 { | |
52 Close(); | |
53 } | |
54 } | |
55 } |