private async void DispatcherTimer_Tick(object sender, EventArgs e) { if (Preview.IsCapturing) { Bitmap bitmap = Preview.GetCurrentImage(); bitmap.Save(".\\file.jpg", ImageFormat.Jpeg); Stream fileStream = File.OpenRead(".\\file.jpg"); await EmotionControlObj.StartRecognize(fileStream); fileStream.Close(); if (EmotionControlObj.IsEmotion) { Anger.Value = EmotionControlObj.Emotions[0].Scores.Anger; Contempt.Value = EmotionControlObj.Emotions[0].Scores.Contempt; Disgust.Value = EmotionControlObj.Emotions[0].Scores.Disgust; Fear.Value = EmotionControlObj.Emotions[0].Scores.Fear; Happiness.Value = EmotionControlObj.Emotions[0].Scores.Happiness; Neutral.Value = EmotionControlObj.Emotions[0].Scores.Neutral; Sadness.Value = EmotionControlObj.Emotions[0].Scores.Sadness; Surprise.Value = EmotionControlObj.Emotions[0].Scores.Surprise; } } }