예제 #1
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);
            });
        }