예제 #1
0
        void LoadCompleted(object sender, NavigationEventArgs e)
        {
            //when load completed run some tasks in background

            BackgroundTaskUtils.RunBackgroundTaskWithParam("1", UpdateValuesFromPartitionTask, DoesNothing);
            BackgroundTaskUtils.RunBackgroundTaskWithParam("0", UpdateValuesFromPartitionTask, DoesNothing);
            BackgroundTaskUtils.RunBackgroundTask(CheckAudioTemperatureCommandTask);
        }
예제 #2
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();
            }
        }