コード例 #1
0
 public ClockViewModel(IEventAggregator eventAggregator, IClock clock)
 {
     _eventAggregator = eventAggregator;
     _clock = clock;
     Delete = new RelayCommand(DeleteItem);
     Initialize = new DelegateCommand<CityInfo>(InitializeInternal);
 }
コード例 #2
0
 public TimeShifterViewModel(TimeShiftProvider timeShiftProvider)
 {
     _timeShiftProvider = timeShiftProvider;
     _timeShiftProvider.TimeShiftCleared += _timeShiftProvider_TimeShiftCleared;
     StartShift = new RelayCommand(() => { _timeShiftProvider.StartTimeShift(); });
     EndShift = new RelayCommand(() => { _timeShiftProvider.EndTimeShift(); });
 }
コード例 #3
0
        public MainPageViewModel(IDataRepository citiesRepository, INavigationService navigation, IEventAggregator eventAggregator)
        {
            _citiesRepository = citiesRepository;
            _navigation = navigation;
            _eventAggregator = eventAggregator;
            var clocks = _citiesRepository.GetUsersCities();
            Clocks = new ObservableCollection<CityInfo>(clocks);
            _eventAggregator.GetEvent<AddCityMessage>().Subscribe(HandleAddCity, true);
            _eventAggregator.GetEvent<DeleteCityMessage>().Subscribe(HandleDeleteCity, true);

            Add = new RelayCommand(() =>
            {
                _navigation.Navigate(Experiences.CitySelector.ToString(), null);
            });
            Donate = new RelayCommand(() => Launcher.LaunchUriAsync(new Uri("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UFS2JX3EJGU3N")));
            GoToDetails = new DelegateCommand<CityInfo>(HandleGotoDetails);
            SetShowMenu = new RelayCommand(() =>
            {
                MenuActive = !MenuActive;
            });
            GoToSettings = new RelayCommand(() =>
            {
                _navigation.Navigate(Experiences.Settings.ToString(), null);
            });
        }
コード例 #4
0
        public OptionsViewModel(INavigationService navigationService)
        {
            _navigationService = navigationService;

            LoadSettings();
            Save = new RelayCommand(ExecuteSave);
        }
        public CitiesSearchResultsPageViewModel(IDataRepository repository, IEventAggregator eventAggregator, INavigationService navigationService)
        {
            _repository = repository;
            _eventAggregator = eventAggregator;
            _navigationService = navigationService;

            ApplyFilter = new RelayCommand(() => ApplyCurrentFilter(Filters.SingleOrDefault(f => f.Active)));
            SelectFilter = new DelegateCommand<SelectionChangedEventArgs>(GetAndApplyFilter);
            AddCity = new DelegateCommand<ItemClickEventArgs>(AddCityInternal);
        }
コード例 #6
0
 public CityDetailsPageViewModel(IClock clock, IDataRepository repository, 
     IEventAggregator eventAggregator, 
     INavigationService navigationService,
     ICacheClient cacheClient)
 {
     _clock = clock;
     _repository = repository;
     _eventAggregator = eventAggregator;
     _navigationService = navigationService;
     _cacheClient = cacheClient;
     var clocks = _repository.GetUsersCities();
     Clocks = new ObservableCollection<CityInfo>(clocks);
     ApplySelection = new DelegateCommand<SelectionChangedEventArgs>(ApplySelectionInternal);
     Delete = new RelayCommand(HandleDelete);
 }
コード例 #7
0
 public TimeMenuViewModel(TimeShiftProvider timeShiftProvider)
 {
     _timeShiftProvider = timeShiftProvider;
     ClearTimeShift = new RelayCommand(() => _timeShiftProvider.Clear());
 }
コード例 #8
0
        public override void OnNavigatedTo(object navigationParameter, NavigationMode navigationMode, Dictionary<string, object> viewModelState)
        {
            Donate = new RelayCommand(() => Launcher.LaunchUriAsync(new Uri("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UFS2JX3EJGU3N")));
            SetShowMenu = new RelayCommand(() => MenuActive = !MenuActive);

            Clocks.CollectionChanged += Clocks_CollectionChanged;
        }