Пример #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));
        }
Пример #2
0
 public AddStationFormViewModel(
     IRailwayStationService stationService,
     ILocationService locationService,
     ILogger logger,
     Action onStationAdded            = null,
     IEventAggregator eventAggregator = null) : base(locationService, logger, eventAggregator)
 {
     _stationService = stationService;
     _onStationAdded = onStationAdded;
 }
Пример #3
0
        protected RouteFormViewModelBase(IRailwayStationService stationService, ILogger logger, RouteModel route, IEventAggregator eventAggregator = null) : base(logger, eventAggregator)
        {
            _stationService = stationService;

            RailwayStations = new ObservableCollection <RailwayStationModel>();
            SubmitCommand   = new DelegateCommand(async() => await OnSubmitAsync());

            _originalRoute            = route ?? new RouteModel();
            RouteModel                = route.Clone() as RouteModel;
            RouteModel.ErrorsChanged += RouteModel_ErrorsChanged;
        }
 public AddRouteFormViewModel(
     IRouteService routeService,
     IRailwayStationService stationService,
     ICommandManager commandManager,
     ILogger logger,
     Action onRouteAdded = null,
     IEventAggregator eventAggregator = null) : base(stationService, logger, eventAggregator)
 {
     _routeService   = routeService;
     _onRouteAdded   = onRouteAdded;
     _commandManager = commandManager;
 }
        public RailwayRoutesViewModel(
            IRouteService routeService,
            IRailwayStationService stationService,
            ICommandManager commandManager,
            ILogger logger,
            IEventAggregator eventAggregator) : base(logger, eventAggregator)
        {
            _routeService   = routeService;
            _stationService = stationService;
            _commandManager = commandManager;
            _commandManager.CommandExecuted += OnCommandExecuted;

            Routes                = new ObservableCollection <RouteModel>();
            AddCommand            = new DelegateCommand(ShowAddRouteForm);
            DuplicateRouteCommand = new DelegateCommand <RouteModel>(async(route) => await DuplicateRouteAsync(route));
            EditRouteCommand      = new DelegateCommand <RouteModel>(ShowEditRouteForm);
            RemoveRouteCommand    = new DelegateCommand <RouteModel>(async(route) => await RemoveRouteAsync(route));

            RefreshCommand = new DelegateCommand(async() => await RefreshRoutesAsync());
            UndoCommand    = new DelegateCommand(async() => await UndoAsync());
            RedoCommand    = new DelegateCommand(async() => await RedoAsync());
        }
Пример #6
0
 protected RouteFormViewModelBase(IRailwayStationService stationService, ILogger logger, IEventAggregator eventAggregator = null) : this(stationService, logger, new RouteModel(), eventAggregator)
 {
 }