Пример #1
0
        public string Call(string command)
        {
            var subCommands = "";

            if (command.StartsWith("Options change"))
            {
                subCommands = command.Substring(14).Trim();
                command     = "Options change";
            }

            var possibleCommands = new Dictionary <string, Action>
            {
                { "Tv On", delegate { isOnline = true; } },
                { "Tv Off", delegate { isOnline = false; } },
                { "Volume Up", delegate { currentOptions["volume"] += 10; } },
                { "Volume Down", delegate { currentOptions["volume"] -= 10; } },
                { "Options change", delegate { ChangeOptions(subCommands); } },
            };

            if (command == "Options show")
            {
                var optionsShower = new OptionsShower(currentOptions, isOnline);
                return(optionsShower.ShowOptions());
            }

            possibleCommands[command]();
            return(null);
        }
 public RemoteController()
 {
     _optionsShower = new OptionsShower(this);
 }
 public RemoteController()
 {
     _optionsShower = new OptionsShower(this);
     currentSettings.Add("brightness", 30);
     currentSettings.Add("contrast", 30);
 }