Exemplo n.º 1
0
		public SavedStreamManager([NotNull] LocalStorageManager storageManager)
		{
			if (storageManager == null) throw new ArgumentNullException("storageManager");
			_storageManager = storageManager;

			_items = new Lazy<List<SavedStreamItem>>(InitItems);
		}
Exemplo n.º 2
0
        public TagsManager([NotNull] ApiClient apiClient,
                           [NotNull] TelemetryClient telemetryClient,
                           [NotNull] NetworkManager networkManager,
                           [NotNull] LocalStorageManager localStorageManager)
        {
            if (apiClient == null)
            {
                throw new ArgumentNullException("apiClient");
            }
            if (telemetryClient == null)
            {
                throw new ArgumentNullException("telemetryClient");
            }
            if (networkManager == null)
            {
                throw new ArgumentNullException("networkManager");
            }
            if (localStorageManager == null)
            {
                throw new ArgumentNullException("localStorageManager");
            }

            _apiClient           = apiClient;
            _telemetryClient     = telemetryClient;
            _localStorageManager = localStorageManager;

            networkManager.NetworkChanged += networkManager_NetworkChanged;
        }
Exemplo n.º 3
0
        public SavedStreamManager([NotNull] LocalStorageManager storageManager)
        {
            if (storageManager == null)
            {
                throw new ArgumentNullException("storageManager");
            }
            _storageManager = storageManager;

            _items = new Lazy <List <SavedStreamItem> >(InitItems);
        }
Exemplo n.º 4
0
		public TagsManager([NotNull] ApiClient apiClient,
			[NotNull] TelemetryClient telemetryClient,
			[NotNull] NetworkManager networkManager,
			[NotNull] LocalStorageManager localStorageManager)
		{
			if (apiClient == null) throw new ArgumentNullException("apiClient");
			if (telemetryClient == null) throw new ArgumentNullException("telemetryClient");
			if (networkManager == null) throw new ArgumentNullException("networkManager");
			if (localStorageManager == null) throw new ArgumentNullException("localStorageManager");

			_apiClient = apiClient;
			_telemetryClient = telemetryClient;
			_localStorageManager = localStorageManager;

			networkManager.NetworkChanged += networkManager_NetworkChanged;
		}
Exemplo n.º 5
0
		protected override async Task OnInitializeAsync(IActivatedEventArgs args)
		{
			await base.OnInitializeAsync(args);

			_container.RegisterInstance<ISessionStateService>(SessionStateService);
			_container.RegisterInstance<INavigationService>(NavigationService);

			_container.RegisterType<ICredentialService, CredentialService>(new ContainerControlledLifetimeManager());
			_container.RegisterType<NetworkManager>(new ContainerControlledLifetimeManager());
			_container.RegisterType<TileManager>(new ContainerControlledLifetimeManager());
			_container.RegisterInstance(_appSettingsService);
			_container.RegisterInstance(_telemetryClient);
			_container.RegisterType<ImageManager>(new ContainerControlledLifetimeManager());

			var uri = new Uri("ms-appx:///Assets/ApiAuth.json");
			var file = await StorageFile.GetFileFromApplicationUriAsync(uri);
			var strData = await FileIO.ReadTextAsync(file);
			var data = JObject.Parse(strData);

			var appId = data["AppId"].ToString();
			var appKey = data["AppKey"].ToString();
			_apiClient = new ApiClient(appId, appKey);
			_container.RegisterInstance(_apiClient);

			var localStorageManager = new LocalStorageManager(_telemetryClient);
			localStorageManager.Init();
			_container.RegisterInstance(localStorageManager);

			var savedStreamManager = new SavedStreamManager(localStorageManager);
			_container.RegisterInstance(savedStreamManager);

			_tagsManager = _container.Resolve<TagsManager>();
			_container.RegisterInstance(_tagsManager);
			_tagsManager.ProcessQueue();

			Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = _appSettingsService.DisplayCulture;

			var unityServiceLocator = new UnityServiceLocator(_container);
			ServiceLocator.SetLocatorProvider(() => unityServiceLocator);

			ViewModelLocationProvider.SetDefaultViewModelFactory(ViewModelFactory);
			ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver(ViewModelTypeResolver);
		}
		public SubscriptionsPageViewModel([NotNull] INavigationService navigationService,
			[NotNull] ApiClient apiClient,
			[NotNull] AppSettingsService settingsService,
			[NotNull] TelemetryClient telemetryClient,
			[NotNull] TileManager tileManager,
			[NotNull] LocalStorageManager localStorageManager,
			[NotNull] SubscriptionsManager subscriptionsManager,
			[NotNull] NetworkManager networkManager)
		{
			if (navigationService == null) throw new ArgumentNullException("navigationService");
			if (apiClient == null) throw new ArgumentNullException("apiClient");
			if (settingsService == null) throw new ArgumentNullException("settingsService");
			if (telemetryClient == null) throw new ArgumentNullException("telemetryClient");
			if (tileManager == null) throw new ArgumentNullException("tileManager");
			if (localStorageManager == null) throw new ArgumentNullException("localStorageManager");
			if (subscriptionsManager == null) throw new ArgumentNullException("subscriptionsManager");
			if (networkManager == null) throw new ArgumentNullException("networkManager");

			_navigationService = navigationService;
			_apiClient = apiClient;
			_settingsService = settingsService;
			_telemetryClient = telemetryClient;
			_tileManager = tileManager;
			_localStorageManager = localStorageManager;
			_subscriptionsManager = subscriptionsManager;
			_networkManager = networkManager;

			_dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;

			Application.Current.Resuming += Application_Resuming;
			_networkManager.NetworkChanged += _networkManager_NetworkChanged;
		}
