private static void HandleCommand(string command) { if (command.Contains("открыть")) { string program = command.Replace("открыть ", ""); commands.OpenProgram(dictionary.FindProgramName(program)); return; } if (command.Contains("закрыть")) { string program = command.Replace("закрыть ", ""); commands.CloseProgram(dictionary.FindProgramName(program)); return; } if (command.Contains("увеличить звук")) { commands.VolumeUp(); return; } if (command.Contains("уменьшить звук")) { commands.VolumeDown(); return; } if (command.Contains("записать")) { string text = command.Replace("записать ", ""); form.Invoke(new Action(() => NotepadCommands.EnterText(text))); SendMessage("success"); return; } if (command.Contains("сохранить")) { String timeStamp = DateTime.Now.ToShortDateString(); commands.SaveNotepadText(timeStamp); return; } else { SendMessage("error"); } }
void Commands.SaveNotepadText(String timeStamp) { form.Invoke(new Action(() => NotepadCommands.SaveText(timeStamp))); SendMessage("success"); }