/// <summary>
        /// Initializes a new instance of the <see cref="MainPageViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="petCareService">The photo service.</param>
        /// <param name="authEnforcementHandler">The auth enforcement handler.</param>
        /// <param name="dialogService">The dialog service</param>
        public MainPageViewModel(INavigationFacade navigationFacade, IPetCareService petCareService,
                                 IAuthEnforcementHandler authEnforcementHandler, IDialogService dialogService)
        {
            _navigationFacade       = navigationFacade;
            _petCareService         = petCareService;
            _authEnforcementHandler = authEnforcementHandler;
            _dialogService          = dialogService;

            // Initialize collections.
            TopImages = new ObservableCollection <ReturnAccessory>();

            try
            {
                InitializeCategoryItems().Wait();
            }
            catch (AggregateException)
            {
                //throw;
            }

            // Initialize commands
            ShowAllCommand = new RelayCommand <ReturnAccessoryCombination>(OnShowAllSelected);
            //PhotoThumbnailSelectedCommand = new RelayCommand<PhotoThumbnail>(OnPhotoThumbnailSelected);
            PhotoThumbnailSelectedCommand = new RelayCommand <ReturnAccessory>(OnPhotoThumbnailSelected);
            //HeroImageSelectedCommand = new RelayCommand<Photo>(OnHeroImageSelected);
            GiveGoldCommand     = new RelayCommand <Photo>(OnGiveGold);
            UserSelectedCommand = new RelayCommand <User>(OnUserSelected);

            IsUserSignedIn = AppEnvironment.Instance.CurrentUser != null;
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StreamViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="authEnforcementHandler">the authentication enforcement handler</param>
        /// <param name="dialogService">The dialog service.</param>
        public StreamViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
                               IAuthEnforcementHandler authEnforcementHandler, IDialogService dialogService)
        {
            _navigationFacade       = navigationFacade;
            _authEnforcementHandler = authEnforcementHandler;
            _dialogService          = dialogService;

            Photos = new IncrementalLoadingCollection <Photo>(s =>
            {
                Func <Task <PagedResponse <Photo> > > f = async() =>
                {
                    var stream = await photoService.GetPhotosForCategoryId(Category.Id, s);

                    if (SelectedPhotoThumbnail != null &&
                        SelectedPhoto == null)
                    {
                        SelectedPhoto = stream.Items.FindPhotoForThumbnail(SelectedPhotoThumbnail);
                    }

                    return(stream);
                };

                return(f());
            }, async() => await _dialogService.ShowGenericServiceErrorNotification());

            // Initialize commands
            RefreshCommand       = new RelayCommand(OnRefresh);
            GotoCameraCommand    = new RelayCommand(OnGotoCamera);
            GiveGoldCommand      = new RelayCommand <Photo>(OnGiveGold);
            PhotoSelectedCommand = new RelayCommand <Photo>(OnPhotoSelected);
            ContributeCommand    = new RelayCommand(OnGotoCamera);
            UserSelectedCommand  = new RelayCommand <User>(OnUserSelected);
        }
 public LicensingFacade(TelemetryClient telemetryClient, IPhotoService photoService,
                        IAuthEnforcementHandler authEnforcementHandler)
 {
     _telemetryClient        = telemetryClient;
     _photoService           = photoService;
     _authEnforcementHandler = authEnforcementHandler;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="StreamViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="authEnforcementHandler">the authentication enforcement handler</param>
        /// <param name="dialogService">The dialog service.</param>
        public StreamViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
            IAuthEnforcementHandler authEnforcementHandler, IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _authEnforcementHandler = authEnforcementHandler;
            _dialogService = dialogService;

            Photos = new IncrementalLoadingCollection<Photo>(s =>
            {
                Func<Task<PagedResponse<Photo>>> f = async () =>
                {
                    var stream = await photoService.GetPhotosForCategoryId(Category.Id, s);

                    if (SelectedPhotoThumbnail != null
                        && SelectedPhoto == null)
                    {
                        SelectedPhoto = stream.Items.FindPhotoForThumbnail(SelectedPhotoThumbnail);
                    }

                    return stream;
                };

                return f();
            }, async () => await _dialogService.ShowGenericServiceErrorNotification());

            // Initialize commands
            RefreshCommand = new RelayCommand(OnRefresh);
            GotoCameraCommand = new RelayCommand(OnGotoCamera);
            GiveGoldCommand = new RelayCommand<Photo>(OnGiveGold);
            PhotoSelectedCommand = new RelayCommand<Photo>(OnPhotoSelected);
            ContributeCommand = new RelayCommand(OnGotoCamera);
            UserSelectedCommand = new RelayCommand<User>(OnUserSelected);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UploadViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="authEnforcementHandler">Authentication enforcement handler.</param>
        /// <param name="uploadFinishedHandler">The handler that is called when the upload finished.</param>
        /// <param name="dialogService">The dialog service.</param>
        public UploadViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
                               IAuthEnforcementHandler authEnforcementHandler, IUploadFinishedHandler uploadFinishedHandler,
                               IDialogService dialogService)
        {
            _navigationFacade       = navigationFacade;
            _photoService           = photoService;
            _authEnforcementHandler = authEnforcementHandler;
            _uploadFinishedHandler  = uploadFinishedHandler;
            _dialogService          = dialogService;

            // Initialize commands
            UploadCommand         = new RelayCommand(OnUpload, () => !IsBusy);
            ChooseCategoryCommand = new RelayCommand(OnChooseCategory, () => !IsBusy);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PhotoDetailsViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="authEnforcementHandler">The auth enforcement handler.</param>
        /// <param name="dialogService">The dialog service.</param>
        public PhotoDetailsViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
                                     IAuthEnforcementHandler authEnforcementHandler, IDialogService dialogService)
        {
            _navigationFacade       = navigationFacade;
            _photoService           = photoService;
            _authEnforcementHandler = authEnforcementHandler;
            _dialogService          = dialogService;

            // Initialize commands
            GotoCameraCommand       = new RelayCommand(OnGotoCamera);
            DeleteAnnotationCommand = new RelayCommand(OnDeleteAnnotation);
            GiveGoldCommand         = new RelayCommand(OnGiveGold);
            ReportPhotoCommand      = new RelayCommand <ReportReason>(OnReportPhoto);
            ReportAnnotationCommand = new RelayCommand(OnReportAnnotation);
            EditPhotoCommand        = new RelayCommand(OnEditPhoto);
        }
