public ProductItemsViewModel(
            IProductsProvider productsProvider,
            IProductsSearcher productsSearcher,
            IOrderBuilder orderBuilder,
            IPageNavigator pageNavigator)
        {
            Contract.Assert(productsProvider != null);
            Contract.Assert(orderBuilder != null);
            Contract.Assert(pageNavigator != null);

            _productsProvider = productsProvider;
            _productsSearcher = productsSearcher;
            _orderBuilder = orderBuilder;
            _pageNavigator = pageNavigator;
            SearchCommand = new LambdaCommand(
                parameter =>
                {
                    var searchResult = _productsSearcher.Search(SearchQuery);
                    Products = searchResult.Select(CreateProductViewModel);
                });

            GotoOrderCommand = new LambdaCommand(
                _ =>
                {
                    _pageNavigator.NavigateToOrderPage(new OrderViewModel(_orderBuilder.GetOrder(), _pageNavigator));
                });

            InitializeProducts();
        }
 public ProductDetailPresenter(IProductDetailView view, ProductService productService, IBasket basket, IPageNavigator pageNavigator)
 {
     _view = view;
     _productService = productService;
     _basket = basket;
     _pageNavigator = pageNavigator;
 }
Example #3
0
        internal static TPage Navigate <TPage>(this IElementFinder finder, IPageNavigator navigator, IWebDriver browser, By by, int waitTimeout = 10)
            where TPage : UiComponent, new()
        {
            var element    = finder.Element(by);
            var resultPage = navigator.To <TPage>(by);

            return(resultPage);
        }
 public AddNewVotingPresenter(IXamLogger logger, IVotingAdditing repo)
 {
     PageNavigator = new PageNavigatorAdapter  {
         Title = "Add new voting"
     };
     this.logger = logger;
     this.repo   = repo;
 }
Example #5
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            IPageNavigator pageNavigator = ServiceLocator.Instance.Resolve <IPageNavigator>();
            var            deferral      = e.SuspendingOperation.GetDeferral();

            await pageNavigator.SaveAsync();

            deferral.Complete();
        }
Example #6
0
        public MainWindowViewModel(
            IZApi api,
            ILog logger,
            ISettingsService settingsService,
            IProcessService processService,
            IResolutionRoot kernel,
            IEventService eventService,
            IMainMenuService menuService,
            IUpdateService updateService,
            IGameService gameService,
            IDiscord discordPresence,

            IPageNavigator navigator,
            IApplicationState state,
            IViewModelSource viewModelSource,
            IDialogService dialogService,
            IDialogSystemBase dialogSystemBase,
            IBusyIndicatorBase busyIndicatorBase,
            IBusyIndicatorService busyIndicatorService)
        {
            _navigator            = navigator;
            _state                = state;
            _dialogSystemBase     = dialogSystemBase;
            _dialogService        = dialogService;
            _busyIndicatorBase    = busyIndicatorBase;
            _busyIndicatorService = busyIndicatorService;
            _eventService         = eventService;

            _menuService = menuService;

            _apiConnection   = api.Connection;
            _log             = logger;
            _settingsService = settingsService;
            _processService  = processService;
            _updateService   = updateService;
            _gameService     = gameService;
            _discordPresence = discordPresence;
            _api             = api;

            NonClientDataContext = viewModelSource.Create <WindowNonClientPartViewModel>();
            BottomBarDataContext = viewModelSource.Create <WindowBottomBarPartViewModel>();

            _apiConnection.ConnectionChanged += _apiConnectionConnectionChangedHandler;

            _zClientProcessTracker = new ZProcessTracker(_ZClientProcessName, TimeSpan.FromSeconds(3), true, processes => processes
                                                         .OrderByDescending(process => process.StartTime)
                                                         .First());
            _zClientProcessTracker.ProcessDetected += _zClientProcessDetectedHandler;
            _zClientProcessTracker.ProcessLost     += _zClientProcessLostHandler;

            api.Configure(new ZConfiguration {
                SynchronizationContext = SynchronizationContext.Current
            });

            _gameService.GameCreationError += _GameCreationErrorHandler;
        }
        /// <summary>
        /// Invoked as an event handler to navigate backward in the navigation stack
        /// associated with this page's <see cref="Frame"/>.
        /// </summary>
        /// <param name="sender">Instance that triggered the event.</param>
        /// <param name="e">Event data describing the conditions that led to the
        /// event.</param>
        protected virtual void GoBack(object sender, RoutedEventArgs e)
        {
            // Use the navigation frame to return to the previous page
            IPageNavigator navigator = ServiceLocator.Instance.Resolve <IPageNavigator>();

            if (navigator != null && navigator.CanGoBack)
            {
                navigator.GoBack();
            }
        }
