Exemplo n.º 1
0
 public HomeViewModel(IDeviceInfoService deviceInfo, IUserDialogService dialogs)
 {
     this.Menu = new List<MenuItemViewModel> {
         new MenuItemViewModel(
             "Barcode Scanning",
             () => {
                 if (deviceInfo.IsRearCameraAvailable) {
                     this.ShowViewModel<BarCodeViewModel>();
                 }
                 else {
                     dialogs.Alert("Rear camera is unavailable");
                 }
             }
         ),
         new MenuItemViewModel(
             "Device Info",
             () => this.ShowViewModel<DeviceInfoViewModel>()
         ),
         new MenuItemViewModel(
             "Dialogs",
             () => this.ShowViewModel<DialogsViewModel>()
         ),
         new MenuItemViewModel(
             "Network",
             () => this.ShowViewModel<NetworkViewModel>()
         ),
         new MenuItemViewModel(
             "Settings",
             () => this.ShowViewModel<SettingsViewModel>()
         )
     };
 }
		public NotificationsProvider(ICatalitClient client, 
            IDeviceInfoService deviceInfoService, 
            IDataCacheService dataCacheService)
		{
			_client = client;
			_dataCacheService = dataCacheService;
			_deviceInfoService = deviceInfoService;
		}
Exemplo n.º 3
0
 public BookProvider(ISessionAwareConnection awareConnection, IDataCacheService dataCacheService, IFileCacheService fileCacheService, IDeviceInfoService deviceInfoService, IFileDownloadService fileDownloadService, ISessionEstablisherService sessionEstablisherService)
 {
     _fileCacheService = fileCacheService;
     _dataCacheService = dataCacheService;
     _awareConnection = awareConnection;
     _deviceInfoService = deviceInfoService;
     _fileDownloadService = fileDownloadService;
     _sessionEstablisherService = sessionEstablisherService;
 }
        public LitresPurchaseService( ICatalogProvider catalogProvider, ICredentialsProvider credentialsProvider, IProfileProvider profileProvider, IInAppPurchaseService inAppPurchaseSevice, ICatalitClient client, IPurchaseServiceDecorator purchaseServiceDecorator, IDeviceInfoService deviceInfoService)
		{
			_inAppPurchaseService = inAppPurchaseSevice;
			_client = client;
			_catalogProvider = catalogProvider;
			_credentialsProvider = credentialsProvider;
			_profileProvider = profileProvider;
			_purchaseServiceDecorator = purchaseServiceDecorator;
			_deviceInfoService = deviceInfoService;
		}
 public DeviceInfoViewModel(IDeviceInfoService deviceInfo) {
     this.Device = deviceInfo;
 }
Exemplo n.º 6
0
        public MainViewModel(
         //   IExpirationGuardian expirationGuardian, 
            IProfileProvider profileProvider, 
            IGenresProvider genresProvider, 
            ICatalogProvider catalogProvider, 
            ICredentialsProvider credentialsProvider,
            IBookProvider bookProvider,
            INavigationService navigationService, 
            INetworkAvailabilityService networkAvailability,
            IDeviceInfoService deviceInfoService, ILitresPurchaseService litresPurchaseService)
        {            
            _genresProvider = genresProvider;
			_catalogProvider = catalogProvider;
			_credentialsProvider = credentialsProvider;
			_profileProvider = profileProvider;
			_bookProvider = bookProvider;
			_navigationService = navigationService;
		//    _expirationGuardian = expirationGuardian;
		    _networkAvailability = networkAvailability;
            _deviceInfoService = deviceInfoService;
            _litresPurchaseService = litresPurchaseService;

            var deviceFamily = _deviceInfoService.DeviceFamily;
            if (!string.IsNullOrEmpty(deviceFamily) && deviceFamily.Equals("Windows.Desktop"))
            {
                _booksPerPage = 30;
            }
            ////MyBooks reload allways, may change account information
            RegisterAction(BuyBookPart).AddPart((session) => BuyBookAsync(session, Book), (session) => true);
            RegisterAction(GiftBookPart).AddPart((session) => GetGiftAsync(session, Book), (session) => true);
            RegisterAction(MyBooksPart).AddPart( LoadMyBooks, session => true);
            RegisterAction(BuyBookLitresPart).AddPart((session) => BuyBookFromLitres(session, Book), (session) => true);
            RegisterAction(CreditCardInfoPart).AddPart(session => CreditCardInfoAsync(session), (session) => true);
            RegisterAction(LoadMoreNoveltyBooksPart).AddPart(session => LoadNoveltyBooks(session), session => true);
            RegisterAction(LoadMorePopularBooksPart).AddPart(session => LoadPopularBooks(session), session => true);
            RegisterAction(LoadMoreInterestingBooksPart).AddPart(session => LoadInterestingBooks(session), session => true);
            RegisterAction(MyOffersPart).AddPart(LoadOffers, session => true);
            //RegisterPart(MyBooksPart, (session, part) => LoadMyBooks(session), (session, part) => true, false);
            ////RegisterPart(NewBooksPart, (session, part) => LoadNewBooks(session), (session, part) => true, false);

            MyBooksViewState = MyBooksViewStateEnum.Loading;

			Genres = new XCollection<Genre>();
			Banners = new XCollection<Banner>();

			_myBooks = new XCollection<Book>();
			_noveltyBooks = new XCollection<Book>();
			_popularBooks = new XCollection<Book>();
			_interestingBooks = new XCollection<Book>();

			MyBooks = new XSubRangeCollection<Book>(_myBooks, 0, 10);
            
            NoveltyBooks = new XCollection<Book>();
			PopularBooks = new XCollection<Book>();
			InterestingBooks = new XCollection<Book>();
			ShowMyBooks = new RelayCommand( ToMyBooks );
            BookSelected = new RelayCommand<Book>(book =>  _navigationService.Navigate("Book", XParameters.Create("BookEntity", book)), book => book != null);
            BuyBook = new RelayCommand<Book>(BuyBookFromLitresAsync);
            GiftBook = new RelayCommand<Book>(GiftBookFromLitresAsync);
            ShowInterestingBooks = new RelayCommand(() => _navigationService.Navigate("BooksByCategory", XParameters.Create("category", (int) BooksByCategoryViewModel.BooksViewModelTypeEnum.Interesting)));
			ShowPopularBooks = new RelayCommand(() => _navigationService.Navigate("BooksByCategory", XParameters.Create("category", (int) BooksByCategoryViewModel.BooksViewModelTypeEnum.Popular)));
			ShowNewBooks = new RelayCommand(() => _navigationService.Navigate("BooksByCategory", XParameters.Create("category", (int) BooksByCategoryViewModel.BooksViewModelTypeEnum.Novelty)));
            LoadMoreNoveltyBooks = new RelayCommand(LoadMoreNoveltyBooksProceed, () => true);
            LoadMorePopularBooks = new RelayCommand(LoadMorePopularBooksProceed, () => true);
            LoadMoreInterestingBooks = new RelayCommand(LoadMoreInterestingBooksProceed, () => true);
            GenreSelected = new RelayCommand<int>(ChooseGenre);
			ShowSearchHistory = new RelayCommand(() => _navigationService.Navigate("Search"));
            BuyBookFromMicrosoft = new RelayCommand(BuyBookFromMicrosoftAsync);
            Read = new RelayCommand<Book>(book =>
            {
                if (!book.IsExpiredBook)
                    _navigationService.Navigate("Reader", XParameters.Create("BookEntity", book), false);
                else new MessageDialog("Истёк срок выдачи.").ShowAsync();
            });

            ShowAuthorization = new RelayCommand(() => _navigationService.Navigate("Authorization"));
            ShowRegistration = new RelayCommand(() => _navigationService.Navigate("Registration"));
			ShowUserInfo = new RelayCommand( ToUserInfo );
            RunCreditCardPaymentProcess = new RelayCommand(CreditCardInfo);
           
            ShowAccountInfo = new RelayCommand(ToAccountInfo);
			ShowSettings = new RelayCommand(() => _navigationService.Navigate("Settings"));
			ShowBookmarks = new RelayCommand( () => _navigationService.Navigate( "Bookmarks" ) );
			ShowAbout = new RelayCommand( () => _navigationService.Navigate( "About" ) );
			ShowNotifications = new RelayCommand(() => _navigationService.Navigate("NotificationsEdit"));
            ShowCreditCardView = new RelayCommand<Book>(book => _navigationService.Navigate("CreditCardPurchase", XParameters.Create("BookEntity", book)), book => book != null);

            ShowAppSettings = new RelayCommand(ToAppSettings);

            //_expirationGuardian.StartGuardian();		    
        }
Exemplo n.º 7
0
        public ProfileProvider(ICatalitClient client, IDeviceInfoService deviceInfoService)
		{
			_client = client;
			_deviceInfoService = deviceInfoService;
		}
Exemplo n.º 8
0
 public AskReviewViewModel(IDataCacheService dataCacheService, INavigationService navigationService, IDeviceInfoService deviceInfoService)
 {
     _dataCacheService = dataCacheService;
     _navigationService = navigationService;
     _deviceInfoService = deviceInfoService;
 }
Exemplo n.º 9
0
 public HomeController(IDealerService ds, IDeviceInfoService dis)
 {
     this.ds = ds;
     this.dis = dis;
 }
Exemplo n.º 10
0
        public CatalogProvider(ICatalitClient client, IFileDownloadService fileDownloadService, IProfileProvider profileProvider, IBookProvider bookProvider, IDataCacheService dataCacheService, INetworkAvailabilityService networkAvailabilityService, IDeviceInfoService deviceInfoService)
		{
			_client = client;
			_dataCacheService = dataCacheService;
			_fileDownloadService = fileDownloadService;
			_bookProvider = bookProvider;
            _networkAvailabilityService = networkAvailabilityService;
			_myBooksIds = new List<int>();
			_myHistoryBooksIds = new List<int>();
            _profileProvider = profileProvider;
            _deviceInfoService = deviceInfoService;
            //_expirationGuardian = expirationGuardian;
		}