Idle client screen saver now working.
authorStephaneLenclud
Wed, 03 Feb 2016 17:34:59 +0100
changeset 194b0c0aa5aea05
parent 193 317fdfa4fbb6
child 195 23229588ebd6
Idle client screen saver now working.
Clients/Idle/FormClientIdle.cs
Server/App.config
Server/MainForm.Designer.cs
Server/MainForm.cs
Server/Properties/Settings.Designer.cs
Server/Properties/Settings.settings
     1.1 --- a/Clients/Idle/FormClientIdle.cs	Wed Feb 03 16:04:37 2016 +0100
     1.2 +++ b/Clients/Idle/FormClientIdle.cs	Wed Feb 03 17:34:59 2016 +0100
     1.3 @@ -66,7 +66,7 @@
     1.4              iClient.CloseOrderEvent += OnCloseOrder;
     1.5              iClient.Open();
     1.6              iClient.SetName("Idle");
     1.7 -            iClient.SetPriority(SharpLib.Display.Priorities.Background);
     1.8 +            iClient.SetPriority(Priorities.Background);
     1.9              SetupDisplayClient();
    1.10  
    1.11              //Timer
    1.12 @@ -195,12 +195,24 @@
    1.13              }
    1.14              else
    1.15              {
    1.16 -                //Do some screen saving
    1.17 +                //Do some screen saving                
    1.18                  iTextField.Text = "";
    1.19              }
    1.20  
    1.21              // Update our field
    1.22              iClient.SetField(iTextField);
    1.23 +
    1.24 +            //Now make sure we save our screen from any running system monitor
    1.25 +            if (String.IsNullOrEmpty(iTextField.Text))
    1.26 +            {
    1.27 +                //If text it empty it means we need to cool down our display even if system monitor is running
    1.28 +                iClient.SetPriority(Priorities.SystemMonitor + 1);
    1.29 +            }
    1.30 +            else
    1.31 +            {
    1.32 +                //Switch back to background then, leaving system monitor if any doing its magic
    1.33 +                iClient.SetPriority(Priorities.Background);
    1.34 +            }
    1.35          }
    1.36  
    1.37          private void FormClientIdle_Shown(object sender, EventArgs e)
     2.1 --- a/Server/App.config	Wed Feb 03 16:04:37 2016 +0100
     2.2 +++ b/Server/App.config	Wed Feb 03 17:34:59 2016 +0100
     2.3 @@ -43,6 +43,9 @@
     2.4              <setting name="CecMonitorOff" serializeAs="String">
     2.5                  <value>True</value>
     2.6              </setting>
     2.7 +            <setting name="StartIdleClient" serializeAs="String">
     2.8 +                <value>True</value>
     2.9 +            </setting>
    2.10          </SharpDisplayManager.Properties.Settings>
    2.11      </userSettings>
    2.12  </configuration>
     3.1 --- a/Server/MainForm.Designer.cs	Wed Feb 03 16:04:37 2016 +0100
     3.2 +++ b/Server/MainForm.Designer.cs	Wed Feb 03 17:34:59 2016 +0100
     3.3 @@ -51,6 +51,8 @@
     3.4              this.toolStripStatusLabelPower = new System.Windows.Forms.ToolStripStatusLabel();
     3.5              this.toolStripStatusLabelFps = new System.Windows.Forms.ToolStripStatusLabel();
     3.6              this.tabPageClients = new System.Windows.Forms.TabPage();
     3.7 +            this.iCheckBoxStartIdleClient = new System.Windows.Forms.CheckBox();
     3.8 +            this.iButtonStartIdleClient = new System.Windows.Forms.Button();
     3.9              this.buttonCloseClients = new System.Windows.Forms.Button();
    3.10              this.buttonStartClient = new System.Windows.Forms.Button();
    3.11              this.iTreeViewClients = new System.Windows.Forms.TreeView();
    3.12 @@ -111,7 +113,6 @@
    3.13              this.labelFontHeight = new System.Windows.Forms.Label();
    3.14              this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    3.15              this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    3.16 -            this.iButtonStartIdleClient = new System.Windows.Forms.Button();
    3.17              this.panelDisplay.SuspendLayout();
    3.18              this.iTableLayoutPanel.SuspendLayout();
    3.19              this.statusStrip.SuspendLayout();
    3.20 @@ -245,6 +246,7 @@
    3.21              // 
    3.22              // tabPageClients
    3.23              // 
    3.24 +            this.tabPageClients.Controls.Add(this.iCheckBoxStartIdleClient);
    3.25              this.tabPageClients.Controls.Add(this.iButtonStartIdleClient);
    3.26              this.tabPageClients.Controls.Add(this.buttonCloseClients);
    3.27              this.tabPageClients.Controls.Add(this.buttonStartClient);
    3.28 @@ -257,6 +259,27 @@
    3.29              this.tabPageClients.Text = "Clients";
    3.30              this.tabPageClients.UseVisualStyleBackColor = true;
    3.31              // 
    3.32 +            // iCheckBoxStartIdleClient
    3.33 +            // 
    3.34 +            this.iCheckBoxStartIdleClient.AutoSize = true;
    3.35 +            this.iCheckBoxStartIdleClient.Location = new System.Drawing.Point(108, 217);
    3.36 +            this.iCheckBoxStartIdleClient.Name = "iCheckBoxStartIdleClient";
    3.37 +            this.iCheckBoxStartIdleClient.Size = new System.Drawing.Size(145, 17);
    3.38 +            this.iCheckBoxStartIdleClient.TabIndex = 22;
    3.39 +            this.iCheckBoxStartIdleClient.Text = "Start idle client on startup";
    3.40 +            this.iCheckBoxStartIdleClient.UseVisualStyleBackColor = true;
    3.41 +            this.iCheckBoxStartIdleClient.CheckedChanged += new System.EventHandler(this.checkBoxStartIdleClient_CheckedChanged);
    3.42 +            // 
    3.43 +            // iButtonStartIdleClient
    3.44 +            // 
    3.45 +            this.iButtonStartIdleClient.Location = new System.Drawing.Point(6, 35);
    3.46 +            this.iButtonStartIdleClient.Name = "iButtonStartIdleClient";
    3.47 +            this.iButtonStartIdleClient.Size = new System.Drawing.Size(96, 23);
    3.48 +            this.iButtonStartIdleClient.TabIndex = 21;
    3.49 +            this.iButtonStartIdleClient.Text = "Start Idle Client";
    3.50 +            this.iButtonStartIdleClient.UseVisualStyleBackColor = true;
    3.51 +            this.iButtonStartIdleClient.Click += new System.EventHandler(this.ButtonStartIdleClient_Click);
    3.52 +            // 
    3.53              // buttonCloseClients
    3.54              // 
    3.55              this.buttonCloseClients.Location = new System.Drawing.Point(6, 213);
    3.56 @@ -273,7 +296,7 @@
    3.57              this.buttonStartClient.Name = "buttonStartClient";
    3.58              this.buttonStartClient.Size = new System.Drawing.Size(96, 23);
    3.59              this.buttonStartClient.TabIndex = 19;
    3.60 -            this.buttonStartClient.Text = "Start Client";
    3.61 +            this.buttonStartClient.Text = "Start Test Client";
    3.62              this.buttonStartClient.UseVisualStyleBackColor = true;
    3.63              this.buttonStartClient.Click += new System.EventHandler(this.buttonStartClient_Click);
    3.64              // 
    3.65 @@ -284,7 +307,7 @@
    3.66              | System.Windows.Forms.AnchorStyles.Right)));
    3.67              this.iTreeViewClients.Location = new System.Drawing.Point(108, 6);
    3.68              this.iTreeViewClients.Name = "iTreeViewClients";
    3.69 -            this.iTreeViewClients.Size = new System.Drawing.Size(478, 233);
    3.70 +            this.iTreeViewClients.Size = new System.Drawing.Size(478, 205);
    3.71              this.iTreeViewClients.TabIndex = 0;
    3.72              this.iTreeViewClients.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViewClients_AfterSelect);
    3.73              // 
    3.74 @@ -935,16 +958,6 @@
    3.75              // 
    3.76              this.openFileDialog.Filter = "EXE files (*.exe)|*.exe|All files (*.*)|*.*";
    3.77              // 
    3.78 -            // iButtonStartIdleClient
    3.79 -            // 
    3.80 -            this.iButtonStartIdleClient.Location = new System.Drawing.Point(6, 35);
    3.81 -            this.iButtonStartIdleClient.Name = "iButtonStartIdleClient";
    3.82 -            this.iButtonStartIdleClient.Size = new System.Drawing.Size(96, 23);
    3.83 -            this.iButtonStartIdleClient.TabIndex = 21;
    3.84 -            this.iButtonStartIdleClient.Text = "Start Idle Client";
    3.85 -            this.iButtonStartIdleClient.UseVisualStyleBackColor = true;
    3.86 -            this.iButtonStartIdleClient.Click += new System.EventHandler(this.ButtonStartIdleClient_Click);
    3.87 -            // 
    3.88              // MainForm
    3.89              // 
    3.90              this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    3.91 @@ -970,6 +983,7 @@
    3.92              this.statusStrip.ResumeLayout(false);
    3.93              this.statusStrip.PerformLayout();
    3.94              this.tabPageClients.ResumeLayout(false);
    3.95 +            this.tabPageClients.PerformLayout();
    3.96              this.tabPageDisplay.ResumeLayout(false);
    3.97              this.tabPageDisplay.PerformLayout();
    3.98              ((System.ComponentModel.ISupportInitialize)(this.trackBarBrightness)).EndInit();
    3.99 @@ -1066,6 +1080,7 @@
   3.100          private System.Windows.Forms.CheckBox checkBoxCecMonitorOn;
   3.101          private System.Windows.Forms.CheckBox checkBoxCecMonitorOff;
   3.102          private System.Windows.Forms.Button iButtonStartIdleClient;
   3.103 +        private System.Windows.Forms.CheckBox iCheckBoxStartIdleClient;
   3.104      }
   3.105  }
   3.106  
     4.1 --- a/Server/MainForm.cs	Wed Feb 03 16:04:37 2016 +0100
     4.2 +++ b/Server/MainForm.cs	Wed Feb 03 17:34:59 2016 +0100
     4.3 @@ -111,7 +111,7 @@
     4.4  		private SharpLib.Notification.Control iNotifyIcon;
     4.5  
     4.6          /// <summary>
     4.7 -        /// System recording notifcation icon.
     4.8 +        /// System recording notification icon.
     4.9          /// </summary>
    4.10          private SharpLib.Notification.Control iRecordingNotification;
    4.11  
    4.12 @@ -229,6 +229,12 @@
    4.13  
    4.14  			//Register for HID events
    4.15  			RegisterHidDevices();
    4.16 +
    4.17 +            //Start Idle client if needed
    4.18 +            if (Properties.Settings.Default.StartIdleClient)
    4.19 +            {
    4.20 +                StartIdleClient();
    4.21 +            }
    4.22          }
    4.23  
    4.24  		/// <summary>
    4.25 @@ -1100,7 +1106,9 @@
    4.26              checkBoxConnectOnStartup.Checked = Properties.Settings.Default.DisplayConnectOnStartup;
    4.27  			checkBoxMinimizeToTray.Checked = Properties.Settings.Default.MinimizeToTray;
    4.28  			checkBoxStartMinimized.Checked = Properties.Settings.Default.StartMinimized;
    4.29 -			labelStartFileName.Text = Properties.Settings.Default.StartFileName;
    4.30 +            iCheckBoxStartIdleClient.Checked = Properties.Settings.Default.StartIdleClient;
    4.31 +            labelStartFileName.Text = Properties.Settings.Default.StartFileName;
    4.32 +
    4.33  
    4.34              //Try find our drive in our drive list
    4.35              int opticalDriveItemIndex=0;
    4.36 @@ -1292,7 +1300,13 @@
    4.37  			Properties.Settings.Default.Save();
    4.38  		}
    4.39  
    4.40 -		private void checkBoxAutoStart_CheckedChanged(object sender, EventArgs e)
    4.41 +        private void checkBoxStartIdleClient_CheckedChanged(object sender, EventArgs e)
    4.42 +        {
    4.43 +            Properties.Settings.Default.StartIdleClient = iCheckBoxStartIdleClient.Checked;
    4.44 +            Properties.Settings.Default.Save();
    4.45 +        }
    4.46 +
    4.47 +        private void checkBoxAutoStart_CheckedChanged(object sender, EventArgs e)
    4.48  		{
    4.49  			iStartupManager.Startup = checkBoxAutoStart.Checked;
    4.50  		}
     5.1 --- a/Server/Properties/Settings.Designer.cs	Wed Feb 03 16:04:37 2016 +0100
     5.2 +++ b/Server/Properties/Settings.Designer.cs	Wed Feb 03 17:34:59 2016 +0100
     5.3 @@ -165,5 +165,17 @@
     5.4                  this["CecMonitorOff"] = value;
     5.5              }
     5.6          }
     5.7 +        
     5.8 +        [global::System.Configuration.UserScopedSettingAttribute()]
     5.9 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    5.10 +        [global::System.Configuration.DefaultSettingValueAttribute("True")]
    5.11 +        public bool StartIdleClient {
    5.12 +            get {
    5.13 +                return ((bool)(this["StartIdleClient"]));
    5.14 +            }
    5.15 +            set {
    5.16 +                this["StartIdleClient"] = value;
    5.17 +            }
    5.18 +        }
    5.19      }
    5.20  }
     6.1 --- a/Server/Properties/Settings.settings	Wed Feb 03 16:04:37 2016 +0100
     6.2 +++ b/Server/Properties/Settings.settings	Wed Feb 03 17:34:59 2016 +0100
     6.3 @@ -38,5 +38,8 @@
     6.4      <Setting Name="CecMonitorOff" Type="System.Boolean" Scope="User">
     6.5        <Value Profile="(Default)">True</Value>
     6.6      </Setting>
     6.7 +    <Setting Name="StartIdleClient" Type="System.Boolean" Scope="User">
     6.8 +      <Value Profile="(Default)">True</Value>
     6.9 +    </Setting>
    6.10    </Settings>
    6.11  </SettingsFile>
    6.12 \ No newline at end of file