Example #8
0
        public void ApplyNewPIN(INavigation navigation, IPageNavigator pageNavigator, IBLConfigFile configFile, string newPIN)
        {
            if (string.IsNullOrEmpty(newPIN))
            {
                throw new ArgumentNullException(nameof(newPIN));
            }

            new ApplyNewPINCommand(configFile, newPIN).Execute();

            pageNavigator.ToLoginPINPage(navigation);
        }
Example #9
0
 public void ExistsPIN(INavigation navigation, IPageNavigator pageNavigator, IBLConfigFile configFile)
 {
     if (string.IsNullOrEmpty(configFile.PIN))
     {
         pageNavigator.ToCreatePINPage(navigation);
     }
     else
     {
         pageNavigator.ToLoginPINPage(navigation);
     }
 }
        public AccountPageViewModel(IPageNavigator pageNavigator,
            ILogger logger,
            IUserDialogs userDialogs,
            IRequestExceptionHandler requestExceptionHandler,
            IEventAggregator eventAggregator,
            IAppUserManager appUserManager) : base(pageNavigator, logger, userDialogs, requestExceptionHandler, eventAggregator)
        {
            _appUserManager = appUserManager;
            Title = AppResources.TitleAccount;
            TappedMenuCommand = new DelegateCommand(() => EventAggregator.GetEvent<HamburgerTappedEvent>().Publish());

        }
Example #11
0
        public PostsPageViewModel(IClientService clientService, IPageNavigator pageNavigator)
        {
            _clientService   = clientService;
            _pageNavigator   = pageNavigator;
            _currentCategory = PostCategory.Hot;

            Posts = new ObservableCollection <PostView>();

            InitCommands();

            GetPostsAsync(_currentCategory);
        }
Example #12
0
        public CustomerCreatePageViewModel(IPageNavigator pageNavigator,
                                           ILogger logger,
                                           IUserDialogs userDialogs,
                                           IRequestExceptionHandler requestExceptionHandler,
                                           ICustomerManager customerManager) : base(pageNavigator, logger, userDialogs, requestExceptionHandler)
        {
            _customerManager = customerManager;

            BackCommand   = new DelegateCommand(async() => await PageNavigator.GoBackAsync());
            SubmitCommand = new DelegateCommand(async() => await OnSubmit(), () => OnSubmitCanExecute());

            Title = AppResources.TitleAddCustomer;
        }
        public LoginWithGooglePageViewModel(
            IGoogleAuthenticationService googleAuthenticationService,
            IClientService clientService,
            IPageNavigator pageNavigator)
        {
            _googleAuthenticationService = googleAuthenticationService;
            _clientService = clientService;
            _pageNavigator = pageNavigator;

            InitCommands();

            PageUrl = _googleAuthenticationService.GetAuthenticationPageUrl();
        }
        public AttendanceLogPageViewModel(IPageNavigator pageNavigator,
                                          ILogger logger,
                                          IUserDialogs userDialogs,
                                          IRequestExceptionHandler requestExceptionHandler,
                                          IEventAggregator eventAggregator,
                                          IAttendanceLogManager attendanceLogManager) : base(pageNavigator, logger, userDialogs, requestExceptionHandler, eventAggregator)
        {
            _attendanceLogManager = attendanceLogManager;
            Title = AppResources.TitleAttendanceLogs;

            TappedMenuCommand = new DelegateCommand(() => EventAggregator.GetEvent <HamburgerTappedEvent>().Publish());
            Logs = new ObservableCollection <AttendanceLogEntity>();
        }
        public OrderViewModel(
            Order order,
            IPageNavigator pageNavigator)
        {
            Contract.Assert(order != null);
            Contract.Assert(pageNavigator != null);

            Order = order;
            GoBack = new LambdaCommand(
                _ =>
                {
                    pageNavigator.NavigateToProductsPage();
                });
        }
        public MainMasterDetailPageViewModel(INavigationService navigationService,
                                             IPageNavigator pageNavigator,
                                             IUserDialogs userDialogs,
                                             IEventAggregator eventAggregator,
                                             IAppManager appManager,
                                             IAppUserManager appUserManager) : base(navigationService, pageNavigator, userDialogs, eventAggregator)
        {
            _appManager     = appManager;
            _appUserManager = appUserManager;

            AccountCommmand       = new DelegateCommand(async() => await OnAccount());
            AttendanceLogCommmand = new DelegateCommand(async() => await OnAttendanceLog());
            LogoutCommand         = new DelegateCommand(async() => await OnLogout());
        }
        public LoginPageViewModel(IPageNavigator pageNavigator,
                                  ILogger logger,
                                  IUserDialogs userDialogs,
                                  IRequestExceptionHandler requestExceptionHandler,
                                  IAuthManager authManager,
                                  IAppUserManager appUserManager) : base(pageNavigator, logger, userDialogs, requestExceptionHandler)
        {
            _authManager    = authManager;
            _appUserManager = appUserManager;

            LoginCommand = new DelegateCommand(async() => await OnLogin(), () => OnLoginCanExecute())
                           .ObservesProperty(() => EmployeeId)
                           .ObservesProperty(() => AccessCode);
        }
        public LoginWithFacebookPageViewModel(
            IFacebookAuthenticationService facebookAuthenticationService,
            IClientService clientService,
            IPageNavigator pageNavigator)
        {
            _facebookAuthenticationService = facebookAuthenticationService;
            _clientService = clientService;
            _pageNavigator = pageNavigator;

            InitCommands();

            _state  = RequestUtils.GetUuid();
            PageUrl = _facebookAuthenticationService.GetAuthenticationPageUrl(_state);
        }
