Adding send and release CEC key actions.
authorStephaneLenclud
Wed, 27 Jul 2016 11:07:35 +0200
changeset 2220e8c6c2f4777
parent 221 5770478e1fe3
child 223 f6272f65d8fc
Adding send and release CEC key actions.
Edit action ComboBox now sorted and selecting proper item.
Server/Actions/ActionCecActiveSource.cs
Server/Actions/ActionCecClose.cs
Server/Actions/ActionCecDevice.cs
Server/Actions/ActionCecDevicePowerOn.cs
Server/Actions/ActionCecDeviceStandby.cs
Server/Actions/ActionCecDeviceType.cs
Server/Actions/ActionCecInactiveSource.cs
Server/Actions/ActionCecOpen.cs
Server/Actions/ActionCecPowerOnTv.cs
Server/Actions/ActionCecScan.cs
Server/Actions/ActionCecSendKeypressTvPowerOff.cs
Server/Actions/ActionCecSendKeypressTvPowerOn.cs
Server/Actions/ActionCecStandbyTv.cs
Server/Actions/ActionCecUserControlPressed.cs
Server/Actions/ActionCecUserControlReleased.cs
Server/FormEditAction.Designer.cs
Server/FormEditAction.cs
Server/SharpDisplayManager.csproj
SharpLibUtils/TypeConverterJson.cs
     1.1 --- a/Server/Actions/ActionCecActiveSource.cs	Tue Jul 26 15:30:46 2016 +0200
     1.2 +++ b/Server/Actions/ActionCecActiveSource.cs	Wed Jul 27 11:07:35 2016 +0200
     1.3 @@ -11,16 +11,29 @@
     1.4  {
     1.5      [DataContract]
     1.6      [AttributeAction(Id = "Cec.ActiveSource", Name = "CEC Active Source", Description = "Set this CEC device as active source.")]
     1.7 -    class ActionCecActiveSource : SharpLib.Ear.Action
     1.8 +    class ActionCecActiveSource : ActionCecDeviceType
     1.9      {
    1.10 +        /// <summary>
    1.11 +        /// Build a user readable string to describe this action.
    1.12 +        /// </summary>
    1.13 +        /// <returns></returns>
    1.14 +        public override string Brief()
    1.15 +        {
    1.16 +            return "CEC Active Source to " + DeviceType.ToString();
    1.17 +        }
    1.18 +
    1.19 +        /// <summary>
    1.20 +        /// Set the defined device type as active source.
    1.21 +        /// </summary>
    1.22          public override void Execute()
    1.23          {
    1.24              if (Cec.Client.Static == null)
    1.25              {
    1.26                  Console.WriteLine("WARNING: No CEC client installed.");
    1.27 +                return;
    1.28              }
    1.29  
    1.30 -            Cec.Client.Static.Lib.SetActiveSource(CecDeviceType.PlaybackDevice);
    1.31 +            Cec.Client.Static.Lib.SetActiveSource(DeviceType);
    1.32          }
    1.33      }
    1.34  }
     2.1 --- a/Server/Actions/ActionCecClose.cs	Tue Jul 26 15:30:46 2016 +0200
     2.2 +++ b/Server/Actions/ActionCecClose.cs	Wed Jul 27 11:07:35 2016 +0200
     2.3 @@ -18,6 +18,7 @@
     2.4              if (Cec.Client.Static == null)
     2.5              {
     2.6                  Console.WriteLine("WARNING: No CEC client installed.");
     2.7 +                return;
     2.8              }
     2.9  
    2.10              Cec.Client.Static.Close();
     3.1 --- a/Server/Actions/ActionCecDevice.cs	Tue Jul 26 15:30:46 2016 +0200
     3.2 +++ b/Server/Actions/ActionCecDevice.cs	Wed Jul 27 11:07:35 2016 +0200
     3.3 @@ -10,6 +10,9 @@
     3.4  
     3.5  namespace SharpDisplayManager
     3.6  {
     3.7 +    /// <summary>
     3.8 +    /// Abstract CEC action using a device logical address.
     3.9 +    /// </summary>
    3.10      [DataContract]
    3.11      public abstract class ActionCecDevice: SharpLib.Ear.Action
    3.12      {
    3.13 @@ -22,5 +25,22 @@
    3.14              )
    3.15          ]
    3.16          public CecLogicalAddress Device { get; set; }
    3.17 +
    3.18 +        /// <summary>
    3.19 +        /// 
    3.20 +        /// </summary>
    3.21 +        public string DeviceName {
    3.22 +            get
    3.23 +            {
    3.24 +                if (Device == CecLogicalAddress.Broadcast)
    3.25 +                {
    3.26 +                    //Because of duplicate value in enumeration
    3.27 +                    return "Broadcast";
    3.28 +                }
    3.29 +
    3.30 +                return Device.ToString();
    3.31 +            }
    3.32 +        }
    3.33 +
    3.34      }
    3.35  }
     4.1 --- a/Server/Actions/ActionCecDevicePowerOn.cs	Tue Jul 26 15:30:46 2016 +0200
     4.2 +++ b/Server/Actions/ActionCecDevicePowerOn.cs	Wed Jul 27 11:07:35 2016 +0200
     4.3 @@ -20,13 +20,7 @@
     4.4          /// <returns></returns>
     4.5          public override string Brief()
     4.6          {
     4.7 -            if (Device == CecLogicalAddress.Broadcast)
     4.8 -            {
     4.9 -                //Because of duplicated values it would display Unregistered
    4.10 -                return "CEC Power On Broadcast";
    4.11 -            }
    4.12 -
    4.13 -            return "CEC Power On " + Device.ToString();
    4.14 +            return "CEC Power On " + DeviceName;
    4.15          }
    4.16  
    4.17          /// <summary>
     5.1 --- a/Server/Actions/ActionCecDeviceStandby.cs	Tue Jul 26 15:30:46 2016 +0200
     5.2 +++ b/Server/Actions/ActionCecDeviceStandby.cs	Wed Jul 27 11:07:35 2016 +0200
     5.3 @@ -15,18 +15,12 @@
     5.4      public class ActionCecDeviceStandby : ActionCecDevice
     5.5      {
     5.6          /// <summary>
     5.7 -        /// 
     5.8 +        /// Build a user readable string to describe this action.
     5.9          /// </summary>
    5.10          /// <returns></returns>
    5.11          public override string Brief()
    5.12          {
    5.13 -            if (Device == CecLogicalAddress.Broadcast)
    5.14 -            {
    5.15 -                //Because of duplicated values it would display Unregistered
    5.16 -                return "CEC Standby Broadcast";
    5.17 -            }
    5.18 -
    5.19 -            return "CEC Standby " + Device.ToString();
    5.20 +            return "CEC Standby " + DeviceName;
    5.21          }
    5.22  
    5.23          /// <summary>
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/Server/Actions/ActionCecDeviceType.cs	Wed Jul 27 11:07:35 2016 +0200
     6.3 @@ -0,0 +1,29 @@
     6.4 +using CecSharp;
     6.5 +using SharpLib.Ear;
     6.6 +using System;
     6.7 +using System.Collections.Generic;
     6.8 +using System.Linq;
     6.9 +using System.Runtime.InteropServices;
    6.10 +using System.Runtime.Serialization;
    6.11 +using System.Text;
    6.12 +using System.Threading.Tasks;
    6.13 +
    6.14 +namespace SharpDisplayManager
    6.15 +{
    6.16 +    /// <summary>
    6.17 +    /// Abstract CEC action using a device type.
    6.18 +    /// </summary>
    6.19 +    [DataContract]
    6.20 +    public abstract class ActionCecDeviceType : SharpLib.Ear.Action
    6.21 +    {
    6.22 +        [DataMember]
    6.23 +        [AttributeActionProperty
    6.24 +            (
    6.25 +            Id = "CEC.DeviceType",
    6.26 +            Name = "Device Type",
    6.27 +            Description = "The device type used by this action."
    6.28 +            )
    6.29 +        ]
    6.30 +        public CecDeviceType DeviceType { get; set; }
    6.31 +    }
    6.32 +}
     7.1 --- a/Server/Actions/ActionCecInactiveSource.cs	Tue Jul 26 15:30:46 2016 +0200
     7.2 +++ b/Server/Actions/ActionCecInactiveSource.cs	Wed Jul 27 11:07:35 2016 +0200
     7.3 @@ -18,6 +18,7 @@
     7.4              if (Cec.Client.Static == null)
     7.5              {
     7.6                  Console.WriteLine("WARNING: No CEC client installed.");
     7.7 +                return;
     7.8              }
     7.9  
    7.10              Cec.Client.Static.Lib.SetInactiveView();
     8.1 --- a/Server/Actions/ActionCecOpen.cs	Tue Jul 26 15:30:46 2016 +0200
     8.2 +++ b/Server/Actions/ActionCecOpen.cs	Wed Jul 27 11:07:35 2016 +0200
     8.3 @@ -18,6 +18,7 @@
     8.4              if (Cec.Client.Static == null)
     8.5              {
     8.6                  Console.WriteLine("WARNING: No CEC client installed.");
     8.7 +                return;
     8.8              }
     8.9  
    8.10              Cec.Client.Static.Open(1000);
     9.1 --- a/Server/Actions/ActionCecPowerOnTv.cs	Tue Jul 26 15:30:46 2016 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,26 +0,0 @@
     9.4 -using CecSharp;
     9.5 -using SharpLib.Ear;
     9.6 -using System;
     9.7 -using System.Collections.Generic;
     9.8 -using System.Linq;
     9.9 -using System.Runtime.Serialization;
    9.10 -using System.Text;
    9.11 -using System.Threading.Tasks;
    9.12 -
    9.13 -namespace SharpDisplayManager
    9.14 -{
    9.15 -    [DataContract]
    9.16 -    [AttributeAction(Id = "Cec.PowerOnTv", Name = "CEC Power On TV", Description = "Power on TVs on your CEC HDMI network.")]
    9.17 -    class ActionCecPowerOnTv : SharpLib.Ear.Action
    9.18 -    {
    9.19 -        public override void Execute()
    9.20 -        {
    9.21 -            if (Cec.Client.Static == null)
    9.22 -            {
    9.23 -                Console.WriteLine("WARNING: No CEC client installed.");
    9.24 -            }
    9.25 -
    9.26 -            Cec.Client.Static.Lib.PowerOnDevices(CecLogicalAddress.Tv);
    9.27 -        }
    9.28 -    }
    9.29 -}
    10.1 --- a/Server/Actions/ActionCecScan.cs	Tue Jul 26 15:30:46 2016 +0200
    10.2 +++ b/Server/Actions/ActionCecScan.cs	Wed Jul 27 11:07:35 2016 +0200
    10.3 @@ -19,6 +19,7 @@
    10.4              if (Cec.Client.Static == null)
    10.5              {
    10.6                  Console.WriteLine("WARNING: No CEC client installed.");
    10.7 +                return;
    10.8              }
    10.9  
   10.10              Cec.Client.Static.Scan();
    11.1 --- a/Server/Actions/ActionCecSendKeypressTvPowerOff.cs	Tue Jul 26 15:30:46 2016 +0200
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,27 +0,0 @@
    11.4 -
    11.5 -using CecSharp;
    11.6 -using SharpLib.Ear;
    11.7 -using System;
    11.8 -using System.Collections.Generic;
    11.9 -using System.Linq;
   11.10 -using System.Runtime.Serialization;
   11.11 -using System.Text;
   11.12 -using System.Threading.Tasks;
   11.13 -
   11.14 -namespace SharpDisplayManager
   11.15 -{
   11.16 -    [DataContract]
   11.17 -    [AttributeAction(Id = "Cec.SendKepressTvPowerOff", Name = "CEC Send Keypress TV Power Off", Description = "Send Power Off keypress to your TV.")]
   11.18 -    class ActionCecSendKeypressTvPowerOff : SharpLib.Ear.Action
   11.19 -    {
   11.20 -        public override void Execute()
   11.21 -        {
   11.22 -            if (Cec.Client.Static == null)
   11.23 -            {
   11.24 -                Console.WriteLine("WARNING: No CEC client installed.");
   11.25 -            }
   11.26 -
   11.27 -            Cec.Client.Static.Lib.SendKeypress(CecLogicalAddress.Tv,CecUserControlCode.PowerOffFunction,true);
   11.28 -        }
   11.29 -    }
   11.30 -}
    12.1 --- a/Server/Actions/ActionCecSendKeypressTvPowerOn.cs	Tue Jul 26 15:30:46 2016 +0200
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,27 +0,0 @@
    12.4 -
    12.5 -using CecSharp;
    12.6 -using SharpLib.Ear;
    12.7 -using System;
    12.8 -using System.Collections.Generic;
    12.9 -using System.Linq;
   12.10 -using System.Runtime.Serialization;
   12.11 -using System.Text;
   12.12 -using System.Threading.Tasks;
   12.13 -
   12.14 -namespace SharpDisplayManager
   12.15 -{
   12.16 -    [DataContract]
   12.17 -    [AttributeAction(Id = "Cec.SendKepressTvPowerOn", Name = "CEC Send Keypress TV Power On", Description = "Send Power On keypress to your TV.")]
   12.18 -    class ActionCecSendKeypressTvPowerOn : SharpLib.Ear.Action
   12.19 -    {
   12.20 -        public override void Execute()
   12.21 -        {
   12.22 -            if (Cec.Client.Static == null)
   12.23 -            {
   12.24 -                Console.WriteLine("WARNING: No CEC client installed.");
   12.25 -            }
   12.26 -
   12.27 -            Cec.Client.Static.Lib.SendKeypress(CecLogicalAddress.Tv, CecUserControlCode.PowerOnFunction, true);
   12.28 -        }
   12.29 -    }
   12.30 -}
    13.1 --- a/Server/Actions/ActionCecStandbyTv.cs	Tue Jul 26 15:30:46 2016 +0200
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,26 +0,0 @@
    13.4 -using CecSharp;
    13.5 -using SharpLib.Ear;
    13.6 -using System;
    13.7 -using System.Collections.Generic;
    13.8 -using System.Linq;
    13.9 -using System.Runtime.Serialization;
   13.10 -using System.Text;
   13.11 -using System.Threading.Tasks;
   13.12 -
   13.13 -namespace SharpDisplayManager
   13.14 -{
   13.15 -    [DataContract]
   13.16 -    [AttributeAction(Id = "Cec.StandbyTv", Name = "CEC Standby TV", Description = "Standby TVs on your CEC HDMI network.")]
   13.17 -    class ActionCecStandbyTv : SharpLib.Ear.Action
   13.18 -    {
   13.19 -        public override void Execute()
   13.20 -        {
   13.21 -            if (Cec.Client.Static == null)
   13.22 -            {
   13.23 -                Console.WriteLine("WARNING: No CEC client installed.");
   13.24 -            }
   13.25 -
   13.26 -            Cec.Client.Static.Lib.StandbyDevices(CecLogicalAddress.Tv);
   13.27 -        }
   13.28 -    }
   13.29 -}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/Server/Actions/ActionCecUserControlPressed.cs	Wed Jul 27 11:07:35 2016 +0200
    14.3 @@ -0,0 +1,70 @@
    14.4 +using CecSharp;
    14.5 +using SharpLib.Ear;
    14.6 +using System;
    14.7 +using System.Collections.Generic;
    14.8 +using System.Linq;
    14.9 +using System.Runtime.InteropServices;
   14.10 +using System.Runtime.Serialization;
   14.11 +using System.Text;
   14.12 +using System.Threading.Tasks;
   14.13 +
   14.14 +namespace SharpDisplayManager
   14.15 +{
   14.16 +    /// <summary>
   14.17 +    /// Send a user key press event to the given CEC device.
   14.18 +    /// </summary>
   14.19 +    [DataContract]
   14.20 +    [AttributeAction(Id = "Cec.UserControlPressed", Name = "CEC User Control Pressed", Description = "Send user control code to defined CEC device.")]
   14.21 +    public class ActionCecUserControlPressed : ActionCecDevice
   14.22 +    {
   14.23 +
   14.24 +        public ActionCecUserControlPressed()
   14.25 +        {
   14.26 +            Wait = true;
   14.27 +        }
   14.28 +
   14.29 +        [DataMember]
   14.30 +        [AttributeActionProperty(
   14.31 +        Id = "Cec.UserControlPressed.Code",
   14.32 +        Name = "Code",
   14.33 +        Description = "The key code used by this action."
   14.34 +        )]
   14.35 +        public CecUserControlCode Code { get; set; }
   14.36 +
   14.37 +        [DataMember]
   14.38 +        [AttributeActionProperty(
   14.39 +        Id = "Cec.UserControlPressed.Wait",
   14.40 +        Name = "Wait",
   14.41 +        Description = "Wait for that command."
   14.42 +        )]
   14.43 +        public bool Wait { get; set; }
   14.44 +
   14.45 +        /// <summary>
   14.46 +        /// 
   14.47 +        /// </summary>
   14.48 +        /// <returns></returns>
   14.49 +        public override string Brief()
   14.50 +        {
   14.51 +            string brief = Name + ": " + Code.ToString() + " to " + DeviceName;
   14.52 +            if (Wait)
   14.53 +            {
   14.54 +                brief += " (wait)";
   14.55 +            }
   14.56 +            return brief;
   14.57 +        }
   14.58 +
   14.59 +        /// <summary>
   14.60 +        /// 
   14.61 +        /// </summary>
   14.62 +        public override void Execute()
   14.63 +        {
   14.64 +            if (Cec.Client.Static == null)
   14.65 +            {
   14.66 +                Console.WriteLine("WARNING: No CEC client installed.");
   14.67 +                return;
   14.68 +            }
   14.69 +
   14.70 +            Cec.Client.Static.Lib.SendKeypress(Device, Code, Wait);
   14.71 +        }
   14.72 +    }
   14.73 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/Server/Actions/ActionCecUserControlReleased.cs	Wed Jul 27 11:07:35 2016 +0200
    15.3 @@ -0,0 +1,62 @@
    15.4 +using CecSharp;
    15.5 +using SharpLib.Ear;
    15.6 +using System;
    15.7 +using System.Collections.Generic;
    15.8 +using System.Linq;
    15.9 +using System.Runtime.InteropServices;
   15.10 +using System.Runtime.Serialization;
   15.11 +using System.Text;
   15.12 +using System.Threading.Tasks;
   15.13 +
   15.14 +namespace SharpDisplayManager
   15.15 +{
   15.16 +    /// <summary>
   15.17 +    /// Send a user key press event to the given CEC device.
   15.18 +    /// </summary>
   15.19 +    [DataContract]
   15.20 +    [AttributeAction(Id = "Cec.UserControlReleased", Name = "CEC User Control Released", Description = "Send user control release opcode to a given CEC device.")]
   15.21 +    public class ActionCecUserControlReleased : ActionCecDevice
   15.22 +    {
   15.23 +
   15.24 +        public ActionCecUserControlReleased()
   15.25 +        {
   15.26 +            Wait = true;
   15.27 +        }
   15.28 +
   15.29 +        [DataMember]
   15.30 +        [AttributeActionProperty(
   15.31 +        Id = "Cec.UserControlPressed.Wait",
   15.32 +        Name = "Wait",
   15.33 +        Description = "Wait for that command."
   15.34 +        )]
   15.35 +        public bool Wait { get; set; }
   15.36 +
   15.37 +        /// <summary>
   15.38 +        /// 
   15.39 +        /// </summary>
   15.40 +        /// <returns></returns>
   15.41 +        public override string Brief()
   15.42 +        {
   15.43 +            string brief = Name + " to " + DeviceName;
   15.44 +            if (Wait)
   15.45 +            {
   15.46 +                brief += " (wait)";
   15.47 +            }
   15.48 +            return brief;
   15.49 +        }
   15.50 +
   15.51 +        /// <summary>
   15.52 +        /// 
   15.53 +        /// </summary>
   15.54 +        public override void Execute()
   15.55 +        {
   15.56 +            if (Cec.Client.Static == null)
   15.57 +            {
   15.58 +                Console.WriteLine("WARNING: No CEC client installed.");
   15.59 +                return;
   15.60 +            }
   15.61 +
   15.62 +            Cec.Client.Static.Lib.SendKeyRelease(Device, Wait);
   15.63 +        }
   15.64 +    }
   15.65 +}
    16.1 --- a/Server/FormEditAction.Designer.cs	Tue Jul 26 15:30:46 2016 +0200
    16.2 +++ b/Server/FormEditAction.Designer.cs	Wed Jul 27 11:07:35 2016 +0200
    16.3 @@ -94,7 +94,7 @@
    16.4              this.iTableLayoutPanel.RowCount = 2;
    16.5              this.iTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
    16.6              this.iTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
    16.7 -            this.iTableLayoutPanel.Size = new System.Drawing.Size(373, 16);
    16.8 +            this.iTableLayoutPanel.Size = new System.Drawing.Size(375, 16);
    16.9              this.iTableLayoutPanel.TabIndex = 23;
   16.10              // 
   16.11              // FormEditAction
   16.12 @@ -104,7 +104,7 @@
   16.13              this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
   16.14              this.AutoSize = true;
   16.15              this.CancelButton = this.buttonCancel;
   16.16 -            this.ClientSize = new System.Drawing.Size(400, 107);
   16.17 +            this.ClientSize = new System.Drawing.Size(402, 107);
   16.18              this.Controls.Add(this.iTableLayoutPanel);
   16.19              this.Controls.Add(this.buttonCancel);
   16.20              this.Controls.Add(this.buttonOk);
    17.1 --- a/Server/FormEditAction.cs	Tue Jul 26 15:30:46 2016 +0200
    17.2 +++ b/Server/FormEditAction.cs	Wed Jul 27 11:07:35 2016 +0200
    17.3 @@ -107,6 +107,11 @@
    17.4                  // Set enum value
    17.5                  aInfo.SetValue(aAction, enumValue);
    17.6              }
    17.7 +            else if (aInfo.PropertyType == typeof(bool))
    17.8 +            {
    17.9 +                CheckBox ctrl = (CheckBox)aControl;
   17.10 +                aInfo.SetValue(aAction, ctrl.Checked);
   17.11 +            }
   17.12          }
   17.13  
   17.14          /// <summary>
   17.15 @@ -119,7 +124,8 @@
   17.16              if (aInfo.PropertyType == typeof(int))
   17.17              {
   17.18                  //Integer properties are using numeric editor
   17.19 -                NumericUpDown ctrl = new NumericUpDown();                
   17.20 +                NumericUpDown ctrl = new NumericUpDown();
   17.21 +                ctrl.AutoSize = true;
   17.22                  ctrl.Minimum = Int32.Parse(aAttribute.Minimum);
   17.23                  ctrl.Maximum = Int32.Parse(aAttribute.Maximum);
   17.24                  ctrl.Increment = Int32.Parse(aAttribute.Increment);
   17.25 @@ -130,6 +136,8 @@
   17.26              {
   17.27                  //Enum properties are using combo box
   17.28                  ComboBox ctrl = new ComboBox();
   17.29 +                ctrl.AutoSize = true;
   17.30 +                ctrl.Sorted = true;
   17.31                  ctrl.DropDownStyle = ComboBoxStyle.DropDownList;
   17.32                  //Data source is fine but it gives us duplicate entries for duplicated enum values
   17.33                  //ctrl.DataSource = Enum.GetValues(aInfo.PropertyType);
   17.34 @@ -140,11 +148,22 @@
   17.35                      ctrl.Items.Add(name.ToString());
   17.36                  }
   17.37  
   17.38 -                //Select the first item
   17.39 -                ctrl.SelectedItem=ctrl.Items[0];
   17.40 +                // Instantiate our enum
   17.41 +                object enumValue = Activator.CreateInstance(aInfo.PropertyType);
   17.42 +                enumValue = aInfo.GetValue(aAction);
   17.43 +                //Set the current item
   17.44 +                ctrl.SelectedItem = enumValue.ToString();
   17.45  
   17.46                  return ctrl;
   17.47              }
   17.48 +            else if (aInfo.PropertyType == typeof(bool))
   17.49 +            {
   17.50 +                CheckBox ctrl = new CheckBox();
   17.51 +                ctrl.AutoSize = true;
   17.52 +                ctrl.Text = aAttribute.Description;
   17.53 +                ctrl.Checked = (bool)aInfo.GetValue(aAction);                
   17.54 +                return ctrl;
   17.55 +            }
   17.56  
   17.57              return null;
   17.58          }
   17.59 @@ -163,6 +182,10 @@
   17.60              {
   17.61                  return true;
   17.62              }
   17.63 +            else if (aInfo.PropertyType == typeof(bool))
   17.64 +            {
   17.65 +                return true;
   17.66 +            }
   17.67  
   17.68              return false;
   17.69          }
    18.1 --- a/Server/SharpDisplayManager.csproj	Tue Jul 26 15:30:46 2016 +0200
    18.2 +++ b/Server/SharpDisplayManager.csproj	Wed Jul 27 11:07:35 2016 +0200
    18.3 @@ -155,16 +155,15 @@
    18.4    <ItemGroup>
    18.5      <Compile Include="Actions\ActionCecClose.cs" />
    18.6      <Compile Include="Actions\ActionCecDevice.cs" />
    18.7 +    <Compile Include="Actions\ActionCecDeviceType.cs" />
    18.8      <Compile Include="Actions\ActionCecInactiveSource.cs" />
    18.9      <Compile Include="Actions\ActionCecOpen.cs" />
   18.10      <Compile Include="Actions\ActionCecDevicePowerOn.cs" />
   18.11 -    <Compile Include="Actions\ActionCecPowerOnTv.cs" />
   18.12      <Compile Include="Actions\ActionCecActiveSource.cs" />
   18.13      <Compile Include="Actions\ActionCecScan.cs" />
   18.14 -    <Compile Include="Actions\ActionCecSendKeypressTvPowerOff.cs" />
   18.15 +    <Compile Include="Actions\ActionCecUserControlPressed.cs" />
   18.16      <Compile Include="Actions\ActionCecDeviceStandby.cs" />
   18.17 -    <Compile Include="Actions\ActionCecStandbyTv.cs" />
   18.18 -    <Compile Include="Actions\ActionCecSendKeypressTvPowerOn.cs" />
   18.19 +    <Compile Include="Actions\ActionCecUserControlReleased.cs" />
   18.20      <Compile Include="CbtHook.cs" />
   18.21      <Compile Include="CecClient.cs" />
   18.22      <Compile Include="ConsumerElectronicControl.cs" />
    19.1 --- a/SharpLibUtils/TypeConverterJson.cs	Tue Jul 26 15:30:46 2016 +0200
    19.2 +++ b/SharpLibUtils/TypeConverterJson.cs	Wed Jul 27 11:07:35 2016 +0200
    19.3 @@ -33,7 +33,7 @@
    19.4          }
    19.5  
    19.6          /// <summary>
    19.7 -        /// 
    19.8 +        /// Internalize
    19.9          /// </summary>
   19.10          /// <param name="context"></param>
   19.11          /// <param name="culture"></param>
   19.12 @@ -44,22 +44,35 @@
   19.13              string stringValue = value as string;
   19.14              if (stringValue != null)
   19.15              {
   19.16 -                //Load object form JSON string
   19.17 -                byte[] byteArray = Encoding.UTF8.GetBytes(stringValue);
   19.18 -                MemoryStream stream = new MemoryStream(byteArray);
   19.19 -                DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(T), new DataContractJsonSerializerSettings()
   19.20 -                {
   19.21 -                    UseSimpleDictionaryFormat = true
   19.22 -                });
   19.23 -                T settings = (T)ser.ReadObject(stream);
   19.24 -                return settings;
   19.25 +                //try
   19.26 +                //{
   19.27 +                    //Load object form JSON string
   19.28 +                    byte[] byteArray = Encoding.UTF8.GetBytes(stringValue);
   19.29 +                    MemoryStream stream = new MemoryStream(byteArray);
   19.30 +                    DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(T),
   19.31 +                        new DataContractJsonSerializerSettings()
   19.32 +                        {
   19.33 +                            UseSimpleDictionaryFormat = true
   19.34 +                        });
   19.35 +                    T settings = (T)ser.ReadObject(stream);
   19.36 +                    return settings;
   19.37 +                //}
   19.38 +                //catch (Exception ex)
   19.39 +                //{
   19.40 +                    //That's not helping with partial loading
   19.41 +                //    Console.WriteLine("WARNING: Internalize exception -" + ex.ToString() );
   19.42 +                //    return null;
   19.43 +                //}
   19.44              }
   19.45              else
   19.46 +            {
   19.47                  return base.ConvertFrom(context, culture, value);
   19.48 +            }
   19.49 +                
   19.50          }
   19.51  
   19.52          /// <summary>
   19.53 -        /// 
   19.54 +        /// Externalize
   19.55          /// </summary>
   19.56          /// <param name="context"></param>
   19.57          /// <param name="culture"></param>