/// <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;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WelcomeViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        public WelcomeViewModel(INavigationFacade navigationFacade)
        {
            _navigationFacade = navigationFacade;
            NavigateToTargetPageCommand = new RelayCommand<InstructionItem>(OnNavigateToTargetPage);

            InitializeInstructionItems();
        }
Exemple #3
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);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProfileViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="telemetryClient">The telemetry client</param>
        /// <param name="dialogService">The dialog service.</param>
        public ProfileViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
                                TelemetryClient telemetryClient, IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _photoService     = photoService;
            _telemetryClient  = telemetryClient;
            _dialogService    = dialogService;

            Photos = new IncrementalLoadingCollection <Photo>(s =>
            {
                Func <Task <PagedResponse <Photo> > > f = async() =>
                {
                    var stream = await photoService.GetPhotosForCurrentUser(s);
                    return(stream);
                };
                return(f());
            }, async() => await _dialogService.ShowGenericServiceErrorNotification(),
                                                              OnPhotosLoadingFinished);

            // Photos collection is being loaded asynchronously, so we need to
            // watch it to see if the user has any pictures uploaded already.
            Photos.CollectionChanged += PhotosCollectionChanged;

            // Initialize commands
            PhotoSelectedCommand   = new RelayCommand <Photo>(OnPhotoSelected);
            DeletePhotoCommand     = new RelayCommand <Photo>(OnDeletePhoto);
            SetProfilePhotoCommand = new RelayCommand <Photo>(OnSetProfilePhoto);

            // Before pictures are retrieved from the service,
            // we want to prevent an initial notification showing up
            // that the user has no pictures.
            ArePhotosEmpty = false;

            CurrentUser = AppEnvironment.Instance.CurrentUser;
        }
        /// <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);
        }
Exemple #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WelcomeViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        public WelcomeViewModel(INavigationFacade navigationFacade)
        {
            _navigationFacade           = navigationFacade;
            NavigateToTargetPageCommand = new RelayCommand <InstructionItem>(OnNavigateToTargetPage);

            InitializeInstructionItems();
        }
 public SqlServersMenuItem2(INavigationFacade navigation) : base(navigation)
 {
     _navigation = navigation;
     Image       = new BitmapImage(new Uri("ms-appx:///Assets/MenuIcons/table-1.png"));
     Children.Add(new SqlServersMenuItem3(null));
     Children.Add(new SqlServersMenuItem4(null));
     Children.Add(new SqlServersMenuItem5(null));
 }
Exemple #8
0
        public HomeViewModel(INavigationFacade navigationFacade)
        {
            _navigationFacade = navigationFacade;
            datum             = new MonatYearDaten();

            InitializePieChartItems();
            InitiolizeListItemsAsync();
        }
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="dialogService">The dialog service.</param>
        public UploadPhotoControlViewModel(INavigationFacade navigationFacade, IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _dialogService = dialogService;

            // Initialize commands
            TakePhotoCommand = new RelayCommand(OnTakePhoto);
            BrowsePicturesLibraryCommand = new RelayCommand(OnBrowsePictures);
        }
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="dialogService">The dialog service.</param>
        public UploadPhotoControlViewModel(INavigationFacade navigationFacade, IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _dialogService    = dialogService;

            // Initialize commands
            TakePhotoCommand             = new RelayCommand(OnTakePhoto);
            BrowsePicturesLibraryCommand = new RelayCommand(OnBrowsePictures);
        }