Example #19
0
        public PurchaseOrdersPageViewModel(IPageNavigator pageNavigator,
                                           ILogger logger,
                                           IUserDialogs userDialogs,
                                           IRequestExceptionHandler requestExceptionHandler,
                                           IEventAggregator eventAggregator,
                                           IPurchaseOrderManager purchaseOrderManager) : base(pageNavigator, logger, userDialogs, requestExceptionHandler, eventAggregator)
        {
            _purchaseOrderManager = purchaseOrderManager;
            Title = AppResources.TitlePurchaseOrders;

            TappedMenuCommand = new DelegateCommand(() => EventAggregator.GetEvent <HamburgerTappedEvent>().Publish());
            PurchaseOrders    = new ObservableCollection <PurchaseOrderEntity>();

            AddCommand = new DelegateCommand(async() => await OnAdd());
        }
Example #20
0
        public MasterDetailViewModelBase(
            INavigationService navigationService,
            IPageNavigator pageNavigator,
            IUserDialogs userDialogs,
            IEventAggregator eventAggregator)
            : base(pageNavigator, null, userDialogs, null, eventAggregator)
        {
            _navigationService = navigationService;

            _hamburgerTappedEventSubscriptionToken             = EventAggregator.GetEvent <HamburgerTappedEvent>().Subscribe(() => OnPresentToggle(true), ThreadOption.UIThread);
            _hamburgerNavigateEventSubscriptionToken           = EventAggregator.GetEvent <HamburgerNavigateEvent>().Subscribe(async(model) => await OnHamburgerNavigate(model), ThreadOption.UIThread);
            _hamburgerNavigateModalEventSubscriptionToken      = EventAggregator.GetEvent <HamburgerNavigateModalEvent>().Subscribe(async(model) => await OnHamburgerNavigateModal(model), ThreadOption.UIThread);
            _hamburgerNavigateBackToRootEventSubscriptionToken = EventAggregator.GetEvent <HamburgerNavigateBackToRootEvent>().Subscribe(async(defaultPage) => await OnHamburgerNavigateBackToRoot(defaultPage), ThreadOption.UIThread);
            _hamburgerSetSwipeGestureEventSubscriptionToken    = EventAggregator.GetEvent <HamburgerSetSwipeGestureEvent>().Subscribe((val) => IsGestureEnabled = val, ThreadOption.UIThread);
        }
Example #21
0
        public LoginPageViewModel(IPageNavigator pageNavigator,
                                  ILogger logger,
                                  IUserDialogs userDialogs,
                                  IRequestExceptionHandler requestExceptionHandler,
                                  IAzurePushNotification azurePushNotification,
                                  IAuthManager authManager,
                                  IAppUserManager appUserManager) : base(pageNavigator, logger, userDialogs, requestExceptionHandler)
        {
            _azurePushNotification = azurePushNotification;
            _authManager           = authManager;
            _appUserManager        = appUserManager;

            LoginCommand = new DelegateCommand(async() => await OnLogin(), () => OnLoginCanExecute())
                           .ObservesProperty(() => AgentId)
                           .ObservesProperty(() => BadgeCode);
        }
