public NetworkAvailabilityServiceDecorator(INetworkAvailabilityService networkAvailabilityService)
		{
			_networkAvailabilityService = networkAvailabilityService;
			_networkAvailabilityService.NetworkAvailabilityChanged += NetworkAvailabilityChanged;

			_pages = new List<Page>();
		}
Пример #2
0
		public BookmarksProvider(ICatalitClient client, IDataCacheService dataCacheService, INetworkAvailabilityService networkAvailabilityService)
		{
			_client = client;
			_dataCacheService = dataCacheService;
			_networkAvailabilityService = networkAvailabilityService;

			_lock = string.Empty;
		}
Пример #3
0
        public Network ()
        {
            InstallPreferences ();

            try {
                ConnectToManager ();
            } catch(Exception) {
                manager = null;
                Log.Warning(
                    Catalog.GetString("Cannot connect to NetworkManager or Wicd"),
                    Catalog.GetString("An available, working network connection will be assumed"),
                    false);
            }
        }
Пример #4
0
        public Network()
        {
            InstallPreferences();

            try {
                ConnectToManager();
            } catch (Exception) {
                manager = null;
                Log.Warning(
                    Catalog.GetString("Cannot connect to NetworkManager or Wicd"),
                    Catalog.GetString("An available, working network connection will be assumed"),
                    false);
            }
        }
Пример #5
0
        private void ConnectToManager()
        {
            if (NetworkManager.ManagerPresent)
            {
                manager = new NetworkManager();
            }
            else if (Wicd.ManagerPresent)
            {
                manager = new Wicd();
            }
            else
            {
                throw new NetworkUnavailableException("Neither NetworkManager nor Wicd could be found");
            }

            manager.StateChange += OnNetworkManagerEvent;
            current_state        = manager.State;
        }
Пример #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();		    
        }
Пример #7
0
        private void ConnectToManager()
        {
            if (NetworkManager.ManagerPresent) {
                manager = new NetworkManager ();
            } else if (Wicd.ManagerPresent) {
                manager = new Wicd ();
            } else {
                throw new NetworkUnavailableException ("Neither NetworkManager nor Wicd could be found");
            }

            manager.StateChange += OnNetworkManagerEvent;
            current_state = manager.State;
        }
Пример #8
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;
		}