private void RFButton_Click(object sender, EventArgs e) { ss.SpeakAsync("Reminder feature activated"); ReminderFeature rf = new ReminderFeature(); rf.Activated += new EventHandler(ReminderFeatureActivated); rf.ShowDialog(); }
private void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { switch (e.Result.Text.ToString()) { case "open command prompt": { Process.Start("cmd"); break; } case "open chrome": { Process.Start("chrome"); break; } case "open notepad": { Process.Start("notepad"); break; } case "activate google engine": { ss.SpeakAsync("Google Engine Online"); GoogleEngine ge = new GoogleEngine(); ge.Activated += new EventHandler(GoogleFormActivated); ge.ShowDialog(); break; } case "activate reminder feature": { ss.SpeakAsync("Reminder feature activated"); ReminderFeature rf = new ReminderFeature(); rf.Activated += new EventHandler(ReminderFeatureActivated); rf.ShowDialog(); break; } case "good morning": case "good evening": case "good afternoon": case "good night": { DateTime d = DateTime.Now; int h = d.Hour; if (h < 12) { ss.SpeakAsync("Good Morning"); } else if (h < 14) { ss.SpeakAsync("Good Afternoon"); } else if (h < 20) { ss.SpeakAsync("Good Evening"); } else { ss.SpeakAsync("Good Night"); } break; } case "igen lock the screen": { using (AfterHowMuchTime ahmt = new AfterHowMuchTime("lock")) { ahmt.ShowDialog(); } break; } case "igen shut down the computer": { using (AfterHowMuchTime ahmt = new AfterHowMuchTime("shut")) { ahmt.ShowDialog(); } break; } case "igen make the computer sleep": { using (AfterHowMuchTime ahmt = new AfterHowMuchTime("sleep")) { ahmt.ShowDialog(); } break; } case "hi": case "hello": { Random random = new Random(); int rand = random.Next(0, 3); if (rand == 0) { ss.SpeakAsync("Hey there, How can i help you today?"); } else if (rand == 1) { ss.SpeakAsync("Hey. Wonderful day isnt it "); } else { ss.SpeakAsync("Yes, what can i do for you?"); } break; } case "introduce yourself": { ss.SpeakAsync("My name is Igen. I am designed to ease up your daily tasks."); break; } } ConvoBox.Items.Add(e.Result.Text.ToString()); }