Beispiel #1
0
        public static XDocument TogglePlugTo(SmartPlugState stateToSet)
        {
            switch (stateToSet)
            {
            case SmartPlugState.Off:
                return(XDocument.Parse(@"<?xml version=""1.0"" encoding=""utf-8""?>
                                             <SMARTPLUG id=""edimax"">
                                                <CMD id=""setup"">
                                                   <Device.System.Power.State>OFF</Device.System.Power.State>
                                                </CMD>
                                             </SMARTPLUG>"));

            case SmartPlugState.On:
                return(XDocument.Parse(@"<?xml version=""1.0"" encoding=""utf-8""?>
                                             <SMARTPLUG id=""edimax"">
                                                <CMD id=""setup"">
                                                   <Device.System.Power.State>ON</Device.System.Power.State>
                                                </CMD>
                                             </SMARTPLUG>"));

            default:
                throw new Exception(string.Format(@"Not supported parameter value: ""{0}"" for SmartPlugMessages.TurnSwitchTo(SmartPlugState stateToSet)",
                                                  stateToSet.ToString()));
            }
        }
 public static XDocument TogglePlugTo(SmartPlugState stateToSet)
 {
     switch (stateToSet)
     {
         case SmartPlugState.Off:
             return XDocument.Parse(@"<?xml version=""1.0"" encoding=""utf-8""?>
                                      <SMARTPLUG id=""edimax"">
                                         <CMD id=""setup"">
                                            <Device.System.Power.State>OFF</Device.System.Power.State>
                                         </CMD>
                                      </SMARTPLUG>");
         case SmartPlugState.On:
             return XDocument.Parse(@"<?xml version=""1.0"" encoding=""utf-8""?>
                                      <SMARTPLUG id=""edimax"">
                                         <CMD id=""setup"">
                                            <Device.System.Power.State>ON</Device.System.Power.State>
                                         </CMD>
                                      </SMARTPLUG>");
         default:
             throw new Exception(string.Format(@"Not supported parameter value: ""{0}"" for SmartPlugMessages.TurnSwitchTo(SmartPlugState stateToSet)",
                                        stateToSet.ToString()));
     }
 }