Пример #1
0
        /*
         *  invoked when javascript invokes C#
         */
        async void WebView_ScriptNotify(object sender, NotifyEventArgs e)
        {
            string value = e.Value;

            //invokes corresponding process depending on what value is sent by javascript
            if (value.Contains("temperature="))
            {
                var tempValueCommand = value;
                BackgroundTaskUtils.RunBackgroundTaskWithParam(tempValueCommand, SendCloudToDevice.SendCommand, UpdateCommandTimestampTask);
            }
            else if (value == "enable_speech")
            {
                SpeechRecognitionEngine.RecognizeSpeech();
                //uncomment row below and comment row above for continuous speech mechanism
                //ContinuousSpeechRecognitionEngine.InitContinuousSpeechRecognition();
            }
            else if (value == "disable_speech")
            {
                ContinuousSpeechRecognitionEngine.StopSpeechRecognitionMechanism();
            }
        }