Esempio n. 1
0
        protected override void ExecuteAction(string ribbonId)
        {
            LoadingDialogBox splashView = new LoadingDialogBox();

            splashView.Show();
            AzureAccountStorageService.LoadUserAccount();
            WatsonAccountStorageService.LoadUserAccount();
            AudioSettingStorageService.LoadAudioSettingPreference();
            splashView.Close();
            AudioSettingService.ShowSettingsDialog();
        }
 private void LogOutWatsonAccountButton_Click(object sender, RoutedEventArgs e)
 {
     WatsonAccount.GetInstance().Clear();
     WatsonAccountStorageService.DeleteUserAccount();
     watsonVoiceComboBox.Visibility = Visibility.Collapsed;
     watsonVoiceLoginBtn.Visibility = Visibility.Visible;
     changeWatsonAcctBtn.Visibility = Visibility.Hidden;
     logoutWatsonAcctBtn.Visibility = Visibility.Hidden;
     RadioWatsonVoice.IsEnabled     = false;
     RadioDefaultVoice.IsChecked    = true;
     WatsonRuntimeService.IsWatsonAccountPresentAndValid = false;
 }
        protected override void ExecuteAction(string ribbonId)
        {
            LoadingDialogBox splashView = new LoadingDialogBox();

            splashView.Show();
            AzureAccountStorageService.LoadUserAccount();
            WatsonAccountStorageService.LoadUserAccount();
            AudioSettingStorageService.LoadAudioSettingPreference();
            splashView.Close();
            this.RegisterTaskPane(typeof(ELearningLabTaskpane), ELearningLabText.ELearningTaskPaneLabel,
                                  ELearningTaskPaneVisibleValueChangedEventHandler);
            CustomTaskPane eLearningTaskpane = this.GetTaskPane(typeof(ELearningLabTaskpane));

            eLearningTaskpane.Visible = !eLearningTaskpane.Visible;
        }
Esempio n. 4
0
        private void ConfirmButton_Click(object sender, RoutedEventArgs e)
        {
            string _endpoint = "";
            string _key      = "";

            try
            {
                _key = key.Text.Trim();
                string region = ((ComboBoxItem)endpoint.SelectedItem).Content.ToString().Trim();
                _endpoint = EndpointToUriConverter.watsonRegionToEndpointMapping[region];
            }
            catch
            {
                MessageBox.Show("Key or Region cannot be empty!", "Invalid Input");
                return;
            }

            bool isValidAccount = WatsonRuntimeService.IsValidUserAccount(_key, _endpoint,
                                                                          "Invalid Watson Account.\nIs your Watson account expired?\nAre you connected to Wifi?");

            if (isValidAccount)
            {
                // Delete previous user account
                WatsonAccount.GetInstance().Clear();
                WatsonAccountStorageService.DeleteUserAccount();
                // Create and save new user account
                string _region = ((ComboBoxItem)endpoint.SelectedItem).Content.ToString().Trim();
                WatsonAccount.GetInstance().SetUserKeyAndRegion(_key, _region);
                WatsonAccountStorageService.SaveUserAccount(WatsonAccount.GetInstance());
                WatsonRuntimeService.IsWatsonAccountPresentAndValid = true;
                SwitchViewToPreviousPage();
            }
            else
            {
                MessageBox.Show("Invalid Watson Account.\nIs your Watson account expired?\nAre you connected to Wifi?");
            }
        }