Example #1
0
        public SettingsViewModel(ISettings settings, Keys keys, IGeoCoder locator, ICongress congress, INavigationService2 navigationService)
            : base(navigationService)
        {
            _settings = settings;
            _congress = congress;
            _zipSearchVm = new ZipCodeSearchViewModel(navigationService);
            _geoVM = new GeoLocationViewModel(keys, navigationService);
            _locator = locator;

            _location = _settings.Location;
            if (_location != null)
            {
                _zipcode = _location.ZipCode;
            }

            _district = new RemoteResult<dynamic>(() => _congress.FindFirstDistrict(_location.Lat, _location.Long), 
                () => RaisePropertiesChanged("District"), new ExpandoObject());
        }
Example #2
0
        public HomeViewModel(ISettings settings, ICongress congress, ICurrentCongressionalSession currentSession, INavigationService2 navigationService)
            : base(navigationService)
        {
            _settings = settings;
            _congress = congress;
            _currentSession = currentSession;

            _upcomingBills = new RemoteResult<dynamic>(() => _congress.GetUpcomingBills(), () => RaisePropertiesChanged("UpcomingBills"), null);
            _legislators = new RemoteResult<dynamic>(() => _congress.FindLegislators(_settings.Location.Lat, _settings.Location.Long), () => RaisePropertiesChanged("Legislators"), null);

            SelectCommand = new RelayCommand<dynamic>(o =>
            {
                var vm = new DynamicViewModel(_navigationService, o);
                string id = o.bioguide_id as string;

                vm.AppendModel(new Dictionary<string, Func<Task<dynamic>>>()
                    {
                        { "committees", () => _congress.GetCommittees(id) },
                        { "sponsored_bills", () => _congress.GetBills(id) }
                    });

                NavigateTo("LegislatorDetail", vm);
            });
        }