public ConfirmExit() { InitializeComponent(); this.CommandReceiver = new Listener(); this.CommandReceiver.AddCommand(new Command("Yes", Yes, new List<string>() { "Yes", "Ok", "Close", "Quit" })); this.CommandReceiver.AddCommand(new Command("No", No, new List<string>() { "No", "Cancel", "Stop" })); this.CommandReceiver.Start(); Exit = false; }
public MainWindow() { // Initialise the functions CommandReceiver = new Listener(); ListenListener = new Listener(); InitialiseCommandReceivers(); InitializeComponent(); StartListening(); CommandReceiver.Start(); }
public BrowseWindow() { InitializeComponent(); Videos.Focus(); ChosenVideo = null; Page = 0; #region CommandReceiver this.CommandReceiver = new Listener(); this.CommandReceiver.AddCommand(new Command("Search", Search, new List<string>() { "Search", "Find" })); this.CommandReceiver.AddCommand(new Command("Exit", Exit, new List<string>() { "Exit", "Quit", "Close" })); this.CommandReceiver.AddCommand(new Command("Play", Play, new List<string>() { "Play", "Run", "Watch" })); this.CommandReceiver.AddCommand(new Command("Next", NextPage, new List<string>() { "Next", "Next page" })); this.CommandReceiver.AddCommand(new Command("Previous", PreviousPage, new List<string>() { "Previous", "Previous page" })); this.CommandReceiver.AddCommand(new Command("Down", () => { }, new List<string>() { "Down", "Scroll down" })); this.CommandReceiver.AddCommand(new Command("Spell", () => { CommandReceiver.Disable(); SpellerReceiver.Enable(); }, new List<string>() { "Spell", "Start spelling" })); this.CommandReceiver.AddCommand(new Command("Dictate", () => { CommandReceiver.Disable(); DictationReceiver.Enable(); }, new List<string>() { "Dictate", "Start dictating" })); #endregion #region SpellerReceiver this.SpellerReceiver = new Listener(); // Exit spell mode command this.SpellerReceiver.AddCommand(new Command("DisableSpell", () => { // Switch controls SpellerReceiver.Disable(); CommandReceiver.Enable(); }, new List<string>() { "Stop", "Stop spelling" })); // Exit spell mode, start dictation mode command this.SpellerReceiver.AddCommand(new Command("Dictate", () => { SpellerReceiver.Disable(); SpellerReceiver.Enable(); }, new List<string>() { "Dictate", "Start dictating" })); // Letters for (char CurrentLetter = 'A'; CurrentLetter <= 'Z'; CurrentLetter++) { char CurrentLetterTemp = CurrentLetter; this.SpellerReceiver.AddCommand(new Command("Letter" + CurrentLetter, () => { AddLetter(CurrentLetterTemp); }, new List<string>() { Convert.ToString(CurrentLetter) })); } // Backspace command this.SpellerReceiver.AddCommand(new Command("Backspace", () => { RemoveLastLetter(); }, new List<string>() { "Backspace", "Delete" })); // Clear command this.SpellerReceiver.AddCommand(new Command("Clear", () => { if (this.InvokeRequired) { this.Invoke(new VoidDelegate(this.SearchBox.Clear)); } else { this.SearchBox.Clear(); } }, new List<string>() { "Clear", "Empty" })); #endregion #region DictationReceiver this.DictationReceiver = new DictationListener(SearchBox.Text); // Stop dictating this.DictationReceiver.AddCommand(new Command("DisableDictate", () => { DictationReceiver.Disable(); CommandReceiver.Enable(); }, new List<string>() { "Stop", "Stop dictating" })); // Stop dictating, start spelling this.DictationReceiver.AddCommand(new Command("Spell", () => { SpellerReceiver.Enable(); DictationReceiver.Disable(); }, new List<string>() { "Spell", "Start spelling" })); #endregion this.CommandReceiver.Start(); this.Videos.SelectedIndexChanged += Videos_SelectedIndexChanged; }