Example #22
0
        public MainMasterDetailPageViewModel(INavigationService navigationService,
                                             IPageNavigator pageNavigator,
                                             IUserDialogs userDialogs,
                                             IEventAggregator eventAggregator,
                                             IAzurePushNotification azurePushNotification,
                                             IAppManager appManager,
                                             IAppUserManager appUserManager) : base(navigationService, pageNavigator, userDialogs, eventAggregator)
        {
            _azurePushNotification = azurePushNotification;
            _appManager            = appManager;
            _appUserManager        = appUserManager;

            AccountCommmand       = new DelegateCommand(async() => await OnAccount());
            CustomersCommand      = new DelegateCommand(async() => await OnCustomers());
            PurchaseOrdersCommand = new DelegateCommand(async() => await OnPurchaseOrders());
            LogoutCommand         = new DelegateCommand(async() => await OnLogout());
        }
 public BF3ServerBrowserViewModel(
     IZApi api,
     IEventService eventService,
     IGameService gameService,
     IDiscord discord,
     App application,
     IPageNavigator navigator,
     ISettingsService settingsService,
     IDialogService dialogService)
     : base(api, gameService, eventService, discord, application, settingsService, navigator, dialogService)
 {
     MapNames = new [] { "All" }
     .Concat(ZResource.GetBF3MapNames())
     .ToArray();
     GameModeNames = new [] { "All" }
     .Concat(ZResource.GetBF3GameModeNames())
     .ToArray();
 }
        public WindowNonClientPartViewModel(
            IMainMenuService mainMenuService,
            IPageNavigator navigator,
            IZApi api,
            IUpdateService updateService)
        {
            UserPresenterViewModel = Resolver.Kernel.Get <UserPresenterViewModel>();
            UserPresenterViewModel.SetUserData(null);

            _navigator = navigator;

            _navigator.NavigationInitiated += _navigationInitiatedHandler;
            var application = Application.Current as App;

            _wnd = application.MainWindow;
            _launcherProcessService = application.ProcessService;
            _mainMenuService        = mainMenuService;
            _api           = api;
            _updateService = updateService;
        }
Example #25
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame          rootFrame     = Window.Current.Content as Frame;
            IPageNavigator pageNavigator = ServiceLocator.Instance.Resolve <IPageNavigator>();

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                Window.Current.Content = rootFrame = new Frame();
            }

            // Reload our state and navigation stack
            try
            {
                // Load the state
                await pageNavigator.LoadAsync();
            }
            catch (Exception)
            {
                //Something went wrong restoring state.
                //Assume there is no state and continue
            }

            // If it didn't restore the state, the content will be null.
            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!pageNavigator.NavigateTo("GroupedItems"))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Example #26
0
        public PurchaseOrderCreatePageViewModel(IPageNavigator pageNavigator,
                                                ILogger logger,
                                                IUserDialogs userDialogs,
                                                IRequestExceptionHandler requestExceptionHandler,
                                                IPurchaseOrderManager purchaseOrderManager,
                                                ICustomerManager customerManager,
                                                IProductManager productManager) : base(pageNavigator, logger, userDialogs, requestExceptionHandler)
        {
            _purchaseOrderManager = purchaseOrderManager;
            _customerManager      = customerManager;
            _productManager       = productManager;

            BackCommand           = new DelegateCommand(async() => await PageNavigator.GoBackAsync());
            SubmitCommand         = new DelegateCommand(async() => await OnSubmit(), () => OnSubmitCanExecute());
            SelectCustomerCommand = new DelegateCommand(async() => await OnSelectCustomer());
            AddProductCommand     = new DelegateCommand(async() => await OnAddProduct());

            Title = AppResources.TitleCreatePurchaseOrder;

            _products             = new List <ProductEntity>();
            PurchaseOrderProducts = new ObservableCollection <PurchaseOrderProductItemModel>();
        }
Example #27
0
        public HomeViewModel(
            IEventService eventService,
            IGameService gameService,
            ISettingsService settingsService,
            IZApi api,
            IBusyIndicatorService busyIndicatorService,
            IDiscord discord,
            IPageNavigator navigator,
            IApplicationState state,
            IDialogService dialogService)
        {
            _navigator = navigator;
            _state     = state;
            _discord   = discord;

            _eventService         = eventService;
            _gameService          = gameService;
            _settingsService      = settingsService;
            _api                  = api;
            _busyIndicatorService = busyIndicatorService;
            _dialogService        = dialogService;
        }
