Ejemplo n.º 1
0
        public HDPApp(DeviceType deviceType, IBlobCache cache)
        {
            RxApp.DefaultExceptionHandler = Observer.Create ((Exception e) => {
                System.Diagnostics.Debug.WriteLine(e.Message); 
                System.Diagnostics.Debug.WriteLine(e.StackTrace);
            });

            BlobCache.ApplicationName = "HDP";
            _cache = BlobCache.LocalMachine;

            JsonConvert.DefaultSettings = 
                () => new JsonSerializerSettings() { 
                ContractResolver = new CamelCasePropertyNamesContractResolver(),
                Converters = {new MediaTypeConverter(), new StringEnumConverter()}
            };

            _apiService = new ApiService (deviceType: deviceType);
            _newsService = new NewsService (_apiService);
            _eventsService = new EventsService (_apiService);
            _electionArticlesService = new ElectionArticlesService (_apiService);

            Locator.CurrentMutable.RegisterConstant (this, typeof(HDPApp));

            State = new AppState ();

            UserCity.Subscribe (city => {
                System.Diagnostics.Debug.WriteLine("Current city is: {0}", city); 
            });

            _repository = new ContentRepository (_newsService, _electionArticlesService, _eventsService, cache);

            ImplementCommands ();
        }
Ejemplo n.º 2
0
        public ContentRepository (
            NewsService newsService, 
            ElectionArticlesService electionArticlesService, 
            EventsService eventsService,
            IBlobCache cache)
        {
            _news = newsService;
            _electionArticles = electionArticlesService;
            _events = eventsService;

            _cache = cache;
        }