Korero – Blame information for rev 2

Subversion Repositories:
Rev:
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 }
23  
24 public SettingsForm(MqttCommunication mqttCommunication) : this()
25 {
26 _mqttCommunication = mqttCommunication;
27  
28 switch (_mqttCommunication.IsConnected)
29 {
30 case true:
31 corradeConnectionStatusLabel.Text = "Connected.";
32 break;
33 default:
34 corradeConnectionStatusLabel.Text = "Disconnected.";
35 break;
36 }
37  
38 _mqttCommunication.Connected += MqttCommunication_Connected;
39 _mqttCommunication.Disconnected += MqttCommunication_Disconnected;
40 }
41  
42 /// <summary>
43 /// Clean up any resources being used.
44 /// </summary>
45 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
46 protected override void Dispose(bool disposing)
47 {
48 if (disposing && components != null)
49 {
50 components.Dispose();
51 }
52  
53 _mqttCommunication.Connected -= MqttCommunication_Connected;
54 _mqttCommunication.Disconnected -= MqttCommunication_Disconnected;
55 base.Dispose(disposing);
56 }
57  
58 #endregion
59  
60 #region Event Handlers
2 office 61 private void SettingsForm_Load(object sender, EventArgs e)
62 {
63 Utilities.WindowState.FormTracker.Track(this);
1 office 64  
2 office 65 }
1 office 66 private void MqttCommunication_Disconnected(object sender, MqttDisconnectedEventArgs e)
67 {
68 corradeConnectionStatusLabel.InvokeIfRequired(label => { label.Text = "Connection failed..."; });
69 }
70  
71 private void MqttCommunication_Connected(object sender, MqttConnectedEventArgs e)
72 {
73 corradeConnectionStatusLabel.InvokeIfRequired(label => { label.Text = "Connection works!"; });
74 }
75  
76 private void CheckBox2_CheckedChanged(object sender, EventArgs e)
77 {
78 Settings.Default.LaunchOnBoot = ((CheckBox) sender).Checked;
79  
80 Miscellaneous.LaunchOnBootSet(Settings.Default.LaunchOnBoot);
81 }
82  
83 private void Button1_Click(object sender, EventArgs e)
84 {
85 _mqttCommunication.Restart();
86 }
87  
88 private void PictureBox1_Click(object sender, EventArgs e)
89 {
90 var result = colorDialog1.ShowDialog();
91 if (result == DialogResult.OK)
92 {
93 Settings.Default.MapDotColor = colorDialog1.Color;
94 }
95 }
96  
97 private void Button2_Click(object sender, EventArgs e)
98 {
99 var result = fontDialog1.ShowDialog();
100 if (result == DialogResult.OK)
101 {
102 Settings.Default.NotificationTitleFont = fontDialog1.Font;
103 }
104 }
105  
106 private void Button3_Click(object sender, EventArgs e)
107 {
108 var result = fontDialog2.ShowDialog();
109 if (result == DialogResult.OK)
110 {
111 Settings.Default.NotificationBodyFont = fontDialog2.Font;
112 }
113 }
114  
115 #endregion
2 office 116  
117  
1 office 118 }
119 }