示例#7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CategoriesViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="authEnforcementHandler">The auth enforcement handler.</param>
        /// <param name="dialogService">The dialog service</param>
        public CategoriesViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
                                   IAuthEnforcementHandler authEnforcementHandler, IDialogService dialogService)
        {
            _navigationFacade       = navigationFacade;
            _photoService           = photoService;
            _authEnforcementHandler = authEnforcementHandler;
            _dialogService          = dialogService;

            // Initialize collections.
            HeroImages = new ObservableCollection <Photo>();

            // Initialize commands
            CategorySelectedCommand       = new RelayCommand <CategoryPreview>(OnCategorySelected);
            PhotoThumbnailSelectedCommand = new RelayCommand <PhotoThumbnail>(OnPhotoThumbnailSelected);
            HeroImageSelectedCommand      = new RelayCommand <Photo>(OnHeroImageSelected);
            GiveGoldCommand = new RelayCommand <Photo>(OnGiveGold);

            IsUserSignedIn = AppEnvironment.Instance.CurrentUser != null;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PhotoDetailsViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="authEnforcementHandler">The auth enforcement handler.</param>
        /// <param name="dialogService">The dialog service.</param>
        public PhotoDetailsViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
            IAuthEnforcementHandler authEnforcementHandler, IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _photoService = photoService;
            _authEnforcementHandler = authEnforcementHandler;
            _dialogService = dialogService;

            // Initialize commands
            GotoCameraCommand = new RelayCommand(OnGotoCamera);
            DeleteAnnotationCommand = new RelayCommand(OnDeleteAnnotation);
            GiveGoldCommand = new RelayCommand(OnGiveGold);
            ReportPhotoCommand = new RelayCommand<ReportReason>(OnReportPhoto);
            ReportAnnotationCommand = new RelayCommand(OnReportAnnotation);
            EditPhotoCommand = new RelayCommand(OnEditPhoto);
            UserSelectedCommand = new RelayCommand<User>(OnUserSelected);
        }
 public LicensingFacade(IPhotoService photoService,
     IAuthEnforcementHandler authEnforcementHandler)
 {
     _photoService = photoService;
     _authEnforcementHandler = authEnforcementHandler;
 }
 public LicensingFacade(IPhotoService photoService,
                        IAuthEnforcementHandler authEnforcementHandler)
 {
     _photoService           = photoService;
     _authEnforcementHandler = authEnforcementHandler;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CategoriesViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="authEnforcementHandler">The auth enforcement handler.</param>
        /// <param name="dialogService">The dialog service</param>
        public CategoriesViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
            IAuthEnforcementHandler authEnforcementHandler, IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _photoService = photoService;
            _authEnforcementHandler = authEnforcementHandler;
            _dialogService = dialogService;

            // Initialize collections.
            HeroImages = new ObservableCollection<Photo>();

            // Initialize commands
            CategorySelectedCommand = new RelayCommand<CategoryPreview>(OnCategorySelected);
            PhotoThumbnailSelectedCommand = new RelayCommand<PhotoThumbnail>(OnPhotoThumbnailSelected);
            HeroImageSelectedCommand = new RelayCommand<Photo>(OnHeroImageSelected);
            GiveGoldCommand = new RelayCommand<Photo>(OnGiveGold);
            UserSelectedCommand = new RelayCommand<User>(OnUserSelected);

            IsUserSignedIn = AppEnvironment.Instance.CurrentUser != null;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UploadViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="authEnforcementHandler">Authentication enforcement handler.</param>
        /// <param name="uploadFinishedHandler">The handler that is called when the upload finished.</param>
        /// <param name="dialogService">The dialog service.</param>
        public UploadViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
            IAuthEnforcementHandler authEnforcementHandler, IUploadFinishedHandler uploadFinishedHandler,
            IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _photoService = photoService;
            _authEnforcementHandler = authEnforcementHandler;
            _uploadFinishedHandler = uploadFinishedHandler;
            _dialogService = dialogService;

            // Initialize commands
            UploadCommand = new RelayCommand(OnUpload, () => !IsBusy);
            ChooseCategoryCommand = new RelayCommand(OnChooseCategory, () => !IsBusy);
        }
示例#13
0
 public LicensingFacade(IPetCareService petCareService,
                        IAuthEnforcementHandler authEnforcementHandler)
 {
     _petCareService         = petCareService;
     _authEnforcementHandler = authEnforcementHandler;
 }