Esempio n. 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (Validate())
            {
                BaseWindow obj = new BaseWindow();
                obj.SettingsInsertUpdate("Name", Name.Text);
                obj.SettingsInsertUpdate("Gender", gender);
                obj.SettingsInsertUpdate("Language Preference", LangPre.Text);
                obj.SettingsInsertUpdate("BING API Key", BINGKEY.Text);
                obj.SettingsInsertUpdate("Mode", Mode.IsChecked == true ? "Voice Mode" : "Text Mode");

                if (obj.GetCurrentModeType() == "Voice Mode")
                {
                    TextToSpeech.SpeakAsync("Successfully updated your information!!!");
                }
            }
        }
Esempio n. 2
0
        public bool Validate()
        {
            bool       res = true;
            BaseWindow obj = new BaseWindow();

            if (String.IsNullOrEmpty(Name.Text))
            {
                if (obj.GetCurrentModeType() == "Voice Mode")
                {
                    TextToSpeech.SpeakAsync("Please fill up the Name!!!");
                }
                res = false;
            }
            if (String.IsNullOrEmpty(gender))
            {
                if (obj.GetCurrentModeType() == "Voice Mode")
                {
                    TextToSpeech.SpeakAsync("Please select the gender!!!");
                }
                res = false;
            }

            if (LangPre.SelectedItem == null)
            {
                if (obj.GetCurrentModeType() == "Voice Mode")
                {
                    TextToSpeech.SpeakAsync("Please select the Language Preference!!!");
                }
                res = false;
            }

            if (String.IsNullOrEmpty(BINGKEY.Text))
            {
                if (obj.GetCurrentModeType() == "Voice Mode")
                {
                    TextToSpeech.SpeakAsync("Please fill up the BING API Key!!!");
                }
                res = false;
            }

            return(res);
        }