Removing obsolete CEC options.
authorStephaneLenclud
Sun, 24 Jul 2016 20:46:34 +0200
changeset 2155de8f8eaaa54
parent 214 4961ede27e0a
child 216 24d131a00f1c
Removing obsolete CEC options.
Server/App.config
Server/ConsumerElectronicControl.cs
Server/MainForm.Designer.cs
Server/MainForm.cs
Server/Properties/Settings.Designer.cs
Server/Properties/Settings.settings
     1.1 --- a/Server/App.config	Sun Jul 24 20:36:07 2016 +0200
     1.2 +++ b/Server/App.config	Sun Jul 24 20:46:34 2016 +0200
     1.3 @@ -37,18 +37,9 @@
     1.4              <setting name="CecHdmiPort" serializeAs="String">
     1.5                  <value>1</value>
     1.6              </setting>
     1.7 -            <setting name="CecMonitorOn" serializeAs="String">
     1.8 -                <value>True</value>
     1.9 -            </setting>
    1.10 -            <setting name="CecMonitorOff" serializeAs="String">
    1.11 -                <value>True</value>
    1.12 -            </setting>
    1.13              <setting name="StartIdleClient" serializeAs="String">
    1.14                  <value>True</value>
    1.15              </setting>
    1.16 -            <setting name="CecReconnectToPowerTv" serializeAs="String">
    1.17 -                <value>False</value>
    1.18 -            </setting>
    1.19          </SharpDisplayManager.Properties.Settings>
    1.20      </userSettings>
    1.21  </configuration>
     2.1 --- a/Server/ConsumerElectronicControl.cs	Sun Jul 24 20:36:07 2016 +0200
     2.2 +++ b/Server/ConsumerElectronicControl.cs	Sun Jul 24 20:46:34 2016 +0200
     2.3 @@ -20,7 +20,6 @@
     2.4          ///TODO: have a more solid implementation
     2.5          public bool MonitorPowerOn;
     2.6  
     2.7 -        private bool iReconnectToPowerTv = false;
     2.8  
     2.9          public void TestSendKeys()
    2.10          {
    2.11 @@ -33,28 +32,16 @@
    2.12          /// <param name="aWndHandle"></param>
    2.13          /// <param name="aDeviceName"></param>
    2.14          /// <param name="aHdmiPort"></param>
    2.15 -        public void Start(IntPtr aWndHandle, string aDeviceName, byte aHdmiPort, bool aMonitorOn, bool aMonitorOff, bool aReconnectToPowerTv)
    2.16 +        public void Start(IntPtr aWndHandle, string aDeviceName, byte aHdmiPort)
    2.17          {
    2.18              //Assuming monitor is on when we start up
    2.19              MonitorPowerOn = true;
    2.20  
    2.21 -            iReconnectToPowerTv = aReconnectToPowerTv;
    2.22 -
    2.23              //Create our power setting notifier and register the event we are interested in
    2.24              iPowerSettingNotifier = new PowerManager.SettingNotifier(aWndHandle);
    2.25 -
    2.26 -            //
    2.27 -            if (aMonitorOn)
    2.28 -            {
    2.29 -                iPowerSettingNotifier.OnMonitorPowerOn += OnMonitorPowerOn;
    2.30 -            }
    2.31 -
    2.32 -            //
    2.33 -            if (aMonitorOff)
    2.34 -            {
    2.35 -                iPowerSettingNotifier.OnMonitorPowerOff += OnMonitorPowerOff;
    2.36 -            }
    2.37 -
    2.38 +            iPowerSettingNotifier.OnMonitorPowerOn += OnMonitorPowerOn;
    2.39 +            iPowerSettingNotifier.OnMonitorPowerOff += OnMonitorPowerOff;
    2.40 +            
    2.41              //CEC
    2.42              Client = new Cec.Client(aDeviceName,aHdmiPort, CecDeviceType.PlaybackDevice);
    2.43              ConnectCecClient();
    2.44 @@ -93,41 +80,16 @@
    2.45  
    2.46          private void OnMonitorPowerOn()
    2.47          {
    2.48 -            ManagerEventAction.Current.GetEvent<EventMonitorPowerOn>().Trigger();
    2.49 -
    2.50 -            Console.WriteLine("OnMonitorPowerOn");
    2.51 -
    2.52 -            if (iReconnectToPowerTv)
    2.53 -            {
    2.54 -                ConnectCecClient();
    2.55 -            }            
    2.56 -
    2.57 -            //Turn on the TV
    2.58 -            //iCecClient.Lib.PowerOnDevices(CecLogicalAddress.Tv);
    2.59 -            //iCecClient.Lib.SendKeypress(CecLogicalAddress.Tv,CecUserControlCode.PowerOnFunction,true);
    2.60 -            //Set ourselves as the active source
    2.61 -            Client.Lib.SetActiveSource(CecDeviceType.PlaybackDevice);
    2.62              MonitorPowerOn = true;
    2.63 +            //Trigger corresponding event thus executing associated actions
    2.64 +            ManagerEventAction.Current.GetEvent<EventMonitorPowerOn>().Trigger();            
    2.65          }
    2.66  
    2.67          private void OnMonitorPowerOff()
    2.68          {
    2.69 +            MonitorPowerOn = false;
    2.70 +            //Trigger corresponding event thus executing associated actions
    2.71              ManagerEventAction.Current.GetEvent<EventMonitorPowerOff>().Trigger();
    2.72 -
    2.73 -            Console.WriteLine("OnMonitorPowerOff");
    2.74 -
    2.75 -            if (iReconnectToPowerTv)
    2.76 -            {
    2.77 -                ConnectCecClient();
    2.78 -            }
    2.79 -
    2.80 -            //Try turning off the TV
    2.81 -            Client.Lib.StandbyDevices(CecLogicalAddress.Tv);
    2.82 -            //iCecClient.Lib.SendKeypress(CecLogicalAddress.Tv, CecUserControlCode.PowerOffFunction, true);
    2.83 -            //Tell everyone that we are no longer active
    2.84 -            //iCecClient.Lib.SetInactiveView();
    2.85 -
    2.86 -            MonitorPowerOn = false;
    2.87          }
    2.88  
    2.89          /// <summary>
     3.1 --- a/Server/MainForm.Designer.cs	Sun Jul 24 20:36:07 2016 +0200
     3.2 +++ b/Server/MainForm.Designer.cs	Sun Jul 24 20:46:34 2016 +0200
     3.3 @@ -106,9 +106,6 @@
     3.4              this.checkBoxCecLogNotice = new System.Windows.Forms.CheckBox();
     3.5              this.checkBoxCecLogError = new System.Windows.Forms.CheckBox();
     3.6              this.checkBoxCecLogWarning = new System.Windows.Forms.CheckBox();
     3.7 -            this.checkBoxCecReconnectToPowerTv = new System.Windows.Forms.CheckBox();
     3.8 -            this.checkBoxCecMonitorOn = new System.Windows.Forms.CheckBox();
     3.9 -            this.checkBoxCecMonitorOff = new System.Windows.Forms.CheckBox();
    3.10              this.checkBoxCecEnabled = new System.Windows.Forms.CheckBox();
    3.11              this.labelHdmiPort = new System.Windows.Forms.Label();
    3.12              this.comboBoxHdmiPort = new System.Windows.Forms.ComboBox();
    3.13 @@ -829,9 +826,6 @@
    3.14              // tabPageCec
    3.15              // 
    3.16              this.tabPageCec.Controls.Add(this.groupBoxCecLogOptions);
    3.17 -            this.tabPageCec.Controls.Add(this.checkBoxCecReconnectToPowerTv);
    3.18 -            this.tabPageCec.Controls.Add(this.checkBoxCecMonitorOn);
    3.19 -            this.tabPageCec.Controls.Add(this.checkBoxCecMonitorOff);
    3.20              this.tabPageCec.Controls.Add(this.checkBoxCecEnabled);
    3.21              this.tabPageCec.Controls.Add(this.labelHdmiPort);
    3.22              this.tabPageCec.Controls.Add(this.comboBoxHdmiPort);
    3.23 @@ -933,39 +927,6 @@
    3.24              this.checkBoxCecLogWarning.UseVisualStyleBackColor = true;
    3.25              this.checkBoxCecLogWarning.CheckedChanged += new System.EventHandler(this.checkBoxCecLogs_CheckedChanged);
    3.26              // 
    3.27 -            // checkBoxCecReconnectToPowerTv
    3.28 -            // 
    3.29 -            this.checkBoxCecReconnectToPowerTv.AutoSize = true;
    3.30 -            this.checkBoxCecReconnectToPowerTv.Location = new System.Drawing.Point(6, 115);
    3.31 -            this.checkBoxCecReconnectToPowerTv.Name = "checkBoxCecReconnectToPowerTv";
    3.32 -            this.checkBoxCecReconnectToPowerTv.Size = new System.Drawing.Size(194, 17);
    3.33 -            this.checkBoxCecReconnectToPowerTv.TabIndex = 24;
    3.34 -            this.checkBoxCecReconnectToPowerTv.Text = "Reconnect before TV power switch";
    3.35 -            this.checkBoxCecReconnectToPowerTv.UseVisualStyleBackColor = true;
    3.36 -            this.checkBoxCecReconnectToPowerTv.CheckedChanged += new System.EventHandler(this.checkBoxCecReconnectToPowerTv_CheckedChanged);
    3.37 -            // 
    3.38 -            // checkBoxCecMonitorOn
    3.39 -            // 
    3.40 -            this.checkBoxCecMonitorOn.AutoSize = true;
    3.41 -            this.checkBoxCecMonitorOn.Location = new System.Drawing.Point(6, 92);
    3.42 -            this.checkBoxCecMonitorOn.Name = "checkBoxCecMonitorOn";
    3.43 -            this.checkBoxCecMonitorOn.Size = new System.Drawing.Size(192, 17);
    3.44 -            this.checkBoxCecMonitorOn.TabIndex = 23;
    3.45 -            this.checkBoxCecMonitorOn.Text = "Wake up TV when screen turns on";
    3.46 -            this.checkBoxCecMonitorOn.UseVisualStyleBackColor = true;
    3.47 -            this.checkBoxCecMonitorOn.CheckedChanged += new System.EventHandler(this.checkBoxCecMonitorOn_CheckedChanged);
    3.48 -            // 
    3.49 -            // checkBoxCecMonitorOff
    3.50 -            // 
    3.51 -            this.checkBoxCecMonitorOff.AutoSize = true;
    3.52 -            this.checkBoxCecMonitorOff.Location = new System.Drawing.Point(6, 69);
    3.53 -            this.checkBoxCecMonitorOff.Name = "checkBoxCecMonitorOff";
    3.54 -            this.checkBoxCecMonitorOff.Size = new System.Drawing.Size(219, 17);
    3.55 -            this.checkBoxCecMonitorOff.TabIndex = 22;
    3.56 -            this.checkBoxCecMonitorOff.Text = "Set TV on standby when screen turns off";
    3.57 -            this.checkBoxCecMonitorOff.UseVisualStyleBackColor = true;
    3.58 -            this.checkBoxCecMonitorOff.CheckedChanged += new System.EventHandler(this.checkBoxCecMonitorOff_CheckedChanged);
    3.59 -            // 
    3.60              // checkBoxCecEnabled
    3.61              // 
    3.62              this.checkBoxCecEnabled.AutoSize = true;
    3.63 @@ -1293,13 +1254,10 @@
    3.64          private System.Windows.Forms.CheckBox checkBoxCecEnabled;
    3.65          private System.Windows.Forms.Label labelHdmiPort;
    3.66          private System.Windows.Forms.ComboBox comboBoxHdmiPort;
    3.67 -        private System.Windows.Forms.CheckBox checkBoxCecMonitorOn;
    3.68 -        private System.Windows.Forms.CheckBox checkBoxCecMonitorOff;
    3.69          private System.Windows.Forms.Button iButtonStartIdleClient;
    3.70          private System.Windows.Forms.CheckBox iCheckBoxStartIdleClient;
    3.71          private System.Windows.Forms.TabPage tabPageLogs;
    3.72          private System.Windows.Forms.RichTextBox richTextBoxLogs;
    3.73 -        private System.Windows.Forms.CheckBox checkBoxCecReconnectToPowerTv;
    3.74          private System.Windows.Forms.Button buttonClearLogs;
    3.75          private System.Windows.Forms.GroupBox groupBoxCecLogOptions;
    3.76          private System.Windows.Forms.CheckBox checkBoxCecLogWarning;
     4.1 --- a/Server/MainForm.cs	Sun Jul 24 20:36:07 2016 +0200
     4.2 +++ b/Server/MainForm.cs	Sun Jul 24 20:46:34 2016 +0200
     4.3 @@ -1192,9 +1192,6 @@
     4.4  
     4.5              //CEC settings
     4.6              checkBoxCecEnabled.Checked = Properties.Settings.Default.CecEnabled;
     4.7 -            checkBoxCecMonitorOn.Checked = Properties.Settings.Default.CecMonitorOn;
     4.8 -            checkBoxCecMonitorOff.Checked = Properties.Settings.Default.CecMonitorOff;
     4.9 -		    checkBoxCecReconnectToPowerTv.Checked = Properties.Settings.Default.CecReconnectToPowerTv;
    4.10              comboBoxHdmiPort.SelectedIndex = Properties.Settings.Default.CecHdmiPort - 1;
    4.11  
    4.12              //Mini Display settings
    4.13 @@ -2577,30 +2574,6 @@
    4.14              ResetCec();
    4.15          }
    4.16  
    4.17 -        private void checkBoxCecMonitorOff_CheckedChanged(object sender, EventArgs e)
    4.18 -        {
    4.19 -            Properties.Settings.Default.CecMonitorOff = checkBoxCecMonitorOff.Checked;
    4.20 -            Properties.Settings.Default.Save();
    4.21 -            //
    4.22 -            ResetCec();
    4.23 -        }
    4.24 -
    4.25 -        private void checkBoxCecMonitorOn_CheckedChanged(object sender, EventArgs e)
    4.26 -        {
    4.27 -            Properties.Settings.Default.CecMonitorOn = checkBoxCecMonitorOn.Checked;
    4.28 -            Properties.Settings.Default.Save();
    4.29 -            //
    4.30 -            ResetCec();
    4.31 -        }
    4.32 -
    4.33 -        private void checkBoxCecReconnectToPowerTv_CheckedChanged(object sender, EventArgs e)
    4.34 -        {
    4.35 -            Properties.Settings.Default.CecReconnectToPowerTv = checkBoxCecReconnectToPowerTv.Checked;
    4.36 -            Properties.Settings.Default.Save();
    4.37 -            //
    4.38 -            ResetCec();
    4.39 -        }
    4.40 -
    4.41          /// <summary>
    4.42          /// 
    4.43          /// </summary>
    4.44 @@ -2617,10 +2590,7 @@
    4.45              if (Properties.Settings.Default.CecEnabled)
    4.46              {
    4.47                  iCecManager.Start(Handle, "CEC",
    4.48 -                Properties.Settings.Default.CecHdmiPort,
    4.49 -                Properties.Settings.Default.CecMonitorOn,
    4.50 -                Properties.Settings.Default.CecMonitorOff,
    4.51 -                Properties.Settings.Default.CecReconnectToPowerTv);
    4.52 +                Properties.Settings.Default.CecHdmiPort);
    4.53  
    4.54                  SetupCecLogLevel();
    4.55              }
     5.1 --- a/Server/Properties/Settings.Designer.cs	Sun Jul 24 20:36:07 2016 +0200
     5.2 +++ b/Server/Properties/Settings.Designer.cs	Sun Jul 24 20:46:34 2016 +0200
     5.3 @@ -145,30 +145,6 @@
     5.4          [global::System.Configuration.UserScopedSettingAttribute()]
     5.5          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     5.6          [global::System.Configuration.DefaultSettingValueAttribute("True")]
     5.7 -        public bool CecMonitorOn {
     5.8 -            get {
     5.9 -                return ((bool)(this["CecMonitorOn"]));
    5.10 -            }
    5.11 -            set {
    5.12 -                this["CecMonitorOn"] = value;
    5.13 -            }
    5.14 -        }
    5.15 -        
    5.16 -        [global::System.Configuration.UserScopedSettingAttribute()]
    5.17 -        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    5.18 -        [global::System.Configuration.DefaultSettingValueAttribute("True")]
    5.19 -        public bool CecMonitorOff {
    5.20 -            get {
    5.21 -                return ((bool)(this["CecMonitorOff"]));
    5.22 -            }
    5.23 -            set {
    5.24 -                this["CecMonitorOff"] = value;
    5.25 -            }
    5.26 -        }
    5.27 -        
    5.28 -        [global::System.Configuration.UserScopedSettingAttribute()]
    5.29 -        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    5.30 -        [global::System.Configuration.DefaultSettingValueAttribute("True")]
    5.31          public bool StartIdleClient {
    5.32              get {
    5.33                  return ((bool)(this["StartIdleClient"]));
    5.34 @@ -180,18 +156,6 @@
    5.35          
    5.36          [global::System.Configuration.UserScopedSettingAttribute()]
    5.37          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    5.38 -        [global::System.Configuration.DefaultSettingValueAttribute("False")]
    5.39 -        public bool CecReconnectToPowerTv {
    5.40 -            get {
    5.41 -                return ((bool)(this["CecReconnectToPowerTv"]));
    5.42 -            }
    5.43 -            set {
    5.44 -                this["CecReconnectToPowerTv"] = value;
    5.45 -            }
    5.46 -        }
    5.47 -        
    5.48 -        [global::System.Configuration.UserScopedSettingAttribute()]
    5.49 -        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    5.50          public global::SharpLib.Ear.ManagerEventAction Actions {
    5.51              get {
    5.52                  return ((global::SharpLib.Ear.ManagerEventAction)(this["Actions"]));
     6.1 --- a/Server/Properties/Settings.settings	Sun Jul 24 20:36:07 2016 +0200
     6.2 +++ b/Server/Properties/Settings.settings	Sun Jul 24 20:46:34 2016 +0200
     6.3 @@ -32,18 +32,9 @@
     6.4      <Setting Name="CecHdmiPort" Type="System.Byte" Scope="User">
     6.5        <Value Profile="(Default)">1</Value>
     6.6      </Setting>
     6.7 -    <Setting Name="CecMonitorOn" Type="System.Boolean" Scope="User">
     6.8 -      <Value Profile="(Default)">True</Value>
     6.9 -    </Setting>
    6.10 -    <Setting Name="CecMonitorOff" Type="System.Boolean" Scope="User">
    6.11 -      <Value Profile="(Default)">True</Value>
    6.12 -    </Setting>
    6.13      <Setting Name="StartIdleClient" Type="System.Boolean" Scope="User">
    6.14        <Value Profile="(Default)">True</Value>
    6.15      </Setting>
    6.16 -    <Setting Name="CecReconnectToPowerTv" Type="System.Boolean" Scope="User">
    6.17 -      <Value Profile="(Default)">False</Value>
    6.18 -    </Setting>
    6.19      <Setting Name="Actions" Type="SharpLib.Ear.ManagerEventAction" Scope="User">
    6.20        <Value Profile="(Default)" />
    6.21      </Setting>