Trying to clean up our Harmony handling.
authorStephane Lenclud
Mon, 22 Aug 2016 13:20:54 +0200
changeset 25259ea5cb46258
parent 251 f60cfcb98c9a
child 253 2dae7a163fff
Trying to clean up our Harmony handling.
Server/FormMain.Designer.cs
Server/FormMain.cs
     1.1 --- a/Server/FormMain.Designer.cs	Sun Aug 21 19:31:08 2016 +0200
     1.2 +++ b/Server/FormMain.Designer.cs	Mon Aug 22 13:20:54 2016 +0200
     1.3 @@ -51,6 +51,7 @@
     1.4              this.toolStripStatusLabelPower = new System.Windows.Forms.ToolStripStatusLabel();
     1.5              this.toolStripStatusLabelFps = new System.Windows.Forms.ToolStripStatusLabel();
     1.6              this.tabPageClients = new System.Windows.Forms.TabPage();
     1.7 +            this.iCheckBoxStartIdleClient = new System.Windows.Forms.CheckBox();
     1.8              this.iButtonStartIdleClient = new System.Windows.Forms.Button();
     1.9              this.buttonCloseClients = new System.Windows.Forms.Button();
    1.10              this.buttonStartClient = new System.Windows.Forms.Button();
    1.11 @@ -64,6 +65,7 @@
    1.12              this.maskedTextBoxTimerInterval = new System.Windows.Forms.MaskedTextBox();
    1.13              this.comboBoxDisplayType = new System.Windows.Forms.ComboBox();
    1.14              this.buttonSuspend = new System.Windows.Forms.Button();
    1.15 +            this.checkBoxConnectOnStartup = new System.Windows.Forms.CheckBox();
    1.16              this.trackBarBrightness = new System.Windows.Forms.TrackBar();
    1.17              this.buttonFill = new System.Windows.Forms.Button();
    1.18              this.buttonClear = new System.Windows.Forms.Button();
    1.19 @@ -100,9 +102,11 @@
    1.20              this.checkBoxCecLogWarning = new System.Windows.Forms.CheckBox();
    1.21              this.labelHdmiPort = new System.Windows.Forms.Label();
    1.22              this.comboBoxHdmiPort = new System.Windows.Forms.ComboBox();
    1.23 +            this.iCheckBoxCecEnabled = new System.Windows.Forms.CheckBox();
    1.24              this.tabPageHarmony = new System.Windows.Forms.TabPage();
    1.25 +            this.iButtonHarmonyConnect = new System.Windows.Forms.Button();
    1.26 +            this.iCheckBoxHarmonyEnabled = new System.Windows.Forms.CheckBox();
    1.27              this.iTreeViewHarmony = new System.Windows.Forms.TreeView();
    1.28 -            this.iButtonHarmonyConnect = new System.Windows.Forms.Button();
    1.29              this.label2 = new System.Windows.Forms.Label();
    1.30              this.iTextBoxLogitechPassword = new System.Windows.Forms.TextBox();
    1.31              this.labelLogitechUserName = new System.Windows.Forms.Label();
    1.32 @@ -122,6 +126,8 @@
    1.33              this.buttonActionAdd = new System.Windows.Forms.Button();
    1.34              this.iTreeViewEvents = new System.Windows.Forms.TreeView();
    1.35              this.tabPageApp = new System.Windows.Forms.TabPage();
    1.36 +            this.checkBoxStartMinimized = new System.Windows.Forms.CheckBox();
    1.37 +            this.checkBoxMinimizeToTray = new System.Windows.Forms.CheckBox();
    1.38              this.checkBoxAutoStart = new System.Windows.Forms.CheckBox();
    1.39              this.buttonUpdate = new System.Windows.Forms.Button();
    1.40              this.tabPageLogs = new System.Windows.Forms.TabPage();
    1.41 @@ -131,12 +137,6 @@
    1.42              this.labelFontHeight = new System.Windows.Forms.Label();
    1.43              this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    1.44              this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    1.45 -            this.checkBoxConnectOnStartup = new System.Windows.Forms.CheckBox();
    1.46 -            this.iCheckBoxStartIdleClient = new System.Windows.Forms.CheckBox();
    1.47 -            this.checkBoxCecEnabled = new System.Windows.Forms.CheckBox();
    1.48 -            this.iCheckBoxHarmonyEnabled = new System.Windows.Forms.CheckBox();
    1.49 -            this.checkBoxStartMinimized = new System.Windows.Forms.CheckBox();
    1.50 -            this.checkBoxMinimizeToTray = new System.Windows.Forms.CheckBox();
    1.51              this.panelDisplay.SuspendLayout();
    1.52              this.iTableLayoutPanel.SuspendLayout();
    1.53              this.statusStrip.SuspendLayout();
    1.54 @@ -285,6 +285,20 @@
    1.55              this.tabPageClients.Text = "Clients";
    1.56              this.tabPageClients.UseVisualStyleBackColor = true;
    1.57              // 
    1.58 +            // iCheckBoxStartIdleClient
    1.59 +            // 
    1.60 +            this.iCheckBoxStartIdleClient.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    1.61 +            this.iCheckBoxStartIdleClient.AutoSize = true;
    1.62 +            this.iCheckBoxStartIdleClient.Checked = global::SharpDisplayManager.Properties.Settings.Default.StartIdleClient;
    1.63 +            this.iCheckBoxStartIdleClient.CheckState = System.Windows.Forms.CheckState.Checked;
    1.64 +            this.iCheckBoxStartIdleClient.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "StartIdleClient", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
    1.65 +            this.iCheckBoxStartIdleClient.Location = new System.Drawing.Point(108, 340);
    1.66 +            this.iCheckBoxStartIdleClient.Name = "iCheckBoxStartIdleClient";
    1.67 +            this.iCheckBoxStartIdleClient.Size = new System.Drawing.Size(145, 17);
    1.68 +            this.iCheckBoxStartIdleClient.TabIndex = 22;
    1.69 +            this.iCheckBoxStartIdleClient.Text = "Start idle client on startup";
    1.70 +            this.iCheckBoxStartIdleClient.UseVisualStyleBackColor = true;
    1.71 +            // 
    1.72              // iButtonStartIdleClient
    1.73              // 
    1.74              this.iButtonStartIdleClient.Location = new System.Drawing.Point(6, 35);
    1.75 @@ -432,6 +446,19 @@
    1.76              this.buttonSuspend.UseVisualStyleBackColor = true;
    1.77              this.buttonSuspend.Click += new System.EventHandler(this.buttonSuspend_Click);
    1.78              // 
    1.79 +            // checkBoxConnectOnStartup
    1.80 +            // 
    1.81 +            this.checkBoxConnectOnStartup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    1.82 +            this.checkBoxConnectOnStartup.AutoSize = true;
    1.83 +            this.checkBoxConnectOnStartup.Checked = global::SharpDisplayManager.Properties.Settings.Default.DisplayConnectOnStartup;
    1.84 +            this.checkBoxConnectOnStartup.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "DisplayConnectOnStartup", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
    1.85 +            this.checkBoxConnectOnStartup.Location = new System.Drawing.Point(113, 350);
    1.86 +            this.checkBoxConnectOnStartup.Name = "checkBoxConnectOnStartup";
    1.87 +            this.checkBoxConnectOnStartup.Size = new System.Drawing.Size(119, 17);
    1.88 +            this.checkBoxConnectOnStartup.TabIndex = 13;
    1.89 +            this.checkBoxConnectOnStartup.Text = "Connect on stratup ";
    1.90 +            this.checkBoxConnectOnStartup.UseVisualStyleBackColor = true;
    1.91 +            // 
    1.92              // trackBarBrightness
    1.93              // 
    1.94              this.trackBarBrightness.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    1.95 @@ -752,7 +779,7 @@
    1.96              this.tabPageCec.Controls.Add(this.groupBoxCecLogOptions);
    1.97              this.tabPageCec.Controls.Add(this.labelHdmiPort);
    1.98              this.tabPageCec.Controls.Add(this.comboBoxHdmiPort);
    1.99 -            this.tabPageCec.Controls.Add(this.checkBoxCecEnabled);
   1.100 +            this.tabPageCec.Controls.Add(this.iCheckBoxCecEnabled);
   1.101              this.tabPageCec.Location = new System.Drawing.Point(4, 22);
   1.102              this.tabPageCec.Name = "tabPageCec";
   1.103              this.tabPageCec.Padding = new System.Windows.Forms.Padding(3);
   1.104 @@ -880,11 +907,24 @@
   1.105              this.comboBoxHdmiPort.TabIndex = 19;
   1.106              this.comboBoxHdmiPort.SelectedIndexChanged += new System.EventHandler(this.comboBoxHdmiPort_SelectedIndexChanged);
   1.107              // 
   1.108 +            // iCheckBoxCecEnabled
   1.109 +            // 
   1.110 +            this.iCheckBoxCecEnabled.AutoSize = true;
   1.111 +            this.iCheckBoxCecEnabled.Checked = global::SharpDisplayManager.Properties.Settings.Default.CecEnabled;
   1.112 +            this.iCheckBoxCecEnabled.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "CecEnabled", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
   1.113 +            this.iCheckBoxCecEnabled.Location = new System.Drawing.Point(6, 6);
   1.114 +            this.iCheckBoxCecEnabled.Name = "iCheckBoxCecEnabled";
   1.115 +            this.iCheckBoxCecEnabled.Size = new System.Drawing.Size(83, 17);
   1.116 +            this.iCheckBoxCecEnabled.TabIndex = 21;
   1.117 +            this.iCheckBoxCecEnabled.Text = "Enable CEC";
   1.118 +            this.iCheckBoxCecEnabled.UseVisualStyleBackColor = true;
   1.119 +            this.iCheckBoxCecEnabled.CheckedChanged += new System.EventHandler(this.iCheckBoxCecEnabled_CheckedChanged);
   1.120 +            // 
   1.121              // tabPageHarmony
   1.122              // 
   1.123 +            this.tabPageHarmony.Controls.Add(this.iButtonHarmonyConnect);
   1.124              this.tabPageHarmony.Controls.Add(this.iCheckBoxHarmonyEnabled);
   1.125              this.tabPageHarmony.Controls.Add(this.iTreeViewHarmony);
   1.126 -            this.tabPageHarmony.Controls.Add(this.iButtonHarmonyConnect);
   1.127              this.tabPageHarmony.Controls.Add(this.label2);
   1.128              this.tabPageHarmony.Controls.Add(this.iTextBoxLogitechPassword);
   1.129              this.tabPageHarmony.Controls.Add(this.labelLogitechUserName);
   1.130 @@ -899,27 +939,40 @@
   1.131              this.tabPageHarmony.Text = "Harmony";
   1.132              this.tabPageHarmony.UseVisualStyleBackColor = true;
   1.133              // 
   1.134 +            // iButtonHarmonyConnect
   1.135 +            // 
   1.136 +            this.iButtonHarmonyConnect.Location = new System.Drawing.Point(6, 49);
   1.137 +            this.iButtonHarmonyConnect.Name = "iButtonHarmonyConnect";
   1.138 +            this.iButtonHarmonyConnect.Size = new System.Drawing.Size(75, 23);
   1.139 +            this.iButtonHarmonyConnect.TabIndex = 23;
   1.140 +            this.iButtonHarmonyConnect.Text = "Open";
   1.141 +            this.iButtonHarmonyConnect.UseVisualStyleBackColor = true;
   1.142 +            this.iButtonHarmonyConnect.Click += new System.EventHandler(this.iButtonHarmonyConnect_Click);
   1.143 +            // 
   1.144 +            // iCheckBoxHarmonyEnabled
   1.145 +            // 
   1.146 +            this.iCheckBoxHarmonyEnabled.AutoSize = true;
   1.147 +            this.iCheckBoxHarmonyEnabled.Checked = global::SharpDisplayManager.Properties.Settings.Default.HarmonyEnabled;
   1.148 +            this.iCheckBoxHarmonyEnabled.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "HarmonyEnabled", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
   1.149 +            this.iCheckBoxHarmonyEnabled.Location = new System.Drawing.Point(6, 6);
   1.150 +            this.iCheckBoxHarmonyEnabled.Name = "iCheckBoxHarmonyEnabled";
   1.151 +            this.iCheckBoxHarmonyEnabled.Size = new System.Drawing.Size(104, 17);
   1.152 +            this.iCheckBoxHarmonyEnabled.TabIndex = 22;
   1.153 +            this.iCheckBoxHarmonyEnabled.Text = "Enable Harmony";
   1.154 +            this.iCheckBoxHarmonyEnabled.UseVisualStyleBackColor = true;
   1.155 +            this.iCheckBoxHarmonyEnabled.CheckedChanged += new System.EventHandler(this.iCheckBoxHarmonyEnabled_CheckedChanged);
   1.156 +            // 
   1.157              // iTreeViewHarmony
   1.158              // 
   1.159              this.iTreeViewHarmony.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
   1.160              | System.Windows.Forms.AnchorStyles.Left) 
   1.161              | System.Windows.Forms.AnchorStyles.Right)));
   1.162 -            this.iTreeViewHarmony.Location = new System.Drawing.Point(84, 49);
   1.163 +            this.iTreeViewHarmony.Location = new System.Drawing.Point(87, 49);
   1.164              this.iTreeViewHarmony.Name = "iTreeViewHarmony";
   1.165 -            this.iTreeViewHarmony.Size = new System.Drawing.Size(662, 330);
   1.166 +            this.iTreeViewHarmony.Size = new System.Drawing.Size(659, 330);
   1.167              this.iTreeViewHarmony.TabIndex = 15;
   1.168              this.iTreeViewHarmony.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.iTreeViewHarmony_NodeMouseDoubleClick);
   1.169              // 
   1.170 -            // iButtonHarmonyConnect
   1.171 -            // 
   1.172 -            this.iButtonHarmonyConnect.Location = new System.Drawing.Point(3, 49);
   1.173 -            this.iButtonHarmonyConnect.Name = "iButtonHarmonyConnect";
   1.174 -            this.iButtonHarmonyConnect.Size = new System.Drawing.Size(75, 23);
   1.175 -            this.iButtonHarmonyConnect.TabIndex = 14;
   1.176 -            this.iButtonHarmonyConnect.Text = "Connect";
   1.177 -            this.iButtonHarmonyConnect.UseVisualStyleBackColor = true;
   1.178 -            this.iButtonHarmonyConnect.Click += new System.EventHandler(this.iButtonHarmonyConnect_Click);
   1.179 -            // 
   1.180              // label2
   1.181              // 
   1.182              this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
   1.183 @@ -972,11 +1025,12 @@
   1.184              // iTextBoxHarmonyHubAddress
   1.185              // 
   1.186              this.iTextBoxHarmonyHubAddress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
   1.187 +            this.iTextBoxHarmonyHubAddress.DataBindings.Add(new System.Windows.Forms.Binding("Text", global::SharpDisplayManager.Properties.Settings.Default, "HarmonyHubAddress", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
   1.188              this.iTextBoxHarmonyHubAddress.Location = new System.Drawing.Point(282, 23);
   1.189              this.iTextBoxHarmonyHubAddress.Name = "iTextBoxHarmonyHubAddress";
   1.190              this.iTextBoxHarmonyHubAddress.Size = new System.Drawing.Size(100, 20);
   1.191              this.iTextBoxHarmonyHubAddress.TabIndex = 8;
   1.192 -            this.iTextBoxHarmonyHubAddress.Text = "HarmonyHub";
   1.193 +            this.iTextBoxHarmonyHubAddress.Text = global::SharpDisplayManager.Properties.Settings.Default.HarmonyHubAddress;
   1.194              // 
   1.195              // tabPageEvent
   1.196              // 
   1.197 @@ -1135,6 +1189,32 @@
   1.198              this.tabPageApp.Text = "Application";
   1.199              this.tabPageApp.UseVisualStyleBackColor = true;
   1.200              // 
   1.201 +            // checkBoxStartMinimized
   1.202 +            // 
   1.203 +            this.checkBoxStartMinimized.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   1.204 +            this.checkBoxStartMinimized.AutoSize = true;
   1.205 +            this.checkBoxStartMinimized.Checked = global::SharpDisplayManager.Properties.Settings.Default.StartMinimized;
   1.206 +            this.checkBoxStartMinimized.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "StartMinimized", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
   1.207 +            this.checkBoxStartMinimized.Location = new System.Drawing.Point(6, 285);
   1.208 +            this.checkBoxStartMinimized.Name = "checkBoxStartMinimized";
   1.209 +            this.checkBoxStartMinimized.Size = new System.Drawing.Size(96, 17);
   1.210 +            this.checkBoxStartMinimized.TabIndex = 16;
   1.211 +            this.checkBoxStartMinimized.Text = "Start minimized";
   1.212 +            this.checkBoxStartMinimized.UseVisualStyleBackColor = true;
   1.213 +            // 
   1.214 +            // checkBoxMinimizeToTray
   1.215 +            // 
   1.216 +            this.checkBoxMinimizeToTray.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   1.217 +            this.checkBoxMinimizeToTray.AutoSize = true;
   1.218 +            this.checkBoxMinimizeToTray.Checked = global::SharpDisplayManager.Properties.Settings.Default.MinimizeToTray;
   1.219 +            this.checkBoxMinimizeToTray.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "MinimizeToTray", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
   1.220 +            this.checkBoxMinimizeToTray.Location = new System.Drawing.Point(6, 308);
   1.221 +            this.checkBoxMinimizeToTray.Name = "checkBoxMinimizeToTray";
   1.222 +            this.checkBoxMinimizeToTray.Size = new System.Drawing.Size(133, 17);
   1.223 +            this.checkBoxMinimizeToTray.TabIndex = 15;
   1.224 +            this.checkBoxMinimizeToTray.Text = "Minimize to system tray";
   1.225 +            this.checkBoxMinimizeToTray.UseVisualStyleBackColor = true;
   1.226 +            // 
   1.227              // checkBoxAutoStart
   1.228              // 
   1.229              this.checkBoxAutoStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   1.230 @@ -1218,84 +1298,6 @@
   1.231              // 
   1.232              this.openFileDialog.Filter = "EXE files (*.exe)|*.exe|All files (*.*)|*.*";
   1.233              // 
   1.234 -            // checkBoxConnectOnStartup
   1.235 -            // 
   1.236 -            this.checkBoxConnectOnStartup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   1.237 -            this.checkBoxConnectOnStartup.AutoSize = true;
   1.238 -            this.checkBoxConnectOnStartup.Checked = global::SharpDisplayManager.Properties.Settings.Default.DisplayConnectOnStartup;
   1.239 -            this.checkBoxConnectOnStartup.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "DisplayConnectOnStartup", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
   1.240 -            this.checkBoxConnectOnStartup.Location = new System.Drawing.Point(113, 350);
   1.241 -            this.checkBoxConnectOnStartup.Name = "checkBoxConnectOnStartup";
   1.242 -            this.checkBoxConnectOnStartup.Size = new System.Drawing.Size(119, 17);
   1.243 -            this.checkBoxConnectOnStartup.TabIndex = 13;
   1.244 -            this.checkBoxConnectOnStartup.Text = "Connect on stratup ";
   1.245 -            this.checkBoxConnectOnStartup.UseVisualStyleBackColor = true;
   1.246 -            // 
   1.247 -            // iCheckBoxStartIdleClient
   1.248 -            // 
   1.249 -            this.iCheckBoxStartIdleClient.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   1.250 -            this.iCheckBoxStartIdleClient.AutoSize = true;
   1.251 -            this.iCheckBoxStartIdleClient.Checked = global::SharpDisplayManager.Properties.Settings.Default.StartIdleClient;
   1.252 -            this.iCheckBoxStartIdleClient.CheckState = System.Windows.Forms.CheckState.Checked;
   1.253 -            this.iCheckBoxStartIdleClient.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "StartIdleClient", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
   1.254 -            this.iCheckBoxStartIdleClient.Location = new System.Drawing.Point(108, 340);
   1.255 -            this.iCheckBoxStartIdleClient.Name = "iCheckBoxStartIdleClient";
   1.256 -            this.iCheckBoxStartIdleClient.Size = new System.Drawing.Size(145, 17);
   1.257 -            this.iCheckBoxStartIdleClient.TabIndex = 22;
   1.258 -            this.iCheckBoxStartIdleClient.Text = "Start idle client on startup";
   1.259 -            this.iCheckBoxStartIdleClient.UseVisualStyleBackColor = true;
   1.260 -            // 
   1.261 -            // checkBoxCecEnabled
   1.262 -            // 
   1.263 -            this.checkBoxCecEnabled.AutoSize = true;
   1.264 -            this.checkBoxCecEnabled.Checked = global::SharpDisplayManager.Properties.Settings.Default.CecEnabled;
   1.265 -            this.checkBoxCecEnabled.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "CecEnabled", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
   1.266 -            this.checkBoxCecEnabled.Location = new System.Drawing.Point(6, 6);
   1.267 -            this.checkBoxCecEnabled.Name = "checkBoxCecEnabled";
   1.268 -            this.checkBoxCecEnabled.Size = new System.Drawing.Size(83, 17);
   1.269 -            this.checkBoxCecEnabled.TabIndex = 21;
   1.270 -            this.checkBoxCecEnabled.Text = "Enable CEC";
   1.271 -            this.checkBoxCecEnabled.UseVisualStyleBackColor = true;
   1.272 -            this.checkBoxCecEnabled.CheckedChanged += new System.EventHandler(this.checkBoxCecEnabled_CheckedChanged);
   1.273 -            // 
   1.274 -            // iCheckBoxHarmonyEnabled
   1.275 -            // 
   1.276 -            this.iCheckBoxHarmonyEnabled.AutoSize = true;
   1.277 -            this.iCheckBoxHarmonyEnabled.Checked = global::SharpDisplayManager.Properties.Settings.Default.HarmonyEnabled;
   1.278 -            this.iCheckBoxHarmonyEnabled.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "HarmonyEnabled", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
   1.279 -            this.iCheckBoxHarmonyEnabled.Location = new System.Drawing.Point(6, 6);
   1.280 -            this.iCheckBoxHarmonyEnabled.Name = "iCheckBoxHarmonyEnabled";
   1.281 -            this.iCheckBoxHarmonyEnabled.Size = new System.Drawing.Size(104, 17);
   1.282 -            this.iCheckBoxHarmonyEnabled.TabIndex = 22;
   1.283 -            this.iCheckBoxHarmonyEnabled.Text = "Enable Harmony";
   1.284 -            this.iCheckBoxHarmonyEnabled.UseVisualStyleBackColor = true;
   1.285 -            // 
   1.286 -            // checkBoxStartMinimized
   1.287 -            // 
   1.288 -            this.checkBoxStartMinimized.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   1.289 -            this.checkBoxStartMinimized.AutoSize = true;
   1.290 -            this.checkBoxStartMinimized.Checked = global::SharpDisplayManager.Properties.Settings.Default.StartMinimized;
   1.291 -            this.checkBoxStartMinimized.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "StartMinimized", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
   1.292 -            this.checkBoxStartMinimized.Location = new System.Drawing.Point(6, 285);
   1.293 -            this.checkBoxStartMinimized.Name = "checkBoxStartMinimized";
   1.294 -            this.checkBoxStartMinimized.Size = new System.Drawing.Size(96, 17);
   1.295 -            this.checkBoxStartMinimized.TabIndex = 16;
   1.296 -            this.checkBoxStartMinimized.Text = "Start minimized";
   1.297 -            this.checkBoxStartMinimized.UseVisualStyleBackColor = true;
   1.298 -            // 
   1.299 -            // checkBoxMinimizeToTray
   1.300 -            // 
   1.301 -            this.checkBoxMinimizeToTray.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   1.302 -            this.checkBoxMinimizeToTray.AutoSize = true;
   1.303 -            this.checkBoxMinimizeToTray.Checked = global::SharpDisplayManager.Properties.Settings.Default.MinimizeToTray;
   1.304 -            this.checkBoxMinimizeToTray.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::SharpDisplayManager.Properties.Settings.Default, "MinimizeToTray", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
   1.305 -            this.checkBoxMinimizeToTray.Location = new System.Drawing.Point(6, 308);
   1.306 -            this.checkBoxMinimizeToTray.Name = "checkBoxMinimizeToTray";
   1.307 -            this.checkBoxMinimizeToTray.Size = new System.Drawing.Size(133, 17);
   1.308 -            this.checkBoxMinimizeToTray.TabIndex = 15;
   1.309 -            this.checkBoxMinimizeToTray.Text = "Minimize to system tray";
   1.310 -            this.checkBoxMinimizeToTray.UseVisualStyleBackColor = true;
   1.311 -            // 
   1.312              // FormMain
   1.313              // 
   1.314              this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
   1.315 @@ -1409,7 +1411,7 @@
   1.316  		private System.Windows.Forms.Label labelDefaultAudioDevice;
   1.317  		private System.Windows.Forms.OpenFileDialog openFileDialog;
   1.318          private System.Windows.Forms.TabPage tabPageCec;
   1.319 -        private System.Windows.Forms.CheckBox checkBoxCecEnabled;
   1.320 +        private System.Windows.Forms.CheckBox iCheckBoxCecEnabled;
   1.321          private System.Windows.Forms.Label labelHdmiPort;
   1.322          private System.Windows.Forms.ComboBox comboBoxHdmiPort;
   1.323          private System.Windows.Forms.Button iButtonStartIdleClient;
   1.324 @@ -1438,7 +1440,6 @@
   1.325          private System.Windows.Forms.Button buttonEventEdit;
   1.326          private System.Windows.Forms.TabPage tabPageHarmony;
   1.327          private System.Windows.Forms.TreeView iTreeViewHarmony;
   1.328 -        private System.Windows.Forms.Button iButtonHarmonyConnect;
   1.329          private System.Windows.Forms.Label label2;
   1.330          private System.Windows.Forms.TextBox iTextBoxLogitechPassword;
   1.331          private System.Windows.Forms.Label labelLogitechUserName;
   1.332 @@ -1446,6 +1447,7 @@
   1.333          private System.Windows.Forms.Label label1;
   1.334          private System.Windows.Forms.TextBox iTextBoxHarmonyHubAddress;
   1.335          private System.Windows.Forms.CheckBox iCheckBoxHarmonyEnabled;
   1.336 +        private System.Windows.Forms.Button iButtonHarmonyConnect;
   1.337      }
   1.338  }
   1.339  
     2.1 --- a/Server/FormMain.cs	Sun Aug 21 19:31:08 2016 +0200
     2.2 +++ b/Server/FormMain.cs	Mon Aug 22 13:20:54 2016 +0200
     2.3 @@ -1201,7 +1201,7 @@
     2.4              checkBoxAutoStart.Checked = iStartupManager.Startup;
     2.5  
     2.6              //Harmony settings
     2.7 -            iTextBoxHarmonyHubAddress.Text = Properties.Settings.Default.HarmonyHubAddress;
     2.8 +            iButtonHarmonyConnect.Enabled = Properties.Settings.Default.HarmonyEnabled;
     2.9  
    2.10              //CEC settings
    2.11              comboBoxHdmiPort.SelectedIndex = Properties.Settings.Default.CecHdmiPort - 1;
    2.12 @@ -2525,7 +2525,7 @@
    2.13              base.WndProc(ref aMessage);
    2.14          }
    2.15  
    2.16 -        private void checkBoxCecEnabled_CheckedChanged(object sender, EventArgs e)
    2.17 +        private void iCheckBoxCecEnabled_CheckedChanged(object sender, EventArgs e)
    2.18          {
    2.19              //
    2.20              ResetCec();
    2.21 @@ -2566,20 +2566,19 @@
    2.22          /// <summary>
    2.23          /// 
    2.24          /// </summary>
    2.25 -        private async void ResetHarmony()
    2.26 +        private async void ResetHarmony(bool aForceAuth=false)
    2.27          {
    2.28              // ConnectAsync already if we have an existing session cookie
    2.29 -            if (Properties.Settings.Default.HarmonyEnabled && File.Exists("SessionToken"))
    2.30 +            if (Properties.Settings.Default.HarmonyEnabled)
    2.31              {
    2.32 -
    2.33 -                iButtonHarmonyConnect.Enabled = false;
    2.34                  try
    2.35                  {
    2.36 -                    await ConnectHarmonyAsync();
    2.37 +                    await ConnectHarmonyAsync(aForceAuth);
    2.38                  }
    2.39 -                finally
    2.40 +                catch (Exception ex)
    2.41                  {
    2.42 -                    iButtonHarmonyConnect.Enabled = true;
    2.43 +                    Console.WriteLine("Exception thrown by ConnectHarmonyAsync");
    2.44 +                    Console.WriteLine(ex.ToString());
    2.45                  }
    2.46              }
    2.47          }
    2.48 @@ -2587,6 +2586,28 @@
    2.49          /// <summary>
    2.50          /// 
    2.51          /// </summary>
    2.52 +        /// <param name="sender"></param>
    2.53 +        /// <param name="e"></param>
    2.54 +        private void iButtonHarmonyConnect_Click(object sender, EventArgs e)
    2.55 +        {
    2.56 +            // User is explicitaly trying to connect
    2.57 +            //Reset Harmony Hub connection forcing authentication
    2.58 +            ResetHarmony(true);
    2.59 +        }
    2.60 +
    2.61 +        /// <summary>
    2.62 +        /// 
    2.63 +        /// </summary>
    2.64 +        /// <param name="sender"></param>
    2.65 +        /// <param name="e"></param>
    2.66 +        private void iCheckBoxHarmonyEnabled_CheckedChanged(object sender, EventArgs e)
    2.67 +        {
    2.68 +            iButtonHarmonyConnect.Enabled = iCheckBoxHarmonyEnabled.Checked;
    2.69 +        }
    2.70 +
    2.71 +        /// <summary>
    2.72 +        /// 
    2.73 +        /// </summary>
    2.74          private void SetupCecLogLevel()
    2.75          {
    2.76              //Setup log level
    2.77 @@ -2975,31 +2996,8 @@
    2.78          /// <summary>
    2.79          /// 
    2.80          /// </summary>
    2.81 -        /// <param name="sender"></param>
    2.82 -        /// <param name="e"></param>
    2.83 -        private async void iButtonHarmonyConnect_Click(object sender, EventArgs e)
    2.84 -        {
    2.85 -            //Save hub address
    2.86 -            Properties.Settings.Default.HarmonyHubAddress = iTextBoxHarmonyHubAddress.Text;
    2.87 -            Properties.Settings.Default.Save();
    2.88 -
    2.89 -            iButtonHarmonyConnect.Enabled = false;
    2.90 -            try
    2.91 -            {
    2.92 -                await ConnectHarmonyAsync();
    2.93 -            }
    2.94 -            catch (Exception)
    2.95 -            {
    2.96 -                iButtonHarmonyConnect.Enabled = true;
    2.97 -            }
    2.98 -
    2.99 -        }
   2.100 -
   2.101 -        /// <summary>
   2.102 -        /// 
   2.103 -        /// </summary>
   2.104          /// <returns></returns>
   2.105 -        private async Task ConnectHarmonyAsync()
   2.106 +        private async Task ConnectHarmonyAsync(bool aForceAuth=false)
   2.107          {
   2.108              if (Program.HarmonyClient != null)
   2.109              {
   2.110 @@ -3013,7 +3011,7 @@
   2.111              Console.WriteLine("Harmony: Connecting... ");
   2.112              Program.HarmonyClient = new HarmonyHub.Client(iTextBoxHarmonyHubAddress.Text);
   2.113              //First create our client and login
   2.114 -            if (File.Exists("SessionToken"))
   2.115 +            if (File.Exists("SessionToken") && !aForceAuth)
   2.116              {
   2.117                  var sessionToken = File.ReadAllText("SessionToken");
   2.118                  Console.WriteLine("Harmony: Reusing token: {0}", sessionToken);
   2.119 @@ -3087,5 +3085,6 @@
   2.120                  await Program.HarmonyClient.SendCommandAsync(d.Id, f.Name);
   2.121              }
   2.122          }
   2.123 +
   2.124      }
   2.125  }