예제 #1
0
        /// <summary>
        /// Creates a speaker profile
        /// </summary>
        /// <returns>A boolean indicating the success/failure of the process</returns>
        private async Task <bool> createProfile()
        {
            lblStatus.Content = "Creating Profile...";
            try
            {
                //Stopwatch sw = Stopwatch.StartNew();
                CreateProfileResponse response = await _serviceClient.CreateProfileAsync("en-us");

                //sw.Stop();
                //lblStatus.Content = "Profile Created, Elapsed Time: " + sw.Elapsed;
                _speakerId = response.ProfileId;

                Profile profile = await _serviceClient.GetProfileAsync(_speakerId);

                txtRemainingEnrollment.Text = profile.RemainingEnrollmentsCount.ToString();
                lblStatus.Content           = "Ready for recording.";
                return(true);
            }
            catch (CreateProfileException exception)
            {
                MessageBox.Show("Cannot create profile:", "Error", MessageBoxButton.OK);
                return(false);
            }
            catch (Exception gexp)
            {
                MessageBox.Show("Error: " + gexp.Message, "Error", MessageBoxButton.OK);
                return(false);
            }
        }
예제 #2
0
        /// <summary>
        /// Creates a speaker profile
        /// </summary>
        /// <returns>A boolean indicating the success/failure of the process</returns>
        private async Task <bool> createProfile()
        {
            setStatus("Creating Profile...");
            try
            {
                Stopwatch             sw       = Stopwatch.StartNew();
                CreateProfileResponse response = await _serviceClient.CreateProfileAsync("en-us");

                sw.Stop();
                setStatus("Profile Created, Elapsed Time: " + sw.Elapsed);
                IsolatedStorageHelper _storageHelper = IsolatedStorageHelper.getInstance();
                _storageHelper.writeValue(MainWindow.SPEAKER_FILENAME, response.ProfileId.ToString());
                _speakerId = response.ProfileId;
                return(true);
            }
            catch (CreateProfileException exception)
            {
                setStatus("Cannot create profile: " + exception.Message);
                return(false);
            }
            catch (Exception gexp)
            {
                setStatus("Error: " + gexp.Message);
                return(false);
            }
        }
        /// <summary>
        /// Creates a speaker profile
        /// </summary>
        /// <returns>A boolean indicating the success/failure of the process</returns>
        private async Task <bool> createProfile()
        {
            setStatus("Creating Profile...");
            try
            {
                Stopwatch             sw       = Stopwatch.StartNew();
                CreateProfileResponse response = await _serviceClient.CreateProfileAsync("en-us");

                sw.Stop();
                setStatus("Profile Created, Elapsed Time: " + sw.Elapsed);
                IsolatedStorageHelper _storageHelper = IsolatedStorageHelper.getInstance();
                _storageHelper.writeValue(MainWindow.SPEAKER_FILENAME, response.ProfileId.ToString());
                _speakerId = response.ProfileId;

                Profile profile = await _serviceClient.GetProfileAsync(_speakerId);

                setDisplayText(profile.RemainingEnrollmentsCount.ToString(), "");

                _storageHelper.writeValue(MainWindow.SPEAKER_ENROLLMENTS, profile.RemainingEnrollmentsCount.ToString());
                _storageHelper.writeValue(MainWindow.SPEAKER_PHRASE_FILENAME, "");
                _storageHelper.writeValue(MainWindow.SPEAKER_ENROLLMENT_STATUS, "Empty");

                return(true);
            }
            catch (CreateProfileException exception)
            {
                setStatus("Cannot create profile: " + exception.Message);
                return(false);
            }
            catch (Exception gexp)
            {
                setStatus("Error: " + gexp.Message);
                return(false);
            }
        }
예제 #4
0
        public async Task <Guid> CreateProfile()
        {
            try
            {
                //Create prifile for the specified language
                CreateProfileResponse response = await serviceClient.CreateProfileAsync("en-us");

                speakerId = response.ProfileId;
                profile   = await serviceClient.GetProfileAsync(speakerId);

                Debug.WriteLine("Profile Created with SpekaerID: " + speakerId);
                profileCreated = true;
                return(speakerId);
            }
            catch (Microsoft.ProjectOxford.SpeakerRecognition.Contract.CreateProfileException e)
            {
                Debug.WriteLine("Couldn't create Profile in createProfile(): " + e.Message);
                Synthesizer.Speak("Something went wrong. Go back and try again.");
                profileCreated = false;
                return(Guid.Empty);
            }
            catch (Exception e)
            {
                Debug.WriteLine("Couldn't create Profile in createProfile(). Error: " + e.Message);
                Synthesizer.Speak("Something went wrong. Go back an try again.");
                profileCreated = false;
                return(Guid.Empty);
            }
        }
        private async void btnCreateProfile_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CreateProfileResponse response = await _serviceClient.CreateProfileAsync("en-us");

                txtInfo.Text = "Profile Created: " + response.ProfileId;
            }
            catch { }

            await GetProfiles();
        }
예제 #6
0
        private async void createProfileBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var response = await voiceServiceClient.CreateProfileAsync("en-us");

                txtBoxGuid.Text = response.ProfileId.ToString();

                LogMessage($"Profile created: {response.ProfileId}");
            }
            catch (Exception error)
            {
                LogMessage($"{error.Message}");
            }
        }
        /// <summary>
        /// Initialize the speaker information
        /// </summary>
        private async void initializeSpeaker()
        {
            try
            {
                CreateProfileResponse response = await verServiceClient.CreateProfileAsync("en-us");

                Console.WriteLine("Profile id :" + response.ProfileId.ToString());
                _speakerId = response.ProfileId;
                //_speakerId = Guid.Parse("72431ee5-d02a-4c6c-985c-1217088ed2ec");
                Profile profile = await verServiceClient.GetProfileAsync(_speakerId);

                remEnrollText.Text = profile.RemainingEnrollmentsCount.ToString();
                verPhraseText      = null;
                refreshPhrases();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.Message);
            }
        }