Exemple #1
0
        public RailwayStationsViewModel(
            IRailwayStationService stationService,
            IRailwayPlatformService platformService,
            ILocationService locationService,
            ILogger logger,
            IEventAggregator eventAggregator) : base(logger, eventAggregator)
        {
            _stationService  = stationService;
            _platformService = platformService;
            _locationService = locationService;
            _logger          = logger;

            RailwayStations = new ObservableCollection <RailwayStationModel>();

            // Station commands
            AddCommand           = new DelegateCommand(ShowAddStationForm);
            EditStationCommand   = new DelegateCommand <RailwayStationModel>(ShowEditStationForm);
            RemoveStationCommand = new DelegateCommand <RailwayStationModel>(async(route) => await RemoveStationAsync(route));

            RefreshCommand = new DelegateCommand(async() => await RefreshStationsAsync());

            // Platform commands
            AddPlatformCommand    = new DelegateCommand <RailwayStationModel>(ShowAddPlatformForm);
            EditPlatformCommand   = new DelegateCommand <RailwayPlatformModel>(ShowEditPlatformForm);
            RemovePlatformCommand = new DelegateCommand <RailwayPlatformModel>(async(platform) => await RemovePlatformAsync(platform));
        }
Exemple #2
0
 public AddPlatformFormViewModel(
     IRailwayPlatformService platformService,
     ILogger logger,
     Action onPlatformAdded           = null,
     IEventAggregator eventAggregator = null) : base(logger, new RailwayPlatformModel(), eventAggregator)
 {
     _platformService = platformService;
     _onPlatformAdded = onPlatformAdded;
 }