コード例 #1
0
        /// <summary>
        /// Construct the trip view, passing in the persistent trip store. Sets up
        /// a command to handle invoking the Add button.
        /// </summary>
        /// <param name="store"></param>
        public TripListViewModel(TripStore store)
        {
            this.store = store;
            Trips = store.Trips;

            addTripCommand = new RelayCommand(new Action(AddTrip));
        }
コード例 #2
0
 /// <summary>
 /// Set up all of the known view models, and instantiate the trip repository.
 /// </summary>
 public ViewModelLocator()
 {
     TripStore store = new TripStore();
     InitializeStore(store);
     modelSet.Add("TripListViewModel", new TripListViewModel(store));
     modelSet.Add("TripViewModel", new TripViewModel(store));
 }
コード例 #3
0
 /// <summary>
 /// Construct Trip ViewModel, providing the store to persist trips. 
 /// Creates the RelayCommands to be bound to various buttons in the UI.
 /// </summary>
 /// <param name="store">The persistent store</param>
 public TripViewModel(TripStore store)
 {
     trip = new Trip();
     saveTripCommand = new RelayCommand(new Action(SaveTrip));
     deleteTripCommand = new RelayCommand(new Action(DeleteTrip));
     this.store = store;
 }
コード例 #4
0
 private async void InitializeStore(TripStore store)
 {
     await store.LoadTrips();
 }