Ejemplo n.º 1
0
        /// <summary>
        /// Constructor for MainViewModel. Creates the required API clients, and ICommand objects
        /// </summary>
        public MainViewModel()
        {
            StatusText = "Status: Waiting for image...";

            _faceServiceClient = new FaceServiceClient("FACE_API_KEY", "ROOT_URI");

            BrowseButtonCommand = new DelegateCommand(Browse);
            DetectFaceCommand   = new DelegateCommand(DetectFace, CanDetectFace);

            _textToSpeak = new TextToSpeak();
            _textToSpeak.OnAudioAvailable += _textToSpeak_OnAudioAvailable;
            _textToSpeak.OnError          += _textToSpeak_OnError;
            GenerateToken();
        }
        /// <summary>
        /// Constructor for MainViewModel. Creates the required API clients, and ICommand objects
        /// </summary>
        public MainViewModel()
        {
            StatusText = "Status: Waiting for image...";

            _faceServiceClient = new FaceServiceClient("FACE_API_KEY_HERE");

            BrowseButtonCommand = new DelegateCommand(Browse);
            DetectFaceCommand   = new DelegateCommand(DetectFace, CanDetectFace);

            _textToSpeak = new TextToSpeak();
            _textToSpeak.OnAudioAvailable += _textToSpeak_OnAudioAvailable;
            _textToSpeak.OnError          += _textToSpeak_OnError;

            if (_textToSpeak.GenerateAuthenticationToken("Chapter1", "BING_SPEECH_KEY_HERE"))
            {
                _textToSpeak.GenerateHeaders();
            }
        }
 private void OnTextToSpeak(string textToSpeak)
 {
     TextToSpeak?.Invoke(this, textToSpeak);
 }