Exemple #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LeaderboardViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="dialogService">The dialog service.</param>
        public LeaderboardViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
                                    IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _photoService     = photoService;
            _dialogService    = dialogService;

            PhotoSelectedCommand    = new RelayCommand <Photo>(OnPhotoSelected);
            CategorySelectedCommand = new RelayCommand <Category>(OnCategorySelected);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LeaderboardViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="dialogService">The dialog service.</param>
        public LeaderboardViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
            IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _photoService = photoService;
            _dialogService = dialogService;

            PhotoSelectedCommand = new RelayCommand<Photo>(OnPhotoSelected);
            CategorySelectedCommand = new RelayCommand<Category>(OnCategorySelected);
            UserSelectedCommand = new RelayCommand<User>(OnUserSelected);
        }
        public SignInViewModel(INavigationFacade navigationFacade)
        {
            _navigationFacade = navigationFacade;

            // Initialize commands
            //ChooseAuthProviderCommand = new RelayCommand<MobileServiceAuthenticationProvider>(OnChooseAuthProvider);

            NavigateToTargetPageCommand = new RelayCommand(OnNavigateToTargetPage);
            // Initialize auth providers
            //AuthenticationProviders = photoService.GetAvailableAuthenticationProviders();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SettingsViewModel" /> class.
        /// </summary>
        /// <param name="photoService">The photo service.</param>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="dialogService">The dialog service.</param>
        public SettingsViewModel(IPhotoService photoService, INavigationFacade navigationFacade,
            IDialogService dialogService)
        {
            _photoService = photoService;
            _navigationFacade = navigationFacade;
            _dialogService = dialogService;

            PrivacyCommand = new RelayCommand(OnShowPrivacyPolicy);
            AboutCommand = new RelayCommand(OnShowAbout);
            SignOutCommand = new RelayCommand(OnSignOut);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SettingsViewModel" /> class.
        /// </summary>
        /// <param name="photoService">The photo service.</param>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="dialogService">The dialog service.</param>
        public SettingsViewModel(IPhotoService photoService, INavigationFacade navigationFacade,
                                 IDialogService dialogService)
        {
            _photoService     = photoService;
            _navigationFacade = navigationFacade;
            _dialogService    = dialogService;

            PrivacyCommand = new RelayCommand(OnShowPrivacyPolicy);
            AboutCommand   = new RelayCommand(OnShowAbout);
            SignOutCommand = new RelayCommand(OnSignOut);
        }
Exemple #16
0
        //private readonly IPhotoService photoService;

        /// <summary>
        /// Initializes a new instance of the <see cref="SettingsViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="dialogService">The dialog service.</param>
        public SettingsViewModel(INavigationFacade navigation,
                                 IDialogService dialog)
        {
            //photoService = photo;
            navigationFacade = navigation;
            dialogService    = dialog;

            PrivacyCommand = new RelayCommand(OnShowPrivacyPolicy);
            AboutCommand   = new RelayCommand(OnShowAbout);
            SignOutCommand = new RelayCommand(OnSignOut);
        }
        public SignInViewModel(INavigationFacade navigationFacade, IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _dialogService    = dialogService;
            _apiService       = new ApiService();

            SignInCommand      = new RelayCommand(SignIn);
            AccountAndPassword = new SignInInput()
            {
                Account = "arcsinw", Password = "******"
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LeaderboardViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="dialogService">The dialog service.</param>
        public LeaderboardViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
                                    IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _photoService     = photoService;
            _dialogService    = dialogService;
            _resourceLoader   = ResourceLoader.GetForCurrentView();

            PhotoSelectedCommand    = new RelayCommand <Photo>(OnPhotoSelected);
            CategorySelectedCommand = new RelayCommand <Category>(OnCategorySelected);
            UserSelectedCommand     = new RelayCommand <User>(OnUserSelected);
        }
 public NavigationService(
     ILoggingService loggingService,
     IViewModelFactory viewModelFactory,
     IViewFactory viewFactory,
     INavigationFacade navigationFacade,
     IPlatformFacade platformFacade)
 {
     _loggingService   = loggingService;
     _viewModelFactory = viewModelFactory;
     _viewFactory      = viewFactory;
     _navigationFacade = navigationFacade;
     _platformFacade   = platformFacade;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SignInViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="dialogService">The dialog service.</param>
        public SignInViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
            IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _photoService = photoService;
            _dialogService = dialogService;

            // Initialize commands
            ChooseAuthProviderCommand = new RelayCommand<MobileServiceAuthenticationProvider>(OnChooseAuthProvider);

            // Initialize auth providers
            AuthenticationProviders = photoService.GetAvailableAuthenticationProviders();
        }
        /// <summary>
        /// The constructor
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="cropControl">The crop control.</param>
        /// <param name="dialogService">The dialog service.</param>
        public CropViewModel(INavigationFacade navigationFacade, ICropControl cropControl,
                             IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _cropControl      = cropControl;
            _dialogService    = dialogService;

            Rotation = _rotationOrder.FirstOrDefault();

            // Initialize commands
            NextCommand            = new RelayCommand(OnNext);
            RotateClockwiseCommand = new RelayCommand(OnRotateClockwise);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SignInViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="dialogService">The dialog service.</param>
        public SignInViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
                               IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _photoService     = photoService;
            _dialogService    = dialogService;

            // Initialize commands
            ChooseAuthProviderCommand = new RelayCommand <MobileServiceAuthenticationProvider>(OnChooseAuthProvider);

            // Initialize auth providers
            AuthenticationProviders = photoService.GetAvailableAuthenticationProviders();
        }
        /// <summary>
        /// The constructor
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="cropControl">The crop control.</param>
        /// <param name="dialogService">The dialog service.</param>
        public CropViewModel(INavigationFacade navigationFacade, ICropControl cropControl,
            IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _cropControl = cropControl;
            _dialogService = dialogService;

            Rotation = _rotationOrder.FirstOrDefault();

            // Initialize commands
            NextCommand = new RelayCommand(OnNext);
            RotateClockwiseCommand = new RelayCommand(OnRotateClockwise);
        }
Exemple #24
0
        public HelpMenuItem(INavigationFacade navigation)
        {
            _navigation = navigation;
            Command     = new RelayCommand(() => _navigation.NavigateToMainPage());
            Image       = new BitmapImage(new Uri("ms-appx:///Assets/MenuIcons/web-1.png"));

            ContextMenu = new MenuFlyout();
            ContextMenu.Items.Add(new MenuFlyoutItem {
                Text = "Documentation..."
            });
            ContextMenu.Items.Add(new MenuFlyoutItem {
                Text = "À propos de Datacloner.."
            });
        }
        /// <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);
        }
Exemple #27
0
        public FileMenuItem(INavigationFacade navigation)
        {
            _navigation = navigation;
            Command     = new RelayCommand(() => _navigation.NavigateToMainPage());
            Image       = new BitmapImage(new Uri("ms-appx:///Assets/MenuIcons/interface.png"));

            ContextMenu = new MenuFlyout();
            ContextMenu.Items.Add(new MenuFlyoutItem {
                Text = "Nouveau projet...", Command = new RelayCommand(NewProjectAsync)
            });
            ContextMenu.Items.Add(new MenuFlyoutItem {
                Text = "Ouvrir un projet...", Command = new RelayCommand(OpenProjectAsync)
            });
            ContextMenu.Items.Add(new MenuFlyoutItem {
                Text = "Ouvrir une requête...", Command = new RelayCommand(OpenProjectAsync)
            });
        }
Exemple #28
0
        public ToolsMenuItem(INavigationFacade navigation)
        {
            _navigation = navigation;
            Command     = new RelayCommand(() => _navigation.NavigateToMainPage());
            Image       = new BitmapImage(new Uri("ms-appx:///Assets/MenuIcons/wrench.png"));

            ContextMenu = new MenuFlyout();
            ContextMenu.Items.Add(new MenuFlyoutItem {
                Text = "Trouver les tables statiques"
            });
            ContextMenu.Items.Add(new MenuFlyoutItem {
                Text = "Restraindre l'accès aux tables"
            });
            ContextMenu.Items.Add(new MenuFlyoutItem {
                Text = "Détection des colonnes à générer"
            });
        }
Exemple #29
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="CameraViewModel" /> class.
        /// </summary>
        /// <param name="cameraEngine">The camera engine.</param>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="dialogService">The dialog service.</param>
        public CameraViewModel(ICameraEngine cameraEngine, INavigationFacade navigationFacade,
                               IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _dialogService    = dialogService;
            _cameraEngine     = cameraEngine;

            cameraEngine.Init(this);

            // Initialize commands
            TakePhotoCommand    = new RelayCommand(OnTakePhoto, () => !IsBusy);
            SwitchCameraCommand = new RelayCommand(OnSwitchCamera, () => !IsBusy);
            SwitchFlashCommand  = new RelayCommand(OnSwitchFlash, () => !IsBusy);
            OpenPictureCommand  = new RelayCommand(OnOpenPicture, () => !IsBusy);

            // By default, we expect the user is able to
            // have a device attached for taking photos.
            // If we don't do this, mobile users will always see
            // the UI switching from state "No device attached" to
            // the viewfinder whenever navigating to this view.
            CanTakePhoto = true;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CameraViewModel" /> class.
        /// </summary>
        /// <param name="cameraEngine">The camera engine.</param>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="dialogService">The dialog service.</param>
        public CameraViewModel(ICameraEngine cameraEngine, INavigationFacade navigationFacade,
            IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _dialogService = dialogService;
            _cameraEngine = cameraEngine;

            cameraEngine.Init(this);

            // Initialize commands
            TakePhotoCommand = new RelayCommand(OnTakePhoto, () => !IsBusy);
            SwitchCameraCommand = new RelayCommand(OnSwitchCamera, () => !IsBusy);
            SwitchFlashCommand = new RelayCommand(OnSwitchFlash, () => !IsBusy);
            OpenPictureCommand = new RelayCommand(OnOpenPicture, () => !IsBusy);

            // By default, we expect the user is able to
            // have a device attached for taking photos.
            // If we don't do this, mobile users will always see
            // the UI switching from state "No device attached" to
            // the viewfinder whenever navigating to this view.
            CanTakePhoto = true;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProfileViewModel" /> class.
        /// </summary>
        /// <param name="navigationFacade">The navigation facade.</param>
        /// <param name="photoService">The photo service.</param>
        /// <param name="dialogService">The dialog service.</param>
        public ProfileViewModel(INavigationFacade navigationFacade, IPhotoService photoService,
            IDialogService dialogService)
        {
            _navigationFacade = navigationFacade;
            _photoService = photoService;
            _dialogService = dialogService;

            Photos = new IncrementalLoadingCollection<Photo>(s =>
            {
                Func<Task<PagedResponse<Photo>>> f = async () =>
                {
                    if (IsShowingCurrentUser)
                    {
                        var stream = await photoService.GetPhotosForCurrentUser(s);
                        return stream;
                    }

                    return await photoService.GetPhotosForUser(User, s);
                };
                return f();
            }, async () => await _dialogService.ShowGenericServiceErrorNotification(),
                OnPhotosLoadingFinished);

            // Photos collection is being loaded asynchronously, so we need to
            // watch it to see if the user has any pictures uploaded already.
            Photos.CollectionChanged += PhotosCollectionChanged;

            // Initialize commands
            PhotoSelectedCommand = new RelayCommand<Photo>(OnPhotoSelected);
            DeletePhotoCommand = new RelayCommand<Photo>(OnDeletePhoto);
            SetProfilePhotoCommand = new RelayCommand<Photo>(OnSetProfilePhoto);

            // Before pictures are retrieved from the service,
            // we want to prevent an initial notification showing up
            // that the user has no pictures.
            ArePhotosEmpty = false;
        }
 public ExtractionBehaviorsMenuItem(INavigationFacade navigation) : base(navigation)
 {
     _navigation = navigation;
     Command     = new RelayCommand(() => _navigation.NavigateToMainPage());
     Image       = new BitmapImage(new Uri("ms-appx:///Assets/MenuIcons/symbols.png"));
 }
 public EnvironmentDefinitionMenuItem(INavigationFacade navigation) : base(navigation)
 {
     _navigation = navigation;
     Command     = new RelayCommand(() => _navigation.NavigateToMainPage());
     Image       = new BitmapImage(new Uri("ms-appx:///Assets/MenuIcons/technology.png"));
 }
Exemple #35
0
 public ClonerMenuItem(INavigationFacade navigation)
 {
     _navigation = navigation;
     Command     = new RelayCommand(() => _navigation.NavigateToClonerPage());
     Image       = new BitmapImage(new Uri("ms-appx:///Assets/MenuIcons/squares.png"));
 }
Exemple #36
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="navigationFacade">The navigation facade.</param>
 public SignInPromptViewModel(INavigationFacade navigationFacade)
 {
     _navigationFacade = navigationFacade;
     SignInCommand     = new RelayCommand(OnSignIn);
 }
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="navigationFacade">The navigation facade.</param>
 public SignInPromptViewModel(INavigationFacade navigationFacade)
 {
     _navigationFacade = navigationFacade;
     SignInCommand = new RelayCommand(OnSignIn);
 }
 public SqlServersMenuItem5(INavigationFacade navigation) : base(navigation)
 {
     _navigation = navigation;
     Image       = new BitmapImage(new Uri("ms-appx:///Assets/MenuIcons/columns.png"));
 }
        /// <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);
        }
        /// <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="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;
        }
 public TreeViewMenuItemBase(INavigationFacade navigation) : base(null, false)
 {
     Navigation = navigation;
 }
 /// <summary>
 /// The constructor
 /// </summary>
 /// <param name="navigationFacade">The navigation facade.</param>
 public DefaultUploadFinishedHandler(INavigationFacade navigationFacade)
 {
     _navigationFacade = navigationFacade;
 }
Exemple #44
0
 /// <summary>
 /// The constructor
 /// </summary>
 /// <param name="navigationFacade">The navigation facade.</param>
 public DefaultUploadFinishedHandler(INavigationFacade navigationFacade)
 {
     _navigationFacade = navigationFacade;
 }