public static Command CreateCommandFromJson(JObject jsonData)
        {
            Command commandObject = null;

            string commandType = (string)jsonData["command type"];

            if (commandType == eCommandType.KeyPressCommand.ToString())
            {
                commandObject = new KeyPressCommand(jsonData);
            }
            else if (commandType == eCommandType.VoiceCommand.ToString())
            {
                commandObject = new VoiceCommand(jsonData);
            }
            else if (commandType == eCommandType.OpenProgramCommand.ToString())
            {
                commandObject = new OpenProgramCommand(jsonData);
            }

            return commandObject;
        }
Esempio n. 2
0
        public static Command CreateCommandFromJson(JObject jsonData)
        {
            Command commandObject = null;

            string commandType = (string)jsonData["command type"];

            if (commandType == eCommandType.KeyPressCommand.ToString())
            {
                commandObject = new KeyPressCommand(jsonData);
            }
            else if (commandType == eCommandType.VoiceCommand.ToString())
            {
                commandObject = new VoiceCommand(jsonData);
            }
            else if (commandType == eCommandType.OpenProgramCommand.ToString())
            {
                commandObject = new OpenProgramCommand(jsonData);
            }

            return(commandObject);
        }