Exemplo n.º 1
0
        public void closeCommandWindow()
        {
            frmCustom cust = FormControls.getForm <frmCustom>();

            cust.isShown          = false;
            cust.tmrSlide.Enabled = true;
        }
Exemplo n.º 2
0
        // CONVERSATION

        public void frmMain_Load(object sender, EventArgs e)
        {
            R_Speech = new R_Lib.R_Speech(FormControls.getForm <frmMain>().rt_Convo);

            #region setup db connection

            //System.IO.File.Delete(Application.StartupPath + @"\rioDB.sdf"); //Testing script
            #endregion setup db connection

            R_Speech.loadSystemVocabs(); // load rio default commands
            // loadShellGrammar
            ActionResult shellGrammar = R_Speech.loadShellGrammar();
            if (shellGrammar.success)
            {
                if (shellGrammar.msg == "AddCommand")
                {
                    frmCustom cust = new frmCustom();
                    cust.isShown = true;
                    cust.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show(shellGrammar.msg);
            }
            //loadDictationGrammar();
            //R_Speech.R_SpeakAsync("Dictation grammars loaded");

            // load default microphone
            R_Speech.R_recognizer.SetInputToDefaultAudioDevice();
            // sets the program to interpret multiple commands
            R_Speech.R_recognizer.RecognizeAsync(RecognizeMode.Multiple);
        }
Exemplo n.º 3
0
 public void addCommand()
 {
     if (!customIsOpened())
     {
         custom = new frmCustom();
         custom.Show();
         custom.isShown = true;
     }
 }
Exemplo n.º 4
0
        public void UpdateCommands()
        {
            R_Speech.SpeakAsync("This may take a few seconds");
            custom = new frmCustom();
            custom.CustomSave();
            try
            {
                if (R_Speech.R_shellcommandgrammar != null)
                {
                    R_Speech.R_recognizer.UnloadGrammar(R_Speech.R_shellcommandgrammar);
                }
                R_Speech.loadShellGrammar();
            }
            catch (Exception ex) { R_Speech.SpeakAsync("Error while updating commands(UpdateCommands())\r\n" + ex.Message); }

            R_Speech.SpeakAsync("All commands updated");
        }
Exemplo n.º 5
0
        public void getUnreadEmails()
        {
            R_Speech.SpeakCancelAll();
            R_Speech.SpeakAsync("Checking");
            TempCounter = 0;
            emailID     = 0;
            try
            {
                System.Net.WebClient objClient = new System.Net.WebClient();
                string response;
                //string fullcount;
                string Title;
                string Summary;
                string SenderName;
                string SenderEmail;
                string href;

                //Creating a new xml document
                XmlDocument doc = new XmlDocument();

                //Logging in Gmail server to get data
                string email = Settings.Default.Email;
                string pass  = Settings.Default.Password;
                objClient.Credentials = new System.Net.NetworkCredential(email, pass);
                //reading data and converting to string
                try
                {
                    response = Encoding.UTF8.GetString(objClient.DownloadData(@"https://mail.google.com/mail/feed/atom/"));
                    response = response.Replace(@"<feed version=""0.3"" xmlns=""http://purl.org/atom/ns#"">", @"<feed>");
                    //loading into an XML so we can get information easily
                    doc.LoadXml(response);
                    //nr of emails
                    string nr = doc.SelectSingleNode(@"/feed/fullcount").InnerText;
                    //Reading the title and the summary for every email
                    foreach (XmlNode node in doc.SelectNodes(@"/feed/entry"))
                    {
                        Title       = node.SelectSingleNode("title").InnerText;
                        Summary     = node.SelectSingleNode("summary").InnerText + "...";
                        SenderName  = node.SelectSingleNode("author").FirstChild.InnerText;
                        SenderEmail = node.SelectSingleNode("author").LastChild.InnerText;
                        href        = node.SelectSingleNode("link").Attributes["href"].Value;

                        ArraySenderEmail[TempCounter] = SenderEmail;
                        ArraySenderName[TempCounter]  = SenderName;
                        ArrayTitle[TempCounter]       = Title;
                        ArraySummary[TempCounter]     = Summary;
                        ArrayHref[TempCounter]        = href;
                        TempCounter++;
                    }
                    if (Convert.ToInt32(nr) == 0)
                    {
                        R_Speech.SpeakAsync("You have no new emails");
                    }
                    else
                    {
                        R_Speech.QEvent = "read email";
                        R_Speech.AEvent = "";
                        R_Speech.Speak("You have " + nr + " new emails. I can read the latest 20 items. Would you like me to read them for you sir?");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: " + ex.Message + "\n" + ex.ToString());
                    if (ex.Message == "The remote name could not be resolved: 'mail.google.com'")
                    {
                        R_Speech.SpeakAsync("I'm sorry sir, it appears we cannot connect to the email server.");
                    }
                    else
                    {
                        R_Speech.SpeakAsync("invalid login information");
                        custom = new frmCustom();
                        custom.Show();
                        custom.isShown = true;
                        custom.tabControl1.SelectedIndex = 1;
                        custom.txtEmail.Focus();
                    }
                }
            }
            catch (Exception exe)
            {
                MessageBox.Show("check your network connection: " + exe.Message);
            }
        }