コード例 #1
0
        private void ShowCategory(string name)
        {
            var firstCategory = TopCategories.FirstOrDefault(c => c.Name == name);

            IsCategorySelected  = firstCategory != null;
            SelectedTopCategory = firstCategory;
        }
コード例 #2
0
 private void InitCategories()
 {
     Categories = TopCategories.Select(c => new Category
     {
         Id   = c.Id,
         Name = c.Name
     }).ToList();
 }
コード例 #3
0
        private void OnPhotoThumbnailSelected(PhotoThumbnail photoThumbnail)
        {
            var categoryPreview = TopCategories.SingleOrDefault(c => c.PhotoThumbnails.Contains(photoThumbnail));

            if (categoryPreview != null)
            {
                _navigationFacade.NavigateToPhotoStream(categoryPreview, photoThumbnail);
            }
        }
コード例 #4
0
        private void OnPhotoThumbnailSelected(ReturnAccessory accessory)
        {
            var categoryPreview = TopCategories.SingleOrDefault(c => c.ListOfAccessory.Contains(accessory));

            if (categoryPreview != null)
            {
                //_navigationFacade.NavigateToPhotoStream(categoryPreview, accessory);
                _navigationFacade.NavigateToAccessoryDetail(categoryPreview, accessory);
                //_navigationFacade.NavigateToRegisterPage();
            }
        }
コード例 #5
0
        /// <summary>
        /// Creates a new category.
        /// </summary>
        /// <param name="categoryName">The category name.</param>
        /// <returns>The category.</returns>
        public async Task <Category> CreateCategory(string categoryName)
        {
            await SimulateWaitAndError();

            var categoryPreview = new CategoryPreview
            {
                Id              = Guid.NewGuid().ToString(),
                Name            = categoryName,
                PhotoThumbnails = new List <PhotoThumbnail>()
            };

            TopCategories.Add(categoryPreview);

            return(categoryPreview.ToCategory());
        }
コード例 #6
0
        /// <summary>
        /// Loads the state.
        /// </summary>
        public override async Task LoadState()
        {
            await base.LoadState();

            IsBusy = true;
            IsStatusContainerVisible = true;

            try
            {
                TopCategories.Clear();

                // Load hero images
                //var heroImages = await _petCareService.GetHeroImages(NumberOfHeroImages);
                TopImages.Clear();
                //heroImages.ForEach(h => HeroImages.Add(h));


                // Load categories
                InitializeCategoryItems().Wait();
                var categories =
                    AccessoryCombinations;

                IsEmptyDataMessageVisible = !categories.Any();
                IsStatusContainerVisible  = !categories.Any();

                for (int i = 0; i < 4; i++)
                {
                    TopImages.Add(categories[0].ListOfAccessory[i]);
                }

                foreach (var c in categories)
                {
                    TopCategories.Add(c);

                    // For UI animation purposes, we wait a little until the next
                    // element is inserted.
                    await Task.Delay(200);
                }
            }
            catch (ServiceException)
            {
                await _dialogService.ShowGenericServiceErrorNotification();
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #7
0
        /// <summary>
        /// Retrieves top categories with thumbnails.
        /// </summary>
        /// <param name="categoryThumbnailsCount">The number of thumbnails per each category.</param>
        /// <param name="continuationToken">Optional. The continuation token. By default, null.</param>
        /// <returns>The category list.</returns>
        public async Task <List <CategoryPreview> > GetTopCategories(int categoryThumbnailsCount, string continuationToken = null)
        {
            await SimulateWaitAndError();

            if (!string.IsNullOrEmpty(continuationToken))
            {
                return(new List <CategoryPreview>());
            }

            return(TopCategories.Select(c => new CategoryPreview
            {
                Id = c.Id,
                Name = c.Name,
                PhotoThumbnails = c.PhotoThumbnails.Take(categoryThumbnailsCount).ToList()
            }).ToList());
        }
コード例 #8
0
        private void InitPhotoStreams()
        {
            PhotoStreams = new List <PhotoStream>();

            var captions = new[]
            {
                "Yay!",
                "Having a good day!",
                "Enjoying... :)",
                "Isn't that a beautiful shot?",
                "I like it this way!",
                "Love it!",
                "Look at this..."
            };

            var users     = _sampleUsers;
            var userIndex = 0;

            PhotoStreams.AddRange(TopCategories.Select(c =>
            {
                var createdAtMinutes = 45;

                return(new PhotoStream
                {
                    CateogoryId = c.Id,
                    Photos = c.PhotoThumbnails.Select(thumb => new Photo
                    {
                        Id = Guid.NewGuid().ToString(),
                        Caption = captions[_random.Next(captions.Length)],
                        ThumbnailUrl = thumb.ImageUrl,
                        HighResolutionUrl = thumb.ImageUrl.Replace("_tn", ""),
                        StandardUrl = thumb.ImageUrl.Replace("_tn", ""),
                        CreatedAt = DateTime.Now.AddMinutes(createdAtMinutes -= 55),
                        User = users[userIndex++ % users.Count],
                        GoldCount = _random.Next(10),
                        NumberOfAnnotations = 2,
                        CategoryId = c.Id,
                        CategoryName = c.Name,
                        Status = PhotoStatus.Active
                    })
                             .OrderByDescending(p => p.CreatedAt)
                             .ToList()
                });
            }));
        }
コード例 #9
0
        /// <summary>
        /// Loads the state.
        /// </summary>
        public override async Task LoadState()
        {
            await base.LoadState();

            IsBusy = true;
            IsStatusContainerVisible = true;

            try
            {
                TopCategories.Clear();

                // Load hero images
                var heroImages = await _photoService.GetHeroImages(NumberOfHeroImages);

                HeroImages.Clear();
                heroImages.ForEach(h => HeroImages.Add(h));

                // Load categories
                var categories =
                    await _photoService.GetTopCategories(AppEnvironment.Instance.CategoryThumbnailsCount);

                IsEmptyDataMessageVisible = !categories.Any();
                IsStatusContainerVisible  = !categories.Any();

                foreach (var c in categories)
                {
                    TopCategories.Add(c);

                    // For UI animation purposes, we wait a little until the next
                    // element is inserted.
                    await Task.Delay(200);
                }
            }
            catch (ServiceException)
            {
                await _dialogService.ShowGenericServiceErrorNotification();
            }
            finally
            {
                IsBusy = false;
            }
        }