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);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PostPhoto(int productId, IList <IFormFile> photos)
        {
            // todo validate file
            // todo create list and use addRange
            foreach (var photo in photos)
            {
                var uploadResult = await _photoStorage.Save(photo);

                var photoEntry = new Photo()
                {
                    ProductId   = productId,
                    OriginalUrl = uploadResult.Uri.ToString()
                };
                _context.Photos.Add(photoEntry);


                await _context.SaveChangesAsync();

                await _bus.Publish(new PhotoAddedEvent()
                {
                    OriginalUrl = photoEntry.OriginalUrl,
                    PhotoId     = photoEntry.PhotoId,
                    ProductId   = photoEntry.ProductId
                });
            }

            // todo send events to resizer

            return(Accepted());
        }
Ejemplo n.º 3
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();
        }