public async void SaveCurrentEmotionsToFolder(EmotionScores emotions, Geoposition currentPosition, string photoFileName, string folderName = "EmotionDataFolder") { var currentEmotionData = new EmotionsData() { Anger = emotions.Anger, Sadness = emotions.Sadness, Neutral = emotions.Neutral, Fear = emotions.Fear, Disgust = emotions.Disgust, Contempt = emotions.Contempt, Hapiness = emotions.Happiness, Suprise = emotions.Surprise, }; var bestEmotionKey = emotions.ToRankedList().FirstOrDefault().Key; var bestEmotionValue = emotions.ToRankedList().FirstOrDefault().Value; currentEmotionData.BestEmotionName = bestEmotionKey; currentEmotionData.BestEmotionScore = bestEmotionValue; //currentEmotionData.position = currentPosition; currentEmotionData.Longitude = currentPosition.Coordinate.Longitude; currentEmotionData.Latitude = currentPosition.Coordinate.Latitude; currentEmotionData.PhotoFileName = photoFileName; currentEmotionData.DateTaken = DateTime.Now; string fileName = DateTime.Now.ToString("yyyy-MM-dd--HH-mm-ss") + ".xml"; await SerializationController.SaveObjectToXml <EmotionsData>(currentEmotionData, fileName, folderName); }
public async Task <EmotionsData> LoadEmotionFromFolder(string emotionFileName, string folderName = "EmotionDataFolder") { var currentEmotionData = new EmotionsData(); currentEmotionData = await SerializationController.ReadObjectFromXmlFileAsync <EmotionsData>(emotionFileName, folderName); return(currentEmotionData); }
public EmotionsDataWithPicture(EmotionsData EmotionDataFile) { this.Anger = EmotionDataFile.Anger; this.Sadness = EmotionDataFile.Sadness; this.Neutral = EmotionDataFile.Neutral; this.Suprise = EmotionDataFile.Suprise; this.Fear = EmotionDataFile.Fear; this.Contempt = EmotionDataFile.Contempt; this.Disgust = EmotionDataFile.Disgust; this.BestEmotionName = EmotionDataFile.BestEmotionName; this.BestEmotionScore = EmotionDataFile.BestEmotionScore; this.Latitude = EmotionDataFile.Latitude; this.Longitude = EmotionDataFile.Longitude; this.DateTaken = EmotionDataFile.DateTaken; this.PhotoFileName = EmotionDataFile.PhotoFileName; }