Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public async Task <EmotionsData> LoadEmotionFromFolder(string emotionFileName, string folderName = "EmotionDataFolder")
        {
            var currentEmotionData = new EmotionsData();

            currentEmotionData = await SerializationController.ReadObjectFromXmlFileAsync <EmotionsData>(emotionFileName, folderName);

            return(currentEmotionData);
        }