public DictationState() { inputsim = SharedObjectsSingleton.Instance().inputSimulator; toast = SharedFormsSingleton.Instance().ToastOverlay; if (SettingsSingleton.Instance().DragonEnabled) { dictation = new DragonDictation(); } else { dictation = new WindowsDictation(); } Settings.Default.PropertyChanged += CheckState; }
// Checks if the dictation class is still of the correct type, and changes it if requiered public void CheckState(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName != "DragonEnabled") { return; } if (Settings.Default.DragonEnabled && dictation.GetType() == typeof (WindowsDictation)) { dictation.Dispose(); dictation = new DragonDictation(); } else if (!Settings.Default.DragonEnabled && dictation.GetType() == typeof(DragonDictation)) { dictation.Dispose(); dictation = new WindowsDictation(); } }