From: <mic...@us...> - 2012-02-17 15:41:36
|
Revision: 4454 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4454&view=rev Author: michael-t Date: 2012-02-17 15:41:22 +0000 (Fri, 17 Feb 2012) Log Message: ----------- Version 1.2.6.0 (beta) Modified Paths: -------------- trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/PowerScheduler++.xmp2 trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/update.xml trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ActiveNetworkStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.Designer.cs trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.cs trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.resx trunk/plugins/PowerScheduler++/Test/1.2.6.0/VersionInfo.cs trunk/plugins/PowerScheduler++/Test/1.2.6.0/mediaportal/PowerSchedulerClientPlugin/Handlers/ActiveNetworkStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/1.2.6.0/mediaportal/PowerSchedulerClientPlugin/PowerScheduler.cs trunk/plugins/PowerScheduler++/Test/1.2.6.0/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSchedulerSetup.Designer.cs trunk/plugins/PowerScheduler++/Test/1.2.6.0/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSchedulerSetup.cs trunk/plugins/PowerScheduler++/Test/1.2.6.0/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSchedulerSetup.resx Added Paths: ----------- trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/PowerScheduler++ 1.2.6.0.mpe1 Removed Paths: ------------- trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/PowerScheduler++ 1.2.5.12.mpe1 Deleted: trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/PowerScheduler++ 1.2.5.12.mpe1 =================================================================== (Binary files differ) Copied: trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/PowerScheduler++ 1.2.6.0.mpe1 (from rev 4453, trunk/plugins/PowerScheduler++/Test/new/MPEI/PowerScheduler++ 1.2.6.0.mpe1) =================================================================== (Binary files differ) Modified: trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/PowerScheduler++.xmp2 =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/PowerScheduler++.xmp2 2012-02-16 17:06:59 UTC (rev 4453) +++ trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/PowerScheduler++.xmp2 2012-02-17 15:41:22 UTC (rev 4454) @@ -482,12 +482,12 @@ </MinVersion> <MaxVersion> <Major>1</Major> - <Minor>2</Minor> - <Build>5</Build> - <Revision>0</Revision> + <Minor>3</Minor> + <Build>0</Build> + <Revision>99999</Revision> </MaxVersion> <WarnOnly>true</WarnOnly> - <Message>For MediaPortal release 1.2.x (not compatible with 1.1.x releases)</Message> + <Message>For MediaPortal release 1.2.x and 1.3.x (not compatible with 1.1.x releases)</Message> <Name>PowerScheduler++</Name> </DependencyItem> <DependencyItem> @@ -524,16 +524,14 @@ <Version> <Major>1</Major> <Minor>2</Minor> - <Build>5</Build> - <Revision>12</Revision> + <Build>6</Build> + <Revision>0</Revision> </Version> <ExtensionDescription>The PowerScheduler++ plugin is a replacement for the PowerScheduler plugin that comes as part of MediaPortal. Compared to the original PowerScheduler plugin it provides additional features (easier configuration, reboot option, ...) and configurable support for "away mode" on Vista and Win7 systems.</ExtensionDescription> - <VersionDescription>Version 1.2.5.12 - Alpha / experimental version for MP 1.2.x - -- Bugfix: No sudden suspend after client is started</VersionDescription> - <DevelopmentStatus>Alpha</DevelopmentStatus> + <VersionDescription>Version 1.2.6.0 - Beta version for MP 1.2.x and 1.3.x</VersionDescription> + <DevelopmentStatus>Beta</DevelopmentStatus> <OnlineLocation>http://www.team-mediaportal.com/index.php?option=com_mtree&task=att_download&link_id=87&cf_id=40</OnlineLocation> - <ReleaseDate>2012-01-27T16:03:54</ReleaseDate> + <ReleaseDate>2012-01-29T16:03:54</ReleaseDate> <Tags>tv server plugins, automation</Tags> <Location>..\MPEI\[Name] [Version].mpe1</Location> <Params> @@ -616,14 +614,14 @@ <Param1 /> <UpdateOption>OverwriteIfOlder</UpdateOption> <LocalFileName>PowerScheduler_high.png</LocalFileName> - <ZipFileName>Installer{CopyFile}\{e6303b5e-f675-44fb-8d06-8d5fa3b6bcee}-PowerScheduler_high.png</ZipFileName> + <ZipFileName>Installer{CopyFile}\{fa2ede5d-3194-44b3-aee9-d1c15d3afbce}-PowerScheduler_high.png</ZipFileName> <DestinationFilename /> </FileItem> <FileItem InstallType="CopyFile" SystemFile="true" Modified="true"> <Param1 /> <UpdateOption>OverwriteIfOlder</UpdateOption> <LocalFileName>..\mediaportal\PowerSchedulerClientPlugin\PowerScheduler.gif</LocalFileName> - <ZipFileName>Installer{CopyFile}\{09df5c74-9759-4525-b00d-0be0ae237295}-PowerScheduler.gif</ZipFileName> + <ZipFileName>Installer{CopyFile}\{bbb5447e-7524-4a9f-b516-cba334470cbc}-PowerScheduler.gif</ZipFileName> <DestinationFilename /> </FileItem> </Items> Modified: trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/update.xml =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/update.xml 2012-02-16 17:06:59 UTC (rev 4453) +++ trunk/plugins/PowerScheduler++/Test/1.2.6.0/MPEI/update.xml 2012-02-17 15:41:22 UTC (rev 4454) @@ -144,5 +144,146 @@ </ProjectSettings> <IsSkin>false</IsSkin> </PackageClass> + <PackageClass> + <Version>2.0</Version> + <Groups> + <Items> + <GroupItem Name="Server files"> + <DisplayName>Server files</DisplayName> + <DefaulChecked>true</DefaulChecked> + <Description>Server files</Description> + <Files> + <Items /> + </Files> + </GroupItem> + <GroupItem Name="Client files"> + <DisplayName>Client files</DisplayName> + <DefaulChecked>true</DefaulChecked> + <Description>Client files</Description> + <Files> + <Items /> + </Files> + </GroupItem> + <GroupItem Name="Original Files"> + <DisplayName>Original Files</DisplayName> + <DefaulChecked>true</DefaulChecked> + <Description>Original Files</Description> + <Files> + <Items /> + </Files> + </GroupItem> + <GroupItem Name="Never"> + <DisplayName>Never</DisplayName> + <DefaulChecked>true</DefaulChecked> + <Description>Never</Description> + <Files> + <Items /> + </Files> + </GroupItem> + </Items> + </Groups> + <Sections> + <Items /> + </Sections> + <Dependencies> + <Items> + <DependencyItem> + <Type>Installer</Type> + <Id /> + <MinVersion> + <Major>1</Major> + <Minor>1</Minor> + <Build>6</Build> + <Revision>27644</Revision> + </MinVersion> + <MaxVersion> + <Major>1</Major> + <Minor>3</Minor> + <Build>0</Build> + <Revision>99999</Revision> + </MaxVersion> + <WarnOnly>true</WarnOnly> + <Message>For MediaPortal release 1.2.x and 1.3.x (not compatible with 1.1.x releases)</Message> + <Name>PowerScheduler++</Name> + </DependencyItem> + <DependencyItem> + <Type>MediaPortal</Type> + <Id /> + <MinVersion> + <Major>1</Major> + <Minor>1</Minor> + <Build>6</Build> + <Revision>27644</Revision> + </MinVersion> + <MaxVersion> + <Major>1</Major> + <Minor>1</Minor> + <Build>6</Build> + <Revision>27644</Revision> + </MaxVersion> + <WarnOnly>false</WarnOnly> + <Message>For MediaPortal release 1.2.x (not compatible with 1.1.x releases)</Message> + <Name>PowerScheduler++</Name> + </DependencyItem> + </Items> + </Dependencies> + <PluginDependencies> + <Items /> + </PluginDependencies> + <GeneralInfo> + <Name>PowerScheduler++</Name> + <Id>9b9bc24e-69ca-4abc-8810-f8f95bd4bbe6</Id> + <Author>michael_t (based on PowerScheduler by micheloe)</Author> + <HomePage>http://www.team-mediaportal.com/extensions/other/powerscheduler</HomePage> + <ForumPage>http://forum.team-mediaportal.com/tv-server-plugins-294/powerscheduler-test-version-1-2-5-0-mediaportal-1-2-x-1-3-alpha-87446/</ForumPage> + <UpdateUrl>http://www.team-mediaportal.com/index.php?option=com_mtree&task=att_download&link_id=87&cf_id=49</UpdateUrl> + <Version> + <Major>1</Major> + <Minor>2</Minor> + <Build>6</Build> + <Revision>0</Revision> + </Version> + <ExtensionDescription>The PowerScheduler++ plugin is a replacement for the PowerScheduler plugin that comes as part of MediaPortal. Compared to the original PowerScheduler plugin it provides additional features (easier configuration, reboot option, ...) and configurable support for "away mode" on Vista and Win7 systems.</ExtensionDescription> + <VersionDescription>Version 1.2.6.0 - Beta version for MP 1.2.x and 1.3.x</VersionDescription> + <DevelopmentStatus>Beta</DevelopmentStatus> + <OnlineLocation>http://www.team-mediaportal.com/index.php?option=com_mtree&task=att_download&link_id=87&cf_id=40</OnlineLocation> + <ReleaseDate>2012-01-29T16:03:54</ReleaseDate> + <Tags>tv server plugins, automation</Tags> + <Location>..\MPEI\[Name] [Version].mpe1</Location> + <Params> + <Items> + <SectionParam Name="Online Icon"> + <Value>http://www.team-mediaportal.com/components/com_mtree/img/listings/m/471.gif</Value> + <ValueType>String</ValueType> + <Description>The icon file of the package stored online (jpg,png,bmp)</Description> + </SectionParam> + <SectionParam Name="Configuration file"> + <Value>%TvServerBase%\SetupTv.exe</Value> + <ValueType>Template</ValueType> + <Description>The file used to configure the extension. + If have .exe extension the will be executed + If have .dll extension used like MP plugin configuration</Description> + </SectionParam> + <SectionParam Name="Online Screenshots"> + <Value /> + <ValueType>String</ValueType> + <Description>Online stored screenshot urls separated by ; </Description> + </SectionParam> + <SectionParam Name="Force to uninstall on update"> + <Value>YES</Value> + <ValueType>Bool</ValueType> + <Description>Show dialog and force to uninstall previous version when updating an extension. Should only be disabled if you are using an NSIS/MSI installer.</Description> + </SectionParam> + </Items> + </Params> + </GeneralInfo> + <UniqueFileList> + <Items /> + </UniqueFileList> + <ProjectSettings> + <FolderGroups /> + </ProjectSettings> + <IsSkin>false</IsSkin> + </PackageClass> </Items> </ExtensionCollection> \ No newline at end of file Modified: trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ActiveNetworkStandbyHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ActiveNetworkStandbyHandler.cs 2012-02-16 17:06:59 UTC (rev 4453) +++ trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ActiveNetworkStandbyHandler.cs 2012-02-17 15:41:22 UTC (rev 4454) @@ -20,10 +20,7 @@ using System; using System.Collections; -using System.Collections.Generic; using System.Diagnostics; -using System.Threading; -using System.Timers; using TvDatabase; using TvEngine.PowerScheduler.Interfaces; using TvLibrary.Interfaces; @@ -39,13 +36,12 @@ { #region Variables - private PerformanceCounter dlCounter, ulCounter; // Performance counters to monitor download and upload speed. - private long dlValueOld, ulValueOld; // Download Upload counter value one second earlier, in bytes. - private DateTime lastSampleTime; + private PerformanceCounter _dlCounter, _ulCounter; // Performance counters to monitor download and upload speed. + private long _dlValueOld, _ulValueOld; // Download Upload counter value one second earlier, in bytes. + private DateTime _lastSampleTime = DateTime.Now; + private long _dlSpeed, _ulSpeed; // Download Upload peak values in KB/s + private string _name; // The name of the adapter. - internal long dlSpeedPeak, ulSpeedPeak; // Download Upload peak values in KB/s - internal string name; // The name of the adapter. - #endregion #region Private methods @@ -55,54 +51,55 @@ /// </summary> internal NetworkAdapter(string name) { - this.name = name; + _name = name; // Create performance counters for the adapter. - dlCounter = new PerformanceCounter("Network Interface", "Bytes Received/sec", this.name); - ulCounter = new PerformanceCounter("Network Interface", "Bytes Sent/sec", this.name); + _dlCounter = new PerformanceCounter("Network Interface", "Bytes Received/sec", this._name); + _ulCounter = new PerformanceCounter("Network Interface", "Bytes Sent/sec", this._name); // Since dlValueOld and ulValueOld are used in method update() to calculate network speed, // they must have be initialized. - lastSampleTime = DateTime.Now; - dlValueOld = dlCounter.NextSample().RawValue; - ulValueOld = ulCounter.NextSample().RawValue; - - // Clear peak values - dlSpeedPeak = 0; - ulSpeedPeak = 0; + _dlValueOld = _dlCounter.NextSample().RawValue; + _ulValueOld = _ulCounter.NextSample().RawValue; } /// <summary> /// Obtain new sample from performance counters, and update the values saved in dlSpeed, ulSpeed, etc. /// This method is supposed to be called only in NetworkMonitorHandler, one time every second. /// </summary> - internal void update() + internal void Update() { DateTime thisSampleTime = DateTime.Now; + // Download Upload counter value in bytes. - long dlValue = dlCounter.NextSample().RawValue; - long ulValue = ulCounter.NextSample().RawValue; + long dlValue = _dlCounter.NextSample().RawValue; + long ulValue = _ulCounter.NextSample().RawValue; // Calculates download and upload speed. - double monitorInterval = thisSampleTime.Subtract(lastSampleTime).TotalSeconds; - lastSampleTime = thisSampleTime; - long dlSpeed = (long)((dlValue - dlValueOld) / monitorInterval); - long ulSpeed = (long)((ulValue - ulValueOld) / monitorInterval); + double monitorInterval = thisSampleTime.Subtract(_lastSampleTime).TotalSeconds; + _lastSampleTime = thisSampleTime; + _dlSpeed = (long)((dlValue - _dlValueOld) / monitorInterval / 1024); + _ulSpeed = (long)((ulValue - _ulValueOld) / monitorInterval / 1024); - dlValueOld = dlValue; - ulValueOld = ulValue; + _dlValueOld = dlValue; + _ulValueOld = ulValue; + } - if ((dlSpeed / 1024) > dlSpeedPeak) // Store peak values in KB/s - { - dlSpeedPeak = (dlSpeed / 1024); - } + internal string Name + { + get { return _name; } + } - if ((ulSpeed / 1024) > ulSpeedPeak) // Store peak values in KB/s - { - ulSpeedPeak = (ulSpeed / 1024); - } + internal long DlSpeed + { + get { return _dlSpeed; } } + internal long UlSpeed + { + get { return _ulSpeed; } + } + #endregion } @@ -111,19 +108,12 @@ /// </summary> public class ActiveNetworkStandbyHandler : IStandbyHandler, IStandbyHandlerEx { - #region Constants - - private const int MonitorInteval = 10; // seconds - - #endregion - #region Variables - private System.Timers.Timer timer; // The timer event executes every second to refresh the values in adapters. - private Int32 idleLimit; // Minimum transferrate considered as network activity in KB/s. + private Int32 _idleLimit; // Minimum transferrate considered as network activity in KB/s. - private ArrayList monitoredAdapters = new ArrayList(); // The list of monitored adapters on the computer. - private List<string> _preventers = new List<string>(); // The list of standby preventers. + private ArrayList _monitoredAdapters = new ArrayList(); // The list of monitored adapters on the computer. + private int _preventers = 0; /// <summary> /// Use away mode setting @@ -170,8 +160,7 @@ if (enabled) // Start { Log.Debug("NetworkMonitorHandler: Network monitor started"); - Thread netmonThr = new Thread(new ThreadStart(StartNetworkMonitor)); - netmonThr.Start(); + StartNetworkMonitor(); } else // Stop { @@ -184,13 +173,13 @@ if (enabled) { setting = ps.Settings.GetSetting("NetworkMonitorIdleLimit"); - idleLimit = Int32.Parse(layer.GetSetting("PowerSchedulerNetworkMonitorIdleLimit", "2").Value); - if (setting.Get<Int32>() != idleLimit) + _idleLimit = Int32.Parse(layer.GetSetting("PowerSchedulerNetworkMonitorIdleLimit", "2").Value); + if (setting.Get<Int32>() != _idleLimit) { - setting.Set<Int32>(idleLimit); - Log.Debug("NetworkMonitorHandler: Idle limit in KB/s: {0}", idleLimit); + setting.Set<Int32>(_idleLimit); + Log.Debug("NetworkMonitorHandler: Idle limit in KB/s: {0}", _idleLimit); + } } - } // Check if away mode should be used setting = ps.Settings.GetSetting("NetworkMonitorAwayMode"); @@ -209,7 +198,7 @@ { try { - monitoredAdapters.Clear(); + _monitoredAdapters.Clear(); PerformanceCounterCategory category = new PerformanceCounterCategory("Network Interface"); @@ -223,13 +212,8 @@ // Create an instance of NetworkAdapter class. NetworkAdapter adapter = new NetworkAdapter(name); - monitoredAdapters.Add(adapter); // Add it to monitored adapters + _monitoredAdapters.Add(adapter); // Add it to monitored adapters } - - // Create and enable the timer - timer = new System.Timers.Timer(MonitorInteval * 1000); - timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); - timer.Enabled = true; } catch (Exception ex) { @@ -240,27 +224,16 @@ // Disable the timer, and clear the monitoredAdapters list. private void StopNetworkMonitor() { - monitoredAdapters.Clear(); - timer.Enabled = false; + _monitoredAdapters.Clear(); } - // Timer elapsed - private void timer_Elapsed(object sender, ElapsedEventArgs e) - { - foreach (NetworkAdapter adapter in monitoredAdapters) - adapter.update(); - } - #endregion #region IStandbyHandler implementation public bool DisAllowShutdown { - get - { - return (StandbyMode != StandbyMode.StandbyAllowed); - } + get { return (StandbyMode != StandbyMode.StandbyAllowed); } } public void UserShutdownNow() {} @@ -278,24 +251,21 @@ { get { - _preventers.Clear(); + _preventers = 0; - foreach (NetworkAdapter adapter in monitoredAdapters) + foreach (NetworkAdapter adapter in _monitoredAdapters) { - if ((adapter.ulSpeedPeak >= idleLimit) || (adapter.dlSpeedPeak >= idleLimit)) + adapter.Update(); + if ((adapter.DlSpeed >= _idleLimit) || (adapter.UlSpeed >= _idleLimit)) { - // Log.Debug("NetworkMonitorHandler: standby prevented: {0}", adapter.name); - // Log.Debug("NetworkMonitorHandler: ulSpeed: {0}", adapter.ulSpeedPeak); - // Log.Debug("NetworkMonitorHandler: dlSpeed: {0}", adapter.dlSpeedPeak); - - adapter.ulSpeedPeak = 0; // Clear peak values - adapter.dlSpeedPeak = 0; - - _preventers.Add(adapter.name); // Add adapter to preventers + // Log.Debug("NetworkMonitorHandler: standby prevented: {0}", adapter.Name); + // Log.Debug("NetworkMonitorHandler: dlSpeed: {0}", adapter.DlSpeed); + // Log.Debug("NetworkMonitorHandler: ulSpeed: {0}", adapter.UlSpeed); + _preventers++; } } - if (_preventers.Count > 0) + if (_preventers > 0) { return _useAwayMode ? StandbyMode.AwayModeRequested : StandbyMode.StandbyPrevented; } Modified: trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.Designer.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.Designer.cs 2012-02-16 17:06:59 UTC (rev 4453) +++ trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.Designer.cs 2012-02-17 15:41:22 UTC (rev 4454) @@ -64,6 +64,7 @@ this.comboBoxProfile = new System.Windows.Forms.ComboBox(); this.buttonExpertMode = new System.Windows.Forms.Button(); this.numericUpDownIdleTimeout = new System.Windows.Forms.NumericUpDown(); + this.checkBoxHomeOnly = new System.Windows.Forms.CheckBox(); this.groupBoxProcesses = new System.Windows.Forms.GroupBox(); this.groupBoxEPG = new System.Windows.Forms.GroupBox(); this.flowLayoutPanelEPG = new System.Windows.Forms.FlowLayoutPanel(); @@ -120,13 +121,15 @@ this.tabPageEPG = new System.Windows.Forms.TabPage(); this.tabPageGeneral = new System.Windows.Forms.TabPage(); this.groupBoxGeneral = new System.Windows.Forms.GroupBox(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.flowLayoutPanelGeneral = new System.Windows.Forms.FlowLayoutPanel(); this.textBoxProfile = new System.Windows.Forms.TextBox(); this.flowLayoutPanelIdleTimeout = new System.Windows.Forms.FlowLayoutPanel(); this.labelIdleTimeout1 = new System.Windows.Forms.Label(); this.labelIdleTimeout2 = new System.Windows.Forms.Label(); this.labelExpertMode = new System.Windows.Forms.Label(); this.tabControl = new System.Windows.Forms.TabControl(); + this.tabPageClient = new System.Windows.Forms.TabPage(); + this.groupBoxClient = new System.Windows.Forms.GroupBox(); ((System.ComponentModel.ISupportInitialize)(this.dataGridShares)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownNetworkIdleLimit)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownIdleTimeout)).BeginInit(); @@ -151,9 +154,11 @@ this.tabPageEPG.SuspendLayout(); this.tabPageGeneral.SuspendLayout(); this.groupBoxGeneral.SuspendLayout(); - this.flowLayoutPanel1.SuspendLayout(); + this.flowLayoutPanelGeneral.SuspendLayout(); this.flowLayoutPanelIdleTimeout.SuspendLayout(); this.tabControl.SuspendLayout(); + this.tabPageClient.SuspendLayout(); + this.groupBoxClient.SuspendLayout(); this.SuspendLayout(); // // textBoxStandbyWakeupCommand @@ -277,8 +282,8 @@ this.checkBoxMPClientRunning.Name = "checkBoxMPClientRunning"; this.checkBoxMPClientRunning.Size = new System.Drawing.Size(309, 17); this.checkBoxMPClientRunning.TabIndex = 2; - this.checkBoxMPClientRunning.Text = "No automatic standby while MediaPortal client is not running"; - this.toolTip.SetToolTip(this.checkBoxMPClientRunning, "Prevents standby while doing administrative work\r\n(only recommended for a single-" + + this.checkBoxMPClientRunning.Text = "No standby after idle timeout while MediaPortal client is not running"; + this.toolTip.SetToolTip(this.checkBoxMPClientRunning, "Prevents standby after idle timeout while doing administrative work\r\n(only recommended for a single-" + "seat HTPC)."); this.checkBoxMPClientRunning.UseVisualStyleBackColor = true; this.checkBoxMPClientRunning.CheckedChanged += new System.EventHandler(this.checkBoxMPClientRunning_CheckedChanged); @@ -288,9 +293,9 @@ this.checkBoxProcessesAwayMode.AutoSize = true; this.checkBoxProcessesAwayMode.Location = new System.Drawing.Point(34, 77); this.checkBoxProcessesAwayMode.Name = "checkBoxProcessesAwayMode"; - this.checkBoxProcessesAwayMode.Size = new System.Drawing.Size(358, 17); + this.checkBoxProcessesAwayMode.Size = new System.Drawing.Size(372, 17); this.checkBoxProcessesAwayMode.TabIndex = 3; - this.checkBoxProcessesAwayMode.Text = "Disable power button while processes are running (enable away mode)"; + this.checkBoxProcessesAwayMode.Text = "No user standby while processes are running (enable away mode)"; this.toolTip.SetToolTip(this.checkBoxProcessesAwayMode, "Not even a \"Power Off\" or \"Remote Control Off\"causes the\r\nsystem to go to standby" + " while the selected processes are running.\r\n"); this.checkBoxProcessesAwayMode.UseVisualStyleBackColor = true; @@ -323,9 +328,9 @@ this.checkBoxEPGAwayMode.AutoSize = true; this.checkBoxEPGAwayMode.Location = new System.Drawing.Point(34, 175); this.checkBoxEPGAwayMode.Name = "checkBoxEPGAwayMode"; - this.checkBoxEPGAwayMode.Size = new System.Drawing.Size(320, 17); + this.checkBoxEPGAwayMode.Size = new System.Drawing.Size(334, 17); this.checkBoxEPGAwayMode.TabIndex = 6; - this.checkBoxEPGAwayMode.Text = "Disable power button while grabbing EPG (enable away mode)"; + this.checkBoxEPGAwayMode.Text = "No user standby while grabbing EPG (enable away mode)"; this.toolTip.SetToolTip(this.checkBoxEPGAwayMode, "Not even a \"Power Off\" or \"Remote Control Off\"causes the\r\nsystem to go to standby" + " until EPG grabbing is completed."); this.checkBoxEPGAwayMode.UseVisualStyleBackColor = true; @@ -348,7 +353,7 @@ this.checkBoxEPGPreventStandby.Name = "checkBoxEPGPreventStandby"; this.checkBoxEPGPreventStandby.Size = new System.Drawing.Size(225, 17); this.checkBoxEPGPreventStandby.TabIndex = 5; - this.checkBoxEPGPreventStandby.Text = "No automatic standby while grabbing EPG"; + this.checkBoxEPGPreventStandby.Text = "No standby after idle timeout while grabbing EPG"; this.toolTip.SetToolTip(this.checkBoxEPGPreventStandby, "The system will not go to standby until EPG grabbing is completed."); this.checkBoxEPGPreventStandby.UseVisualStyleBackColor = true; this.checkBoxEPGPreventStandby.CheckedChanged += new System.EventHandler(this.checkBoxEPGPreventStandby_CheckedChanged); @@ -358,9 +363,9 @@ this.checkBoxNetworkAwayMode.AutoSize = true; this.checkBoxNetworkAwayMode.Location = new System.Drawing.Point(34, 72); this.checkBoxNetworkAwayMode.Name = "checkBoxNetworkAwayMode"; - this.checkBoxNetworkAwayMode.Size = new System.Drawing.Size(334, 17); + this.checkBoxNetworkAwayMode.Size = new System.Drawing.Size(348, 17); this.checkBoxNetworkAwayMode.TabIndex = 3; - this.checkBoxNetworkAwayMode.Text = "Disable power button while network is active (enable away mode)"; + this.checkBoxNetworkAwayMode.Text = "No user standby while network is active (enable away mode)"; this.toolTip.SetToolTip(this.checkBoxNetworkAwayMode, "Not even a \"Power Off\" or \"Remote Control Off\"causes the\r\nsystem to go to standby" + " while the network is active.\r\n"); this.checkBoxNetworkAwayMode.UseVisualStyleBackColor = true; @@ -371,9 +376,9 @@ this.checkBoxSharesAwayMode.AutoSize = true; this.checkBoxSharesAwayMode.Location = new System.Drawing.Point(34, 200); this.checkBoxSharesAwayMode.Name = "checkBoxSharesAwayMode"; - this.checkBoxSharesAwayMode.Size = new System.Drawing.Size(335, 17); + this.checkBoxSharesAwayMode.Size = new System.Drawing.Size(349, 17); this.checkBoxSharesAwayMode.TabIndex = 4; - this.checkBoxSharesAwayMode.Text = "Disable power button while shares are active (enable away mode)"; + this.checkBoxSharesAwayMode.Text = "No user standby while shares are active (enable away mode)"; this.toolTip.SetToolTip(this.checkBoxSharesAwayMode, "Not even a \"Power Off\" or \"Remote Control Off\"causes the\r\nsystem to go to standby" + " while the selected shares are active.\r\n"); this.checkBoxSharesAwayMode.UseVisualStyleBackColor = true; @@ -396,7 +401,6 @@ // this.comboBoxShutdownMode.Anchor = System.Windows.Forms.AnchorStyles.None; this.comboBoxShutdownMode.Enabled = false; - this.comboBoxShutdownMode.FormattingEnabled = true; this.comboBoxShutdownMode.Items.AddRange(new object[] { "(Hybrid) Sleep - S3", "Hibernate - S4", @@ -508,7 +512,7 @@ this.checkBoxNetworkEnabled.Name = "checkBoxNetworkEnabled"; this.checkBoxNetworkEnabled.Size = new System.Drawing.Size(239, 17); this.checkBoxNetworkEnabled.TabIndex = 0; - this.checkBoxNetworkEnabled.Text = "No automatic standby while network is active"; + this.checkBoxNetworkEnabled.Text = "No standby after idle timeout while network is active"; this.toolTip.SetToolTip(this.checkBoxNetworkEnabled, "The system will not go to standby while the network is active."); this.checkBoxNetworkEnabled.UseVisualStyleBackColor = true; this.checkBoxNetworkEnabled.CheckedChanged += new System.EventHandler(this.checkBoxNetworkEnabled_CheckedChanged); @@ -520,7 +524,7 @@ this.checkBoxSharesEnabled.Name = "checkBoxSharesEnabled"; this.checkBoxSharesEnabled.Size = new System.Drawing.Size(240, 17); this.checkBoxSharesEnabled.TabIndex = 0; - this.checkBoxSharesEnabled.Text = "No automatic standby while shares are active"; + this.checkBoxSharesEnabled.Text = "No standby after idle timeout while shares are active"; this.toolTip.SetToolTip(this.checkBoxSharesEnabled, "The system will not go to standby while the selected shares are active."); this.checkBoxSharesEnabled.UseVisualStyleBackColor = true; this.checkBoxSharesEnabled.CheckedChanged += new System.EventHandler(this.checkBoxSharesEnabled_CheckedChanged); @@ -529,7 +533,6 @@ // this.comboBoxProfile.Anchor = System.Windows.Forms.AnchorStyles.Left; this.comboBoxProfile.ForeColor = System.Drawing.SystemColors.WindowText; - this.comboBoxProfile.FormattingEnabled = true; this.comboBoxProfile.Items.AddRange(new object[] { "HTPC", "Desktop", @@ -571,6 +574,18 @@ this.numericUpDownIdleTimeout.ValueChanged += new System.EventHandler(this.numericUpDownIdleTimeout_ValueChanged); this.numericUpDownIdleTimeout.EnabledChanged += new System.EventHandler(this.numericUpDownIdleTimeout_EnabledChanged); // + // checkBoxHomeOnly + // + this.checkBoxHomeOnly.AutoSize = true; + this.checkBoxHomeOnly.Location = new System.Drawing.Point(12, 22); + this.checkBoxHomeOnly.Name = "checkBoxHomeOnly"; + this.checkBoxHomeOnly.Size = new System.Drawing.Size(226, 17); + this.checkBoxHomeOnly.TabIndex = 2; + this.checkBoxHomeOnly.Text = "Only allow standby when on home window"; + this.toolTip.SetToolTip(this.checkBoxHomeOnly, "Prevents standby while the MP client is not on home window"); + this.checkBoxHomeOnly.UseVisualStyleBackColor = true; + this.checkBoxHomeOnly.CheckedChanged += new System.EventHandler(this.buttonApply_Enable); + // // groupBoxProcesses // this.groupBoxProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -1210,7 +1225,7 @@ // this.groupBoxGeneral.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.groupBoxGeneral.Controls.Add(this.flowLayoutPanel1); + this.groupBoxGeneral.Controls.Add(this.flowLayoutPanelGeneral); this.groupBoxGeneral.Controls.Add(this.labelExpertMode); this.groupBoxGeneral.Controls.Add(this.buttonExpertMode); this.groupBoxGeneral.Location = new System.Drawing.Point(6, 6); @@ -1218,21 +1233,21 @@ this.groupBoxGeneral.Size = new System.Drawing.Size(464, 252); this.groupBoxGeneral.TabIndex = 0; this.groupBoxGeneral.TabStop = false; - this.groupBoxGeneral.Text = "Select profile"; + this.groupBoxGeneral.Text = "General settings"; // - // flowLayoutPanel1 + // flowLayoutPanelGeneral // - this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.flowLayoutPanelGeneral.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.flowLayoutPanel1.AutoSize = true; - this.flowLayoutPanel1.Controls.Add(this.textBoxProfile); - this.flowLayoutPanel1.Controls.Add(this.comboBoxProfile); - this.flowLayoutPanel1.Controls.Add(this.flowLayoutPanelIdleTimeout); - this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel1.Location = new System.Drawing.Point(9, 23); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(455, 158); - this.flowLayoutPanel1.TabIndex = 15; + this.flowLayoutPanelGeneral.AutoSize = true; + this.flowLayoutPanelGeneral.Controls.Add(this.textBoxProfile); + this.flowLayoutPanelGeneral.Controls.Add(this.comboBoxProfile); + this.flowLayoutPanelGeneral.Controls.Add(this.flowLayoutPanelIdleTimeout); + this.flowLayoutPanelGeneral.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanelGeneral.Location = new System.Drawing.Point(9, 23); + this.flowLayoutPanelGeneral.Name = "flowLayoutPanelGeneral"; + this.flowLayoutPanelGeneral.Size = new System.Drawing.Size(455, 158); + this.flowLayoutPanelGeneral.TabIndex = 15; // // textBoxProfile // @@ -1278,9 +1293,9 @@ this.labelIdleTimeout2.AutoSize = true; this.labelIdleTimeout2.Location = new System.Drawing.Point(126, 6); this.labelIdleTimeout2.Name = "labelIdleTimeout2"; - this.labelIdleTimeout2.Size = new System.Drawing.Size(43, 13); + this.labelIdleTimeout2.Size = new System.Drawing.Size(105, 13); this.labelIdleTimeout2.TabIndex = 12; - this.labelIdleTimeout2.Text = "minutes"; + this.labelIdleTimeout2.Text = "minutes (idle timeout)"; // // labelExpertMode // @@ -1301,6 +1316,7 @@ this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tabControl.Controls.Add(this.tabPageGeneral); + this.tabControl.Controls.Add(this.tabPageClient); this.tabControl.Controls.Add(this.tabPageEPG); this.tabControl.Controls.Add(this.tabPageReboot); this.tabControl.Controls.Add(this.tabPageProcesses); @@ -1314,7 +1330,31 @@ this.tabControl.ShowToolTips = true; this.tabControl.Size = new System.Drawing.Size(484, 290); this.tabControl.TabIndex = 1; + this.tabControl.Tag = ""; // + // tabPageClient + // + this.tabPageClient.Controls.Add(this.groupBoxClient); + this.tabPageClient.Location = new System.Drawing.Point(4, 22); + this.tabPageClient.Name = "tabPageClient"; + this.tabPageClient.Padding = new System.Windows.Forms.Padding(3); + this.tabPageClient.Size = new System.Drawing.Size(476, 264); + this.tabPageClient.TabIndex = 7; + this.tabPageClient.Text = "Client"; + this.tabPageClient.UseVisualStyleBackColor = true; + // + // groupBoxClient + // + this.groupBoxClient.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxClient.Controls.Add(this.checkBoxHomeOnly); + this.groupBoxClient.Location = new System.Drawing.Point(6, 7); + this.groupBoxClient.Name = "groupBoxClient"; + this.groupBoxClient.Size = new System.Drawing.Size(464, 250); + this.groupBoxClient.TabIndex = 1; + this.groupBoxClient.TabStop = false; + this.groupBoxClient.Text = "Client settings"; + // // PowerSchedulerSetup // this.Controls.Add(this.groupBoxStatus); @@ -1361,11 +1401,14 @@ this.tabPageGeneral.ResumeLayout(false); this.groupBoxGeneral.ResumeLayout(false); this.groupBoxGeneral.PerformLayout(); - this.flowLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.PerformLayout(); + this.flowLayoutPanelGeneral.ResumeLayout(false); + this.flowLayoutPanelGeneral.PerformLayout(); this.flowLayoutPanelIdleTimeout.ResumeLayout(false); this.flowLayoutPanelIdleTimeout.PerformLayout(); this.tabControl.ResumeLayout(false); + this.tabPageClient.ResumeLayout(false); + this.groupBoxClient.ResumeLayout(false); + this.groupBoxClient.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -1464,7 +1507,10 @@ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelReboot; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelNetworkIdleLimit; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelIdleTimeout; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelGeneral; + private System.Windows.Forms.TabPage tabPageClient; + private System.Windows.Forms.GroupBox groupBoxClient; + private System.Windows.Forms.CheckBox checkBoxHomeOnly; } } \ No newline at end of file Modified: trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.cs 2012-02-16 17:06:59 UTC (rev 4453) +++ trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.cs 2012-02-17 15:41:22 UTC (rev 4454) @@ -60,7 +60,7 @@ #endif #if CLIENT private Settings _settings; - private bool _singleSeat = true; + private bool _singleSeat; #endif private const bool AC = true; @@ -132,12 +132,15 @@ public PowerSchedulerSetup() { InitializeComponent(); - #if SERVER _layer = new TvBusinessLayer(); + // Add server profile, no Client tab + textBoxProfile.Text += + "\r\nServer: Dedicated server without GUI provides TV and recording services"; comboBoxProfile.Items.Add("Server"); + tabControl.Controls.Remove(tabPageClient); #endif #if CLIENT @@ -159,10 +162,10 @@ // For Windows XP change away mode label texts if (Environment.OSVersion.Version.Major < 6) { - checkBoxEPGAwayMode.Text = "Disable power button while grabbing EPG"; - checkBoxProcessesAwayMode.Text = "Disable power button while processes are running"; - checkBoxNetworkAwayMode.Text = "Disable power button while network is active"; - checkBoxSharesAwayMode.Text = "Disable power button while shares are active"; + checkBoxEPGAwayMode.Text = "No user standby while grabbing EPG"; + checkBoxProcessesAwayMode.Text = "No user standby while processes are running"; + checkBoxNetworkAwayMode.Text = "No user standby while network is active"; + checkBoxSharesAwayMode.Text = "No user standby while shares are active"; } #if SERVER @@ -185,6 +188,8 @@ #else private void LoadSettings() { + buttonApply.Enabled = false; + using (_settings = new MPSettings()) { // Detect singleseat/multiseat @@ -198,6 +203,7 @@ if (hostName != String.Empty && PowerManager.IsLocal(hostName)) { _singleSeat = true; + Text = "PowerScheduler++ Client Plugin (TV-Server on local system)"; } else if (hostName == String.Empty) { @@ -219,11 +225,19 @@ if (_singleSeat) { - Hide(); - this.Shown += new System.EventHandler(this.PowerSchedulerSetup_Shown); - MessageBox.Show("Standby / wakeup settings have to be made in TV-Server Configuration", - "PowerScheduler++ Client Plugin (TV-Server on local system)", - MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); + textBoxProfile.Text = "Standby / wakeup settings have to be made in the TV-Server Configuration"; + comboBoxProfile.Visible = false; + flowLayoutPanelIdleTimeout.Visible = false; + buttonExpertMode.Visible = false; + labelExpertMode.Visible = false; + + tabControl.Controls.Remove(tabPageReboot); + tabControl.Controls.Remove(tabPageProcesses); + tabControl.Controls.Remove(tabPageNetwork); + tabControl.Controls.Remove(tabPageShares); + tabControl.Controls.Remove(tabPageAdvanced); + + checkBoxHomeOnly.Checked = Convert.ToBoolean(GetSetting("HomeOnly", "false")); return; } @@ -245,14 +259,16 @@ int idleTimeout = Convert.ToInt32(GetSetting("IdleTimeout", "-1")); if (idleTimeout == -1) - idleTimeout = (int)(PowerManager.RunningOnAC ? _recommendedSettingsAC.idleTimeout : _recommendedSettingsDC.idleTimeout); + { + idleTimeout = (int)(PowerManager.RunningOnAC ? _defaultSettingsDesktopAC.idleTimeout : _defaultSettingsDesktopDC.idleTimeout); + buttonApplyEnabled = true; + } numericUpDownIdleTimeout.Value = idleTimeout; labelExpertMode.Text = Convert.ToBoolean(GetSetting("ExpertMode", "false")) ? "Expert Mode" : "Plug&&Play Mode"; if (labelExpertMode.Text == "Expert Mode") { comboBoxProfile.ForeColor = SystemColors.GrayText; - buttonExpertMode.Text = "-> Plug&&Play Mode"; } else @@ -277,6 +293,12 @@ buttonExpertMode.Text = "-> Expert Mode"; } +#if CLIENT + // Client + checkBoxHomeOnly.Checked = Convert.ToBoolean(GetSetting("HomeOnly", "false")); + +#endif +#if SERVER // EPG { EPGWakeupConfig config = new EPGWakeupConfig(GetSetting("EPGWakeupConfig", String.Empty)); @@ -317,18 +339,20 @@ else mFormat = "{0}"; textBoxEPG.Text = String.Format(hFormat, config.Hour) + ":" + String.Format(mFormat, config.Minutes); - } - checkBoxEPGPreventStandby.Checked = Convert.ToBoolean(GetSetting("EPGPreventStandby", "false")); - if (!checkBoxEPGPreventStandby.Checked) - checkBoxEPGAwayMode.Enabled = false; + checkBoxEPGPreventStandby.Checked = Convert.ToBoolean(GetSetting("EPGPreventStandby", "false")); + if (!checkBoxEPGPreventStandby.Checked) + checkBoxEPGAwayMode.Enabled = false; - checkBoxEPGAwayMode.Checked = Convert.ToBoolean(GetSetting("EPGAwayMode", "false")); + checkBoxEPGAwayMode.Checked = Convert.ToBoolean(GetSetting("EPGAwayMode", "false")); - checkBoxEPGWakeup.Checked = Convert.ToBoolean(GetSetting("EPGWakeup", "false")); + checkBoxEPGWakeup.Checked = Convert.ToBoolean(GetSetting("EPGWakeup", "false")); - textBoxEPGCommand.Text = GetSetting("EPGCommand", String.Empty); + textBoxEPGCommand.Text = GetSetting("EPGCommand", String.Empty); + } +#endif + // Reboot { EPGWakeupConfig config = new EPGWakeupConfig(GetSetting("RebootConfig", String.Empty)); @@ -369,11 +393,11 @@ else mFormat = "{0}"; textBoxReboot.Text = String.Format(hFormat, config.Hour) + ":" + String.Format(mFormat, config.Minutes); - } - checkBoxRebootWakeup.Checked = Convert.ToBoolean(GetSetting("RebootWakeup", "false")); + checkBoxRebootWakeup.Checked = Convert.ToBoolean(GetSetting("RebootWakeup", "false")); - textBoxRebootCommand.Text = GetSetting("RebootCommand", String.Empty); + textBoxRebootCommand.Text = GetSetting("RebootCommand", String.Empty); + } // Processes textBoxProcesses.Text = GetSetting("Processes", String.Empty); @@ -430,8 +454,10 @@ checkBoxNetworkAwayMode.Checked = Convert.ToBoolean(GetSetting("NetworkMonitorAwayMode", "false")); // Advanced +#if SERVER checkBoxReinitializeController.Checked = Convert.ToBoolean(GetSetting("ReinitializeController", "false")); +#endif textBoxStandbyWakeupCommand.Text = GetSetting("Command", string.Empty); checkBoxAutoPowerSettings.Checked = Convert.ToBoolean(GetSetting("AutoPowerSettings", "true")); @@ -466,6 +492,11 @@ { using (_settings = new MPSettings()) { + if (_singleSeat) + { + SetSetting("HomeOnly", checkBoxHomeOnly.Checked.ToString()); + return; + } #endif // General SetSetting("Profile", comboBoxProfile.SelectedIndex.ToString()); @@ -474,6 +505,12 @@ SetSetting("ExpertMode", (labelExpertMode.Text == "Expert Mode").ToString()); +#if CLIENT + // Client + SetSetting("HomeOnly", checkBoxHomeOnly.Checked.ToString()); + +#endif +#if SERVER // EPG { EPGWakeupConfig cfg = new EPGWakeupConfig(GetSetting("EPGWakeupConfig", String.Empty)); @@ -507,9 +544,9 @@ SetSetting("EPGCommand", textBoxEPGCommand.Text); +#endif // Reboot { - ; EPGWakeupConfig cfg = new EPGWakeupConfig(GetSetting("RebootConfig", String.Empty)); EPGWakeupConfig newcfg = new EPGWakeupConfig(); newcfg.Hour = cfg.Hour; @@ -566,9 +603,10 @@ SetSetting("NetworkMonitorAwayMode", checkBoxNetworkAwayMode.Checked.ToString()); // Advanced - +#if SERVER SetSetting("ReinitializeController", checkBoxReinitializeController.Checked.ToString()); +#endif SetSetting("Command", textBoxStandbyWakeupCommand.Text); SetSetting("AutoPowerSettings", checkBoxAutoPowerSettings.Checked.ToString()); @@ -699,30 +737,30 @@ private void RefreshStatus() { + bool unattended, disAllowShutdown = false; + DateTime nextWakeupTime = DateTime.MaxValue; + string disAllowShutdownHandler = ""; + string nextWakeupHandler = ""; + lock (this) { - bool unattended, disAllowShutdown = false; - DateTime nextWakeupTime = DateTime.MaxValue; - string disAllowShutdownHandler = ""; - string nextWakeupHandler = ""; - // Connect to the local TVserver's IPowerController instance if (RemotePowerControl.Instance != null && RemotePowerControl.Isconnected) RemotePowerControl.Instance.GetCurrentState(true, out unattended, out disAllowShutdown, out disAllowShutdownHandler, out nextWakeupTime, out nextWakeupHandler); + } - if (Convert.ToBoolean(GetSetting("ShutdownEnabled", "false"))) - labelStandbyStatus.Text = "Standby is handled by PowerScheduler++"; - else - labelStandbyStatus.Text = "Standby is handled by Windows"; + labelWakeupHandler.Text = nextWakeupHandler; + if (nextWakeupHandler != String.Empty) + labelWakeupTimeValue.Text = nextWakeupTime.ToString(); + else + labelWakeupTimeValue.Text = ""; - labelWakeupHandler.Text = nextWakeupHandler; + if (Convert.ToBoolean(GetSetting("ShutdownEnabled", "false"))) + labelStandbyStatus.Text = "Standby is handled by PowerScheduler++"; + else + labelStandbyStatus.Text = "Standby is handled by Windows"; - textBoxStandbyHandler.Text = disAllowShutdownHandler; - if (nextWakeupHandler != String.Empty) - labelWakeupTimeValue.Text = nextWakeupTime.ToString(); - else - labelWakeupTimeValue.Text = ""; - } + textBoxStandbyHandler.Text = disAllowShutdownHandler; } #endif @@ -731,15 +769,7 @@ #region Forms Control Events #region MasterSetup -#if CLIENT - private void PowerSchedulerSetup_Shown(object sender, EventArgs e) - { - if (_singleSeat) - Close(); - } -#endif - private void buttonApply_Click(object sender, EventArgs e) { buttonApply.Enabled = false; @@ -793,13 +823,7 @@ // Power Settings _recommendedSettingsAC = _defaultSettingsDesktopAC; _recommendedSettingsDC = _defaultSettingsDesktopDC; - if (PowerManager.RunningOnAC) - _recommendedSettingsAC.idleTimeout = (uint)numericUpDownIdleTimeout.Value; - else - _recommendedSettingsAC.idleTimeout = (uint)numericUpDownIdleTimeout.Value * 2; - _recommendedSettingsDC.idleTimeout = _recommendedSettingsAC.idleTimeout / 2; - // Profile specific switch (comboBoxProfile.SelectedIndex) { @@ -831,6 +855,9 @@ checkBoxEPGPreventStandby.Checked = false; // Reboot checkBoxRebootWakeup.Checked = false; + // Power settings + _recommendedSettingsAC = _defaultSettingsNotebookAC; + _recommendedSettingsDC = _defaultSettingsNotebookDC; break; #if SERVER @@ -844,6 +871,13 @@ break; #endif } + + // Idle timeout + if (PowerManager.RunningOnAC) + _recommendedSettingsAC.idleTimeout = (uint)numericUpDownIdleTimeout.Value; + else + _recommendedSettingsAC.idleTimeout = (uint)numericUpDownIdleTimeout.Value * 2; + _recommendedSettingsDC.idleTimeout = _recommendedSettingsAC.idleTimeout / 2; } private void numericUpDownIdleTimeout_ValueChanged(object sender, EventArgs e) Modified: trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.resx =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.resx 2012-02-16 17:06:59 UTC (rev 4453) +++ trunk/plugins/PowerScheduler++/Test/1.2.6.0/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.resx 2012-02-17 15:41:22 UTC (rev 4454) @@ -170,7 +170,6 @@ <value>Available Profiles: HTPC: Dedicated multimedia appliance with MediaPortal GUI Desktop: MediaPortal as application for viewing media and recording TV -Notebook: Optimized for mobile use, no scheduled recordings -Server: Dedicated server without GUI provides TV and recording services</value> +Notebook: Optimized for mobile use, no scheduled recordings</value> </data> </root> \ No newline at end of file Modified: trunk/plugins/PowerScheduler++/Test/1.2.6.0/VersionInfo.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.2.6.0/VersionInfo.cs 2012-02-16 17:06:59 UTC (rev 4453) +++ trunk/plugins/PowerScheduler++/Test/1.2.6.0/VersionInfo.cs 2012-02-17 15:41:22 UTC (rev 4454) @@ -47,9 +47,9 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.2.5.12")] -[assembly: AssemblyFileVersion("1.2.5.12")] -[assembly: AssemblyInformationalVersion("1.2.5.12 alpha version for MP 1.2.x")] +[assembly: AssemblyVersion("1.2.6.0")] +[assembly: AssemblyFileVersion("1.2.6.0")] +[assembly: AssemblyInformationalVersion("1.2.6.0 beta version for MP 1.2.x and 1.3.x")] Modified: trunk/plugins/PowerScheduler++/Test/1.2.6.0/mediaportal/PowerSchedulerClientPlugin/Handlers/ActiveNetworkStandbyHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.2.6.0/mediaportal/PowerSchedulerClientPlugin/Handlers/ActiveNetworkStandbyHandler.cs 2012-02-16 17:06:59 UTC (rev 4453) +++ trunk/plugins/PowerScheduler++/Test/1.2.6.0/mediaportal/PowerSchedulerClientPlugin/Handlers/ActiveNetworkStandbyHandler.cs 2012-02-17 15:41:22 UTC (rev 4454) @@ -20,13 +20,11 @@ using System; using System.Collections; -using System.Collections.Generic; using System.Diagnostics; -using System.Threading; -using System.Timers; using MediaPortal.GUI.Library; using MediaPortal.Profile; using MediaPortal.Services; + using TvEngine.PowerScheduler.Interfaces; namespace MediaPortal.Plugins.Process.Handlers @@ -39,13 +37,12 @@ { #region Variables - private PerformanceCounter dlCounter, ulCounter; // Performance counters to monitor download and upload speed. - private long dlValueOld, ulValueOld; // Download Upload counter value one second earlier, in bytes. - private DateTime lastSampleTime; + private PerformanceCounter _dlCounter, _ulCounter; // Performance counters to monitor download and upload speed. + private long _dlValueOld, _ulValueOld; // Download Upload counter value one second earlier, in bytes. + private DateTime _lastSampleTime = DateTime.Now; + private long _dlSpeed, _ulSpeed; // Download Upload peak values in KB/s + private string _name; // The name of the adapter. - internal long dlSpeedPeak, ulSpeedPeak; // Download Upload peak values in KB/s - internal string name; // The name of the adapter. - #endregion #region Private methods @@ -55,54 +52,55 @@ /// </summary> internal NetworkAdapter(string name) { - this.name = name; + _name = name; // Create performance counters for the adapter. - dlCounter = new PerformanceCounter("Network Interface", "Bytes Received/sec", this.name); - ulCounter = new PerformanceCounter("Network Interface", "Bytes Sent/sec", this.name); + _dlCounter = new PerformanceCounter("Network Interface", "Bytes Received/sec", this._name); + _ulCounter = new PerformanceCounter("Network Interface", "Bytes Sent/sec", this._name); // Since dlValueOld and ulValueOld are used in method update() to calculate network speed, // they must have be initialized. - lastSampleTime = DateTime.Now; - dlValueOld = dlCounter.NextSample().RawValue; - ulValueOld = ulCounter.NextSample().RawValue; - - // Clear peak values - dlSpeedPeak = 0; - ulSpeedPeak = 0; + _dlValueOld = _dlCounter.NextSample().RawValue; + _ulValueOld = _ulCounter.NextSample().RawValue; } /// <summary> /// Obtain new sample from performance counters, and update the values saved in dlSpeed, ulSpeed, etc. /// This method is supposed to be called only in NetworkMonitorHandler, one time every second. /// </summary> - internal void update() + internal void Update() { DateTime thisSampleTime = DateTime.Now; + // Download Upload counter value in bytes. - long dlValue = dlCounter.NextSample().RawValue; - long ulValue = ulCounter.NextSample().RawValue; + long dlValue = _dlCounter.NextSample().RawValue; + long ulValue = _ulCounter.NextSample().RawValue; // Calculates download and upload speed. - double monitorInterval = thisSampleTime.Subtract(lastSampleTime).TotalSeconds; - lastSampleTime = thisSampleTime; - long dlSpeed = (long)((dlValue - dlValueOld) / monitorInterval); - long ulSpeed = (long)((ulValue - ulValueOld) / monitorInterval); + double monitorInterval = thisSampleTime.Subtract(_lastSampleTime).TotalSeconds; + _lastSampleTime = thisSampleTime; + _dlSpeed = (long)((dlValue - _dlValueOld) / monitorInterval / 1024); + _ulSpeed = (long)((ulValue - _ulValueOld) / monitorInterval / 1024); - dlValueOld = dlValue; - ulValueOld = ulValue; + _dlValueOld = dlValue; + _ulValueOld = ulValue; + } - if ((dlSpeed / 1024) > dlSpeedPeak) // Store peak values in KB/s - { - dlSpeedPeak = (dlSpeed / 1024); - } + internal string Name + { + get { return _name; } + } - if ((ulSpeed / 1024) > ulSpeedPeak) // Store peak values in KB/s - { - ulSpeedPeak = (ulSpeed / 1024); - } + internal long DlSpeed + { + get { return _dlSpeed; } } + internal long UlSpeed + { + get { return _ulSpeed; } + } + #endregion } @@ -111,19 +109,12 @@ /// </summary> public class ActiveNetworkStandbyHandler : IStandbyHandler, IStandbyHandlerEx { - #region Constants - - private const int MonitorInteval = 10; // seconds - - #endregion - #region Variables - private System.Timers.Timer timer; // The timer event executes every second to refresh the values in adapters. - private Int32 idleLimit; // Minimum transferrate considered as network activity in KB/s. + private Int32 _idleLimit; // Minimum transferrate considered as network activity in KB/s. - private ArrayList monitoredAdapters = new ArrayList(); // The list of monitored adapters on the computer. - private List<string> _preventers = new List<string>(); // The list of standby preventers. + private ArrayList _monitoredAdapters = new ArrayList(); // The list of monitored adapters on the computer. + private int _preventers = 0; /// <summary> /// Use away mode setting @@ -155,7 +146,9 @@ if (ps == null) return; + PowerSetting setting; + bool enabled; using (Settings reader = new MPSettings()) @@ -164,14 +157,14 @@ setting = ps.Settings.GetSetting("NetworkMonitorEnabled"); enabled = reader.GetValueAsBool("psclientplugin", "NetworkMonitorEnabled", false); + if (setting.Get<bool>() != enabled) // Setting changed { setting.Set<bool>(enabled); if (enabled) // Start { Log.Debug("NetworkMonitorHandler: Network monitor started"); - Thread netmonThr = new Thread(new ThreadStart(StartNetworkMonitor)); - netmonThr.Start(); + StartNetworkMonitor(); } else // Stop { @@ -184,17 +177,19 @@ if (enabled) { setting = ps.Settings.GetSetting("NetworkMonitorIdleLimit"); - idleLimit = reader.GetValueAsInt("psclientplugin", "NetworkMonitorIdleLimit", 0); - if (setting.Get<Int32>() != idleLimit) + _idleLimit = reader.GetValueAsInt("psclientplugin", "NetworkMonitorIdleLimit", 0); + + if (setting.Get<Int32>() != _idleL... [truncated message content] |