Korero – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | using System; |
2 | using System.Windows.Forms; |
||
3 | using Korero.Communication; |
||
4 | using Korero.Properties; |
||
5 | using Korero.Utilities; |
||
6 | |||
7 | namespace Korero |
||
8 | { |
||
9 | public partial class SettingsForm : Form |
||
10 | { |
||
11 | #region Private Delegates, Events, Enums, Properties, Indexers and Fields |
||
12 | |||
13 | private readonly MqttCommunication _mqttCommunication; |
||
14 | |||
15 | #endregion |
||
16 | |||
17 | #region Constructors, Destructors and Finalizers |
||
18 | |||
19 | public SettingsForm() |
||
20 | { |
||
21 | InitializeComponent(); |
||
22 | Utilities.WindowState.FormTracker.Track(this); |
||
23 | } |
||
24 | |||
25 | public SettingsForm(MqttCommunication mqttCommunication) : this() |
||
26 | { |
||
27 | _mqttCommunication = mqttCommunication; |
||
28 | |||
29 | switch (_mqttCommunication.IsConnected) |
||
30 | { |
||
31 | case true: |
||
32 | corradeConnectionStatusLabel.Text = "Connected."; |
||
33 | break; |
||
34 | default: |
||
35 | corradeConnectionStatusLabel.Text = "Disconnected."; |
||
36 | break; |
||
37 | } |
||
38 | |||
39 | _mqttCommunication.Connected += MqttCommunication_Connected; |
||
40 | _mqttCommunication.Disconnected += MqttCommunication_Disconnected; |
||
41 | } |
||
42 | |||
43 | /// <summary> |
||
44 | /// Clean up any resources being used. |
||
45 | /// </summary> |
||
46 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
||
47 | protected override void Dispose(bool disposing) |
||
48 | { |
||
49 | if (disposing && components != null) |
||
50 | { |
||
51 | components.Dispose(); |
||
52 | } |
||
53 | |||
54 | _mqttCommunication.Connected -= MqttCommunication_Connected; |
||
55 | _mqttCommunication.Disconnected -= MqttCommunication_Disconnected; |
||
56 | base.Dispose(disposing); |
||
57 | } |
||
58 | |||
59 | #endregion |
||
60 | |||
61 | #region Event Handlers |
||
62 | |||
63 | private void MqttCommunication_Disconnected(object sender, MqttDisconnectedEventArgs e) |
||
64 | { |
||
65 | corradeConnectionStatusLabel.InvokeIfRequired(label => { label.Text = "Connection failed..."; }); |
||
66 | } |
||
67 | |||
68 | private void MqttCommunication_Connected(object sender, MqttConnectedEventArgs e) |
||
69 | { |
||
70 | corradeConnectionStatusLabel.InvokeIfRequired(label => { label.Text = "Connection works!"; }); |
||
71 | } |
||
72 | |||
73 | private void CheckBox2_CheckedChanged(object sender, EventArgs e) |
||
74 | { |
||
75 | Settings.Default.LaunchOnBoot = ((CheckBox) sender).Checked; |
||
76 | |||
77 | Miscellaneous.LaunchOnBootSet(Settings.Default.LaunchOnBoot); |
||
78 | } |
||
79 | |||
80 | private void Button1_Click(object sender, EventArgs e) |
||
81 | { |
||
82 | _mqttCommunication.Restart(); |
||
83 | } |
||
84 | |||
85 | private void PictureBox1_Click(object sender, EventArgs e) |
||
86 | { |
||
87 | var result = colorDialog1.ShowDialog(); |
||
88 | if (result == DialogResult.OK) |
||
89 | { |
||
90 | Settings.Default.MapDotColor = colorDialog1.Color; |
||
91 | } |
||
92 | } |
||
93 | |||
94 | private void Button2_Click(object sender, EventArgs e) |
||
95 | { |
||
96 | var result = fontDialog1.ShowDialog(); |
||
97 | if (result == DialogResult.OK) |
||
98 | { |
||
99 | Settings.Default.NotificationTitleFont = fontDialog1.Font; |
||
100 | } |
||
101 | } |
||
102 | |||
103 | private void Button3_Click(object sender, EventArgs e) |
||
104 | { |
||
105 | var result = fontDialog2.ShowDialog(); |
||
106 | if (result == DialogResult.OK) |
||
107 | { |
||
108 | Settings.Default.NotificationBodyFont = fontDialog2.Font; |
||
109 | } |
||
110 | } |
||
111 | |||
112 | #endregion |
||
113 | } |
||
114 | } |