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?"; } }
public async Task DeleteHistory(EmotionCaptureModel emotionCaptureModel) { await this.EmotionCaptureTable.DeleteAsync(emotionCaptureModel); }
public async Task AddEmotion(EmotionCaptureModel emotionCaptureModel) { await this.EmotionCaptureTable.InsertAsync(emotionCaptureModel); }