# HG changeset patch
# User Stephane Lenclud
# Date 1471864854 -7200
# Node ID 59ea5cb46258c104b4d7af6a6849082443e2566e
# Parent  f60cfcb98c9aabb76efb6dab5534ca89b93ccfcf
Trying to clean up our Harmony handling.

diff -r f60cfcb98c9a -r 59ea5cb46258 Server/FormMain.Designer.cs
--- a/Server/FormMain.Designer.cs	Sun Aug 21 19:31:08 2016 +0200
+++ b/Server/FormMain.Designer.cs	Mon Aug 22 13:20:54 2016 +0200
@@ -51,6 +51,7 @@
             this.toolStripStatusLabelPower = new System.Windows.Forms.ToolStripStatusLabel();
             this.toolStripStatusLabelFps = new System.Windows.Forms.ToolStripStatusLabel();
             this.tabPageClients = new System.Windows.Forms.TabPage();
+            this.iCheckBoxStartIdleClient = new System.Windows.Forms.CheckBox();
             this.iButtonStartIdleClient = new System.Windows.Forms.Button();
             this.buttonCloseClients = new System.Windows.Forms.Button();
             this.buttonStartClient = new System.Windows.Forms.Button();
@@ -64,6 +65,7 @@
             this.maskedTextBoxTimerInterval = new System.Windows.Forms.MaskedTextBox();
             this.comboBoxDisplayType = new System.Windows.Forms.ComboBox();
             this.buttonSuspend = new System.Windows.Forms.Button();
+            this.checkBoxConnectOnStartup = new System.Windows.Forms.CheckBox();
             this.trackBarBrightness = new System.Windows.Forms.TrackBar();
             this.buttonFill = new System.Windows.Forms.Button();
             this.buttonClear = new System.Windows.Forms.Button();
@@ -100,9 +102,11 @@
             this.checkBoxCecLogWarning = new System.Windows.Forms.CheckBox();
             this.labelHdmiPort = new System.Windows.Forms.Label();
             this.comboBoxHdmiPort = new System.Windows.Forms.ComboBox();
+            this.iCheckBoxCecEnabled = new System.Windows.Forms.CheckBox();
             this.tabPageHarmony = new System.Windows.Forms.TabPage();
+            this.iButtonHarmonyConnect = new System.Windows.Forms.Button();
+            this.iCheckBoxHarmonyEnabled = new System.Windows.Forms.CheckBox();
             this.iTreeViewHarmony = new System.Windows.Forms.TreeView();
-            this.iButtonHarmonyConnect = new System.Windows.Forms.Button();
             this.label2 = new System.Windows.Forms.Label();
             this.iTextBoxLogitechPassword = new System.Windows.Forms.TextBox();
             this.labelLogitechUserName = new System.Windows.Forms.Label();
@@ -122,6 +126,8 @@
             this.buttonActionAdd = new System.Windows.Forms.Button();
             this.iTreeViewEvents = new System.Windows.Forms.TreeView();
             this.tabPageApp = new System.Windows.Forms.TabPage();
+            this.checkBoxStartMinimized = new System.Windows.Forms.CheckBox();
+            this.checkBoxMinimizeToTray = new System.Windows.Forms.CheckBox();
             this.checkBoxAutoStart = new System.Windows.Forms.CheckBox();
             this.buttonUpdate = new System.Windows.Forms.Button();
             this.tabPageLogs = new System.Windows.Forms.TabPage();
@@ -131,12 +137,6 @@
             this.labelFontHeight = new System.Windows.Forms.Label();
             this.toolTip = new System.Windows.Forms.ToolTip(this.components);
             this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
-            this.checkBoxConnectOnStartup = new System.Windows.Forms.CheckBox();
-            this.iCheckBoxStartIdleClient = new System.Windows.Forms.CheckBox();
-            this.checkBoxCecEnabled = new System.Windows.Forms.CheckBox();
-            this.iCheckBoxHarmonyEnabled = new System.Windows.Forms.CheckBox();
-            this.checkBoxStartMinimized = new System.Windows.Forms.CheckBox();
-            this.checkBoxMinimizeToTray = new System.Windows.Forms.CheckBox();
             this.panelDisplay.SuspendLayout();
             this.iTableLayoutPanel.SuspendLayout();
             this.statusStrip.SuspendLayout();
@@ -285,6 +285,20 @@
             this.tabPageClients.Text = "Clients";
             this.tabPageClients.UseVisualStyleBackColor = true;
             // 