Example #28
0
        public LoginPageViewModel(IClientService clientService, IPageNavigator pageNavigator)
        {
            _clientService = clientService;
            _pageNavigator = pageNavigator;

            InitCommands();
            LoadAuthenticationInfo();

            var authenticationInfo = _clientService.AuthenticationInfo;

            UserLogin    = authenticationInfo.UserLogin;
            UserPassword = authenticationInfo.UserPassword;

            if (authenticationInfo.IsAuthenticated)
            {
                _pageNavigator.GoToPostsPage(null, false);
                return;
            }

            switch (authenticationInfo.LastAuthenticationType)
            {
            case AuthenticationType.Credentials when authenticationInfo.AreCredentialsPresent:
                LoginAsync();
                break;

            case AuthenticationType.Google:
                _pageNavigator.GoToLoginWithGooglePage();
                break;

            case AuthenticationType.Facebook:
                _pageNavigator.GoToLoginWithFacebookPage();
                break;

            default:
                break;
            }
        }
Example #29
0
        public MainPageViewModel(IPageNavigator pageNavigator, UserStatistic userStatistic)
        {
            if (pageNavigator is null)
            {
                throw new ArgumentNullException(nameof(pageNavigator));
            }
            if (userStatistic is null)
            {
                throw new ArgumentNullException(nameof(UserStatistic));
            }

            questCreator = new QuestCreator();

            allQuests = new ObservableCollection <QuestViewModel>();
            AllQuests = new ReadOnlyObservableCollection <QuestViewModel>(allQuests);
            (QuestRegistry.Instance.Quests as INotifyCollectionChanged).CollectionChanged += AllQuestViewModels_CollectionChanged;


            this.PageNavigator = pageNavigator;
            this.UserStatistic = userStatistic;
            this.UserStatistic.Recalculated += OnStatisticRecalculated;

            AddNewQuestCommand = new Command(() =>
            {
                var newQuest                     = questCreator.CreateQuest();
                var descriptionComponent         = newQuest.GetComponent <DescriptionComponent>();
                descriptionComponent.Title       = "Title";
                descriptionComponent.Description = "Description";

                OpenQuestPageCommand.Execute(newQuest);
            });

            OpenQuestPageCommand = new Command <AbstractQuest>((quest) =>
            {
                PageNavigator.ToQuestPage(quest);
            });
        }
        public ClockPageViewModel(IPageNavigator pageNavigator,
                                  ILogger logger,
                                  IUserDialogs userDialogs,
                                  IRequestExceptionHandler requestExceptionHandler,
                                  IEventAggregator eventAggregator,
                                  ILocationManager locationManager,
                                  IGeolocation geolocation,
                                  IAppUserManager appUserManager,
                                  IEmployeeManager employeeManager,
                                  IAttendanceLogManager attendanceLogManager) : base(pageNavigator, logger, userDialogs, requestExceptionHandler, eventAggregator)
        {
            _locationManager      = locationManager;
            _geolocation          = geolocation;
            _appUserManager       = appUserManager;
            _employeeManager      = employeeManager;
            _attendanceLogManager = attendanceLogManager;

            BackCommand   = new DelegateCommand(async() => await PageNavigator.GoBackAsync());
            SubmitCommand = new DelegateCommand(async() => await OnSubmit(), () => OnSubmitCanExecute()).ObservesProperty(() => CurrentPostion).ObservesProperty(() => CurrentLocationName);

            _mapDragPinNewLocationEventToken = EventAggregator.GetEvent <MapDragPinNewLocationEvent>().Subscribe(async(pos) => await SetPoint(pos.Latitude, pos.Longitude));

            Geofences = new ObservableCollection <Circle>();
        }
Example #31
0
 public MainPageViewModel(IPageNavigator pageNavigator, ILogger logger) : base(pageNavigator, logger)
 {
 }
Example #32
0
 public LoginPINViewModel(INavigation navigation, ISmartNavigator smartNavigator, IPageNavigator pageNavigation,
                          IBLConfigFile configFile)
     : base(navigation, smartNavigator, pageNavigation)
 {
     ConfigFile       = configFile;
     ForgotPINCommand = new Command(DoRestorePIN);
 }
 public TabPageSwither(IPageNavigator pageNavigator)
 {
     PageNavigator = pageNavigator;
     TabSelected   = new Command <string>(OnTabSelected);
 }