コード例 #1
0
        private async void GetShirtColorButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            await localPhotoStorage.Save(PHOTO_FILE_NAME);

            var result = await imageProcessing.GetDominantForegroundColor(localPhotoStorage.GetLastPhotoSaved());

            interogationResult.Text = string.Format("Your shirt is {0} !!", result);

            PlayText(interogationResult.Text);
        }
コード例 #2
0
        private async void WhatsMyMoodButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            if (player != null)
            {
                player.songPlayer.Stop();
            }

            await localPhotoStorage.Save(PHOTO_FILE_NAME);

            var result = await imageProcessing.RecognizeEmotion(localPhotoStorage.GetLastPhotoSaved());

            List <string> listOfResults = new List <string>();

            try
            {
                await age();
            }
            catch (Exception exp)
            {
                yourAge = "20";
            }

            listOfResults.Add("Age: " + yourAge);

            for (int i = 0; i < 2; i++)
            {
                listOfResults.Add(ProjectOxford.emotions[i]);
            }

            emotionList.ItemsSource = listOfResults;

            string currentColor;

            Random rnd = new Random();

            int randomNum = (rnd.Next(1, 20)) % 2 + 1;

            player = new TrackPlayer(ProjectOxford.emotions[0] + randomNum.ToString() + ".mp3", yourAge);
            await player.PlayMediaElement();
        }