+            // iCheckBoxStartIdleClient
+            // 
+            this.iCheckBoxStartIdleClient.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+            this.iCheckBoxStartIdleClient.AutoSize = true;
+            this.iCheckBoxStartIdleClient.Checked = global::SharpDisplayManager.Properties.Settings.Default.StartIdleClient;
+            this.iCheckBoxStartIdleClient.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.iCheckBoxStartIdleClient.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "StartIdleClient", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
+            this.iCheckBoxStartIdleClient.Location = new System.Drawing.Point(108, 340);
+            this.iCheckBoxStartIdleClient.Name = "iCheckBoxStartIdleClient";
+            this.iCheckBoxStartIdleClient.Size = new System.Drawing.Size(145, 17);
+            this.iCheckBoxStartIdleClient.TabIndex = 22;
+            this.iCheckBoxStartIdleClient.Text = "Start idle client on startup";
+            this.iCheckBoxStartIdleClient.UseVisualStyleBackColor = true;
+            // 
             // iButtonStartIdleClient
             // 
             this.iButtonStartIdleClient.Location = new System.Drawing.Point(6, 35);
@@ -432,6 +446,19 @@
             this.buttonSuspend.UseVisualStyleBackColor = true;
             this.buttonSuspend.Click += new System.EventHandler(this.buttonSuspend_Click);
             // 
+            // checkBoxConnectOnStartup
+            // 
+            this.checkBoxConnectOnStartup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+            this.checkBoxConnectOnStartup.AutoSize = true;
+            this.checkBoxConnectOnStartup.Checked = global::SharpDisplayManager.Properties.Settings.Default.DisplayConnectOnStartup;
+            this.checkBoxConnectOnStartup.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "DisplayConnectOnStartup", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
+            this.checkBoxConnectOnStartup.Location = new System.Drawing.Point(113, 350);
+            this.checkBoxConnectOnStartup.Name = "checkBoxConnectOnStartup";
+            this.checkBoxConnectOnStartup.Size = new System.Drawing.Size(119, 17);
+            this.checkBoxConnectOnStartup.TabIndex = 13;
+            this.checkBoxConnectOnStartup.Text = "Connect on stratup ";
+            this.checkBoxConnectOnStartup.UseVisualStyleBackColor = true;
+            // 
             // trackBarBrightness
             // 
             this.trackBarBrightness.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
@@ -752,7 +779,7 @@
             this.tabPageCec.Controls.Add(this.groupBoxCecLogOptions);
             this.tabPageCec.Controls.Add(this.labelHdmiPort);
             this.tabPageCec.Controls.Add(this.comboBoxHdmiPort);
-            this.tabPageCec.Controls.Add(this.checkBoxCecEnabled);
+            this.tabPageCec.Controls.Add(this.iCheckBoxCecEnabled);
             this.tabPageCec.Location = new System.Drawing.Point(4, 22);
             this.tabPageCec.Name = "tabPageCec";
             this.tabPageCec.Padding = new System.Windows.Forms.Padding(3);
@@ -880,11 +907,24 @@
             this.comboBoxHdmiPort.TabIndex = 19;
             this.comboBoxHdmiPort.SelectedIndexChanged += new System.EventHandler(this.comboBoxHdmiPort_SelectedIndexChanged);
             // 
+            // iCheckBoxCecEnabled
+            // 
+            this.iCheckBoxCecEnabled.AutoSize = true;
+            this.iCheckBoxCecEnabled.Checked = global::SharpDisplayManager.Properties.Settings.Default.CecEnabled;
+            this.iCheckBoxCecEnabled.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "CecEnabled", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
+            this.iCheckBoxCecEnabled.Location = new System.Drawing.Point(6, 6);
+            this.iCheckBoxCecEnabled.Name = "iCheckBoxCecEnabled";
+            this.iCheckBoxCecEnabled.Size = new System.Drawing.Size(83, 17);
+            this.iCheckBoxCecEnabled.TabIndex = 21;
+            this.iCheckBoxCecEnabled.Text = "Enable CEC";
+            this.iCheckBoxCecEnabled.UseVisualStyleBackColor = true;
+            this.iCheckBoxCecEnabled.CheckedChanged += new System.EventHandler(this.iCheckBoxCecEnabled_CheckedChanged);
+            // 
             // tabPageHarmony
             // 
+            this.tabPageHarmony.Controls.Add(this.iButtonHarmonyConnect);
             this.tabPageHarmony.Controls.Add(this.iCheckBoxHarmonyEnabled);
             this.tabPageHarmony.Controls.Add(this.iTreeViewHarmony);
-            this.tabPageHarmony.Controls.Add(this.iButtonHarmonyConnect);
             this.tabPageHarmony.Controls.Add(this.label2);
             this.tabPageHarmony.Controls.Add(this.iTextBoxLogitechPassword);
             this.tabPageHarmony.Controls.Add(this.labelLogitechUserName);
@@ -899,27 +939,40 @@
             this.tabPageHarmony.Text = "Harmony";
             this.tabPageHarmony.UseVisualStyleBackColor = true;
             // 
+            // iButtonHarmonyConnect
+            // 
+            this.iButtonHarmonyConnect.Location = new System.Drawing.Point(6, 49);
+            this.iButtonHarmonyConnect.Name = "iButtonHarmonyConnect";
+            this.iButtonHarmonyConnect.Size = new System.Drawing.Size(75, 23);
+            this.iButtonHarmonyConnect.TabIndex = 23;
+            this.iButtonHarmonyConnect.Text = "Open";
+            this.iButtonHarmonyConnect.UseVisualStyleBackColor = true;
+            this.iButtonHarmonyConnect.Click += new System.EventHandler(this.iButtonHarmonyConnect_Click);
+            // 
+            // iCheckBoxHarmonyEnabled
+            // 
+            this.iCheckBoxHarmonyEnabled.AutoSize = true;
+            this.iCheckBoxHarmonyEnabled.Checked = global::SharpDisplayManager.Properties.Settings.Default.HarmonyEnabled;
+            this.iCheckBoxHarmonyEnabled.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "HarmonyEnabled", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
+            this.iCheckBoxHarmonyEnabled.Location = new System.Drawing.Point(6, 6);
+            this.iCheckBoxHarmonyEnabled.Name = "iCheckBoxHarmonyEnabled";
+            this.iCheckBoxHarmonyEnabled.Size = new System.Drawing.Size(104, 17);
+            this.iCheckBoxHarmonyEnabled.TabIndex = 22;
+            this.iCheckBoxHarmonyEnabled.Text = "Enable Harmony";
+            this.iCheckBoxHarmonyEnabled.UseVisualStyleBackColor = true;
+            this.iCheckBoxHarmonyEnabled.CheckedChanged += new System.EventHandler(this.iCheckBoxHarmonyEnabled_CheckedChanged);
+            // 
             // iTreeViewHarmony
             // 
             this.iTreeViewHarmony.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
-            this.iTreeViewHarmony.Location = new System.Drawing.Point(84, 49);
+            this.iTreeViewHarmony.Location = new System.Drawing.Point(87, 49);
             this.iTreeViewHarmony.Name = "iTreeViewHarmony";
-            this.iTreeViewHarmony.Size = new System.Drawing.Size(662, 330);
+            this.iTreeViewHarmony.Size = new System.Drawing.Size(659, 330);
             this.iTreeViewHarmony.TabIndex = 15;
             this.iTreeViewHarmony.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.iTreeViewHarmony_NodeMouseDoubleClick);
             // 
-            // iButtonHarmonyConnect
-            // 
-            this.iButtonHarmonyConnect.Location = new System.Drawing.Point(3, 49);
-            this.iButtonHarmonyConnect.Name = "iButtonHarmonyConnect";
-            this.iButtonHarmonyConnect.Size = new System.Drawing.Size(75, 23);
-            this.iButtonHarmonyConnect.TabIndex = 14;
-            this.iButtonHarmonyConnect.Text = "Connect";
-            this.iButtonHarmonyConnect.UseVisualStyleBackColor = true;
-            this.iButtonHarmonyConnect.Click += new System.EventHandler(this.iButtonHarmonyConnect_Click);
-            // 
             // label2
             // 
             this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -972,11 +1025,12 @@
             // iTextBoxHarmonyHubAddress
             // 
             this.iTextBoxHarmonyHubAddress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.iTextBoxHarmonyHubAddress.DataBindings.Add(new System.Windows.Forms.Binding("Text", global::SharpDisplayManager.Properties.Settings.Default, "HarmonyHubAddress", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
             this.iTextBoxHarmonyHubAddress.Location = new System.Drawing.Point(282, 23);
             this.iTextBoxHarmonyHubAddress.Name = "iTextBoxHarmonyHubAddress";
             this.iTextBoxHarmonyHubAddress.Size = new System.Drawing.Size(100, 20);
             this.iTextBoxHarmonyHubAddress.TabIndex = 8;
-            this.iTextBoxHarmonyHubAddress.Text = "HarmonyHub";
+            this.iTextBoxHarmonyHubAddress.Text = global::SharpDisplayManager.Properties.Settings.Default.HarmonyHubAddress;
             // 
             // tabPageEvent
             // 
@@ -1135,6 +1189,32 @@
             this.tabPageApp.Text = "Application";
             this.tabPageApp.UseVisualStyleBackColor = true;
             // 
+            // checkBoxStartMinimized
+            // 
+            this.checkBoxStartMinimized.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+            this.checkBoxStartMinimized.AutoSize = true;
+            this.checkBoxStartMinimized.Checked = global::SharpDisplayManager.Properties.Settings.Default.StartMinimized;
+            this.checkBoxStartMinimized.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "StartMinimized", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
+            this.checkBoxStartMinimized.Location = new System.Drawing.Point(6, 285);
+            this.checkBoxStartMinimized.Name = "checkBoxStartMinimized";
+            this.checkBoxStartMinimized.Size = new System.Drawing.Size(96, 17);
+            this.checkBoxStartMinimized.TabIndex = 16;
+            this.checkBoxStartMinimized.Text = "Start minimized";
+            this.checkBoxStartMinimized.UseVisualStyleBackColor = true;
+            // 
+            // checkBoxMinimizeToTray
+            // 
+            this.checkBoxMinimizeToTray.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+            this.checkBoxMinimizeToTray.AutoSize = true;
+            this.checkBoxMinimizeToTray.Checked = global::SharpDisplayManager.Properties.Settings.Default.MinimizeToTray;
+            this.checkBoxMinimizeToTray.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "MinimizeToTray", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
+            this.checkBoxMinimizeToTray.Location = new System.Drawing.Point(6, 308);
+            this.checkBoxMinimizeToTray.Name = "checkBoxMinimizeToTray";
+            this.checkBoxMinimizeToTray.Size = new System.Drawing.Size(133, 17);
+            this.checkBoxMinimizeToTray.TabIndex = 15;
+            this.checkBoxMinimizeToTray.Text = "Minimize to system tray";
+            this.checkBoxMinimizeToTray.UseVisualStyleBackColor = true;
+            // 
             // checkBoxAutoStart
             // 
             this.checkBoxAutoStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -1218,84 +1298,6 @@
             // 
             this.openFileDialog.Filter = "EXE files (*.exe)|*.exe|All files (*.*)|*.*";
             // 
-            // checkBoxConnectOnStartup
-            // 
-            this.checkBoxConnectOnStartup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-            this.checkBoxConnectOnStartup.AutoSize = true;
-            this.checkBoxConnectOnStartup.Checked = global::SharpDisplayManager.Properties.Settings.Default.DisplayConnectOnStartup;
-            this.checkBoxConnectOnStartup.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "DisplayConnectOnStartup", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
-            this.checkBoxConnectOnStartup.Location = new System.Drawing.Point(113, 350);
-            this.checkBoxConnectOnStartup.Name = "checkBoxConnectOnStartup";
-            this.checkBoxConnectOnStartup.Size = new System.Drawing.Size(119, 17);
-            this.checkBoxConnectOnStartup.TabIndex = 13;
-            this.checkBoxConnectOnStartup.Text = "Connect on stratup ";
-            this.checkBoxConnectOnStartup.UseVisualStyleBackColor = true;
-            // 
-            // iCheckBoxStartIdleClient
-            // 
-            this.iCheckBoxStartIdleClient.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-            this.iCheckBoxStartIdleClient.AutoSize = true;
-            this.iCheckBoxStartIdleClient.Checked = global::SharpDisplayManager.Properties.Settings.Default.StartIdleClient;
-            this.iCheckBoxStartIdleClient.CheckState = System.Windows.Forms.CheckState.Checked;
-            this.iCheckBoxStartIdleClient.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "StartIdleClient", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
-            this.iCheckBoxStartIdleClient.Location = new System.Drawing.Point(108, 340);
-            this.iCheckBoxStartIdleClient.Name = "iCheckBoxStartIdleClient";
-            this.iCheckBoxStartIdleClient.Size = new System.Drawing.Size(145, 17);
-            this.iCheckBoxStartIdleClient.TabIndex = 22;
-            this.iCheckBoxStartIdleClient.Text = "Start idle client on startup";
-            this.iCheckBoxStartIdleClient.UseVisualStyleBackColor = true;
-            // 
-            // checkBoxCecEnabled
-            // 
-            this.checkBoxCecEnabled.AutoSize = true;
-            this.checkBoxCecEnabled.Checked = global::SharpDisplayManager.Properties.Settings.Default.CecEnabled;
-            this.checkBoxCecEnabled.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "CecEnabled", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
-            this.checkBoxCecEnabled.Location = new System.Drawing.Point(6, 6);
-            this.checkBoxCecEnabled.Name = "checkBoxCecEnabled";
-            this.checkBoxCecEnabled.Size = new System.Drawing.Size(83, 17);
-            this.checkBoxCecEnabled.TabIndex = 21;
-            this.checkBoxCecEnabled.Text = "Enable CEC";
-            this.checkBoxCecEnabled.UseVisualStyleBackColor = true;
-            this.checkBoxCecEnabled.CheckedChanged += new System.EventHandler(this.checkBoxCecEnabled_CheckedChanged);
-            // 
-            // iCheckBoxHarmonyEnabled
-            // 
-            this.iCheckBoxHarmonyEnabled.AutoSize = true;
-            this.iCheckBoxHarmonyEnabled.Checked = global::SharpDisplayManager.Properties.Settings.Default.HarmonyEnabled;
-            this.iCheckBoxHarmonyEnabled.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "HarmonyEnabled", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
-            this.iCheckBoxHarmonyEnabled.Location = new System.Drawing.Point(6, 6);
-            this.iCheckBoxHarmonyEnabled.Name = "iCheckBoxHarmonyEnabled";
-            this.iCheckBoxHarmonyEnabled.Size = new System.Drawing.Size(104, 17);
-            this.iCheckBoxHarmonyEnabled.TabIndex = 22;
-            this.iCheckBoxHarmonyEnabled.Text = "Enable Harmony";
-            this.iCheckBoxHarmonyEnabled.UseVisualStyleBackColor = true;
-            // 
-            // checkBoxStartMinimized
-            // 
-            this.checkBoxStartMinimized.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-            this.checkBoxStartMinimized.AutoSize = true;
-            this.checkBoxStartMinimized.Checked = global::SharpDisplayManager.Properties.Settings.Default.StartMinimized;
-            this.checkBoxStartMinimized.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "StartMinimized", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
-            this.checkBoxStartMinimized.Location = new System.Drawing.Point(6, 285);
-            this.checkBoxStartMinimized.Name = "checkBoxStartMinimized";
-            this.checkBoxStartMinimized.Size = new System.Drawing.Size(96, 17);
-            this.checkBoxStartMinimized.TabIndex = 16;
-            this.checkBoxStartMinimized.Text = "Start minimized";
-            this.checkBoxStartMinimized.UseVisualStyleBackColor = true;
-            // 
-            // checkBoxMinimizeToTray
-            // 
-            this.checkBoxMinimizeToTray.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-            this.checkBoxMinimizeToTray.AutoSize = true;
-            this.checkBoxMinimizeToTray.Checked = global::SharpDisplayManager.Properties.Settings.Default.MinimizeToTray;
-            this.checkBoxMinimizeToTray.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "MinimizeToTray", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
-            this.checkBoxMinimizeToTray.Location = new System.Drawing.Point(6, 308);
-            this.checkBoxMinimizeToTray.Name = "checkBoxMinimizeToTray";
-            this.checkBoxMinimizeToTray.Size = new System.Drawing.Size(133, 17);
-            this.checkBoxMinimizeToTray.TabIndex = 15;
-            this.checkBoxMinimizeToTray.Text = "Minimize to system tray";
-            this.checkBoxMinimizeToTray.UseVisualStyleBackColor = true;
-            // 
             // FormMain
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -1409,7 +1411,7 @@
 		private System.Windows.Forms.Label labelDefaultAudioDevice;
 		private System.Windows.Forms.OpenFileDialog openFileDialog;
         private System.Windows.Forms.TabPage tabPageCec;
-        private System.Windows.Forms.CheckBox checkBoxCecEnabled;
+        private System.Windows.Forms.CheckBox iCheckBoxCecEnabled;
         private System.Windows.Forms.Label labelHdmiPort;
         private System.Windows.Forms.ComboBox comboBoxHdmiPort;
         private System.Windows.Forms.Button iButtonStartIdleClient;
@@ -1438,7 +1440,6 @@
         private System.Windows.Forms.Button buttonEventEdit;
         private System.Windows.Forms.TabPage tabPageHarmony;
         private System.Windows.Forms.TreeView iTreeViewHarmony;
-        private System.Windows.Forms.Button iButtonHarmonyConnect;
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.TextBox iTextBoxLogitechPassword;
         private System.Windows.Forms.Label labelLogitechUserName;
@@ -1446,6 +1447,7 @@
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.TextBox iTextBoxHarmonyHubAddress;
         private System.Windows.Forms.CheckBox iCheckBoxHarmonyEnabled;
+        private System.Windows.Forms.Button iButtonHarmonyConnect;
     }
 }
 
diff -r f60cfcb98c9a -r 59ea5cb46258 Server/FormMain.cs
--- a/Server/FormMain.cs	Sun Aug 21 19:31:08 2016 +0200
+++ b/Server/FormMain.cs	Mon Aug 22 13:20:54 2016 +0200
@@ -1201,7 +1201,7 @@
             checkBoxAutoStart.Checked = iStartupManager.Startup;
 
             //Harmony settings
-            iTextBoxHarmonyHubAddress.Text = Properties.Settings.Default.HarmonyHubAddress;
+            iButtonHarmonyConnect.Enabled = Properties.Settings.Default.HarmonyEnabled;
 
             //CEC settings
             comboBoxHdmiPort.SelectedIndex = Properties.Settings.Default.CecHdmiPort - 1;
@@ -2525,7 +2525,7 @@
             base.WndProc(ref aMessage);
         }
 
-        private void checkBoxCecEnabled_CheckedChanged(object sender, EventArgs e)
+        private void iCheckBoxCecEnabled_CheckedChanged(object sender, EventArgs e)
         {
             //
             ResetCec();
@@ -2566,20 +2566,19 @@
         /// <summary>
         /// 
         /// </summary>
-        private async void ResetHarmony()
+        private async void ResetHarmony(bool aForceAuth=false)
         {
             // ConnectAsync already if we have an existing session cookie
-            if (Properties.Settings.Default.HarmonyEnabled && File.Exists("SessionToken"))
+            if (Properties.Settings.Default.HarmonyEnabled)
             {
-
-                iButtonHarmonyConnect.Enabled = false;
                 try
                 {
-                    await ConnectHarmonyAsync();
+                    await ConnectHarmonyAsync(aForceAuth);
                 }
-                finally
+                catch (Exception ex)
                 {
-                    iButtonHarmonyConnect.Enabled = true;
+                    Console.WriteLine("Exception thrown by ConnectHarmonyAsync");
+                    Console.WriteLine(ex.ToString());
                 }
             }
         }
@@ -2587,6 +2586,28 @@
         /// <summary>
         /// 
         /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void iButtonHarmonyConnect_Click(object sender, EventArgs e)
+        {
+            // User is explicitaly trying to connect
+            //Reset Harmony Hub connection forcing authentication
+            ResetHarmony(true);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void iCheckBoxHarmonyEnabled_CheckedChanged(object sender, EventArgs e)
+        {
+            iButtonHarmonyConnect.Enabled = iCheckBoxHarmonyEnabled.Checked;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
         private void SetupCecLogLevel()
         {
             //Setup log level
@@ -2975,31 +2996,8 @@
         /// <summary>
         /// 
         /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private async void iButtonHarmonyConnect_Click(object sender, EventArgs e)
-        {
-            //Save hub address
-            Properties.Settings.Default.HarmonyHubAddress = iTextBoxHarmonyHubAddress.Text;
-            Properties.Settings.Default.Save();
-
-            iButtonHarmonyConnect.Enabled = false;
-            try
-            {
-                await ConnectHarmonyAsync();
-            }
-            catch (Exception)
-            {
-                iButtonHarmonyConnect.Enabled = true;
-            }
-
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
         /// <returns></returns>
-        private async Task ConnectHarmonyAsync()
+        private async Task ConnectHarmonyAsync(bool aForceAuth=false)
         {
             if (Program.HarmonyClient != null)
             {
@@ -3013,7 +3011,7 @@
             Console.WriteLine("Harmony: Connecting... ");
             Program.HarmonyClient = new HarmonyHub.Client(iTextBoxHarmonyHubAddress.Text);
             //First create our client and login
-            if (File.Exists("SessionToken"))
+            if (File.Exists("SessionToken") && !aForceAuth)
             {
                 var sessionToken = File.ReadAllText("SessionToken");
                 Console.WriteLine("Harmony: Reusing token: {0}", sessionToken);
@@ -3087,5 +3085,6 @@
                 await Program.HarmonyClient.SendCommandAsync(d.Id, f.Name);
             }
         }
+
     }
 }