Exemplo n.º 7
0
		public StreamPageViewModel([NotNull] ApiClient apiClient,
			[NotNull] INavigationService navigationService,
			[NotNull] TelemetryClient telemetryClient,
			[NotNull] TagsManager tagsManager,
			[NotNull] AppSettingsService settingsService,
			[NotNull] SavedStreamManager savedStreamManager,
			[NotNull] LocalStorageManager localStorageManager,
			[NotNull] NetworkManager networkManager)
		{
			if (apiClient == null) throw new ArgumentNullException("apiClient");
			if (navigationService == null) throw new ArgumentNullException("navigationService");
			if (telemetryClient == null) throw new ArgumentNullException("telemetryClient");
			if (tagsManager == null) throw new ArgumentNullException("tagsManager");
			if (settingsService == null) throw new ArgumentNullException("settingsService");
			if (savedStreamManager == null) throw new ArgumentNullException("savedStreamManager");
			if (localStorageManager == null) throw new ArgumentNullException("localStorageManager");
			if (networkManager == null) throw new ArgumentNullException("networkManager");

			_apiClient = apiClient;
			_navigationService = navigationService;
			_telemetryClient = telemetryClient;
			_tagsManager = tagsManager;
			_savedStreamManager = savedStreamManager;
			_localStorageManager = localStorageManager;
			_networkManager = networkManager;

			_showNewestFirst = settingsService.ShowNewestFirst;
			_autoMarkAsRead = settingsService.AutoMarkAsRead;
			_preloadItemCount = settingsService.PreloadItemCount;

			DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
			dataTransferManager.DataRequested += dataTransferManager_DataRequested;

			_dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;

			_networkManager.NetworkChanged += _networkManager_NetworkChanged;
		}
Exemplo n.º 8
0
        public SettingsPageViewModel([NotNull] AppSettingsService settingsService,
			[NotNull] TelemetryClient telemetryClient,
			[NotNull] LocalStorageManager localStorageManager)
        {
            if (settingsService == null) throw new ArgumentNullException("settingsService");
            if (telemetryClient == null) throw new ArgumentNullException("telemetryClient");
            if (localStorageManager == null) throw new ArgumentNullException("localStorageManager");

            _settingsService = settingsService;
            _telemetryClient = telemetryClient;
            _localStorageManager = localStorageManager;

            _initialDisplayCulture = _settingsService.DisplayCulture;
        }