Exemplo n.º 1
0
        public async void DeserializeJSONAsync(string responseString)
        {
            var emotions = JsonConvert.DeserializeObject <EmotionModel[]>(responseString);

            var scores         = emotions[0].scores;
            var highestScore   = scores.Values.OrderByDescending(score => score).First();
            var highestEmotion = scores.Keys.First(key => scores[key] == highestScore);

            if (highestEmotion == "happiness")
            {
                EmotionCaptureModel emotion = new EmotionCaptureModel()
                {
                    Happy   = true,
                    Neutral = false,
                    Other   = false
                };
                await AzureManager.AzureManagerInstance.AddEmotion(emotion);

                currentEmotion.Text = "YOU ARE SMILING, GOOD JOB!";
            }
            else if (highestEmotion == "neutral")
            {
                EmotionCaptureModel emotion = new EmotionCaptureModel()
                {
                    Happy   = false,
                    Neutral = true,
                    Other   = false
                };
                await AzureManager.AzureManagerInstance.AddEmotion(emotion);

                currentEmotion.Text = "TOO NEUTRAL, SMILE!";
            }
            else
            {
                EmotionCaptureModel emotion = new EmotionCaptureModel()
                {
                    Happy   = false,
                    Neutral = false,
                    Other   = true
                };
                await AzureManager.AzureManagerInstance.AddEmotion(emotion);

                currentEmotion.Text = "ARE YOU EVEN TRYING, MATE?";
            }
        }
Exemplo n.º 2
0
 public async Task DeleteHistory(EmotionCaptureModel emotionCaptureModel)
 {
     await this.EmotionCaptureTable.DeleteAsync(emotionCaptureModel);
 }
Exemplo n.º 3
0
 public async Task AddEmotion(EmotionCaptureModel emotionCaptureModel)
 {
     await this.EmotionCaptureTable.InsertAsync(emotionCaptureModel);
 }