private void Window_Closed(object sender, EventArgs e) { RemainderUI.WriteIntoFile(); MHObj = null; GC.SuppressFinalize(MHObj); GC.Collect(); }
public GideonBase() { InitializeComponent(); // var image = new BitmapImage(); // ImageBehavior.SetAnimatedSource(BgImage, (ImageSource) new ImageSourceConverter().ConvertFromString(GideonPath.Background)); GrammarTableObj = new Hashtable(); RemainderObj = new RemainderUI(); RemainderUI.ReadFromFile(); GalleryObj = new GalleryUI(); aobj = new Alaram(); try { EngineObj = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-IN")); EngineObj.SetInputToDefaultAudioDevice(); SynObj = new SpeechSynthesizer { Volume = 100 }; SynObj.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Teen, 18, System.Globalization.CultureInfo.CurrentUICulture); LoadGrammar(Modules.Gideon, Grammars.GideonGrammar); LoadGrammar(Modules.PcInfo, Grammars.PcInfoGrammar); EngineObj.RecognizeAsync(RecognizeMode.Multiple); EngineObj.SpeechRecognized += new EventHandler <SpeechRecognizedEventArgs>(Engine_SpeechRecognized); MHObj = new ModulesHandler(); MHObj.OpenModule(Modules.Remainder); dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += new EventHandler(alaramTimer); dispatcherTimer.Interval = new TimeSpan(0, 0, 1); Timer = new DispatcherTimer(); Timer.Tick += new EventHandler(showTime); Timer.Interval = new TimeSpan(0, 0, 1); Timer.Start(); date.Content = DateTime.Now.Date.ToShortDateString(); DateTimeGrid.ToolTip = DateTime.Now.ToString("F"); setBackgrounds(); WeatherUpdate(); NewsUpdate(); SetValues(); quotes = Motivational_Quotes.FetchQuotes(); Greet(); } catch (System.Net.WebException) { } catch (Exception e) { MessageBox.Show(e.ToString()); } }