# HG changeset patch # User Stephane Lenclud # Date 1454881051 -3600 # Node ID c66ec88ed19d487d623f10e6c304591b5834f331 # Parent 0fb548a758494976000c9f92636219aac641d37e Published v0.8.8.0. Idle client now monitoring display power status so as to avoid going power saving when the monitor is still on. diff -r 0fb548a75849 -r c66ec88ed19d Clients/Idle/App.config --- a/Clients/Idle/App.config Sun Feb 07 13:29:05 2016 +0100 +++ b/Clients/Idle/App.config Sun Feb 07 22:37:31 2016 +0100 @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff -r 0fb548a75849 -r c66ec88ed19d Clients/Idle/FormClientIdle.cs --- a/Clients/Idle/FormClientIdle.cs Sun Feb 07 13:29:05 2016 +0100 +++ b/Clients/Idle/FormClientIdle.cs Sun Feb 07 22:37:31 2016 +0100 @@ -44,6 +44,9 @@ Client iClient; ContentAlignment iAlignment; TextField iTextField; + //Used to determine if screen saver need to kick in + private PowerManager.SettingNotifier iPowerSettingNotifier; + private bool MonitorPowerOn; public delegate void CloseDelegate(); public delegate void CloseConnectionDelegate(); @@ -75,9 +78,52 @@ //Timer iTimer.Interval = IntervalToNextMinute(); iTimer.Start(); + + //Create our power setting notifier and register the event we are interested in + iPowerSettingNotifier = new PowerManager.SettingNotifier(Handle); + iPowerSettingNotifier.OnMonitorPowerOn += OnMonitorPowerOn; + iPowerSettingNotifier.OnMonitorPowerOff += OnMonitorPowerOff; + MonitorPowerOn = true; + } /// + /// Broadcast messages to subscribers. + /// + /// + protected override void WndProc(ref Message aMessage) + { + //Hook in our power manager + if (iPowerSettingNotifier != null) + { + iPowerSettingNotifier.WndProc(ref aMessage); + } + + base.WndProc(ref aMessage); + } + + + + /// + /// + /// + private void OnMonitorPowerOn() + { + MonitorPowerOn = true; + UpdateDisplay(); + } + + /// + /// + /// + private void OnMonitorPowerOff() + { + MonitorPowerOn = false; + UpdateDisplay(); + } + + + /// /// /// /// @@ -190,6 +236,15 @@ iTimer.Interval = IntervalToNextMinute(); iTimer.Start(); + UpdateDisplay(); + + } + + /// + /// + /// + private void UpdateDisplay() + { // if (String.IsNullOrEmpty(iTextField.Text)) { @@ -206,7 +261,8 @@ iClient.SetField(iTextField); //Now make sure we save our screen from any running system monitor - if (String.IsNullOrEmpty(iTextField.Text)) + //We don't go into screen saving mode if our monitor is still on + if (String.IsNullOrEmpty(iTextField.Text) && !MonitorPowerOn) { //If text it empty it means we need to cool down our display even if system monitor is running iClient.SetPriority(Priorities.SystemMonitor + 1); @@ -218,6 +274,11 @@ } } + /// + /// + /// + /// + /// private void FormClientIdle_Shown(object sender, EventArgs e) { //Visible = false; diff -r 0fb548a75849 -r c66ec88ed19d Clients/Idle/Properties/Resources.Designer.cs --- a/Clients/Idle/Properties/Resources.Designer.cs Sun Feb 07 13:29:05 2016 +0100 +++ b/Clients/Idle/Properties/Resources.Designer.cs Sun Feb 07 22:37:31 2016 +0100 @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace SharpDisplayIdleClient.Properties -{ - - +namespace SharpDisplayIdleClient.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -22,48 +22,40 @@ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharpDisplayIdleClient.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff -r 0fb548a75849 -r c66ec88ed19d Clients/Idle/Properties/Settings.Designer.cs --- a/Clients/Idle/Properties/Settings.Designer.cs Sun Feb 07 13:29:05 2016 +0100 +++ b/Clients/Idle/Properties/Settings.Designer.cs Sun Feb 07 22:37:31 2016 +0100 @@ -8,21 +8,17 @@ // //------------------------------------------------------------------------------ -namespace SharpDisplayIdleClient.Properties -{ - - +namespace SharpDisplayIdleClient.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } diff -r 0fb548a75849 -r c66ec88ed19d Clients/Idle/SharpDisplayClientIdle.csproj --- a/Clients/Idle/SharpDisplayClientIdle.csproj Sun Feb 07 13:29:05 2016 +0100 +++ b/Clients/Idle/SharpDisplayClientIdle.csproj Sun Feb 07 22:37:31 2016 +0100 @@ -9,9 +9,10 @@ Properties SharpDisplayIdleClient SharpDisplayIdleClient - v4.5.2 + v4.6 512 true + AnyCPU @@ -81,6 +82,7 @@ True Resources.resx + True @@ -96,6 +98,12 @@ + + + {c174f23d-3055-49bc-b6b0-563011af624d} + PowerManager + +