public EditStationViewModel( INavigationService navigationService, IStationService stationService, ILocationPicker locationPicker, IDialogService dialogService, string communityId, string?stationId = null) { _navigationService = navigationService; _stationService = stationService; _locationPicker = locationPicker; _dialogService = dialogService; CommunityId = communityId; StationId = stationId; PickLocationCommand = CreateCommand(PickLocation); ConfirmCommand = CreateCommand(Confirm); CancelCommand = CreateCommand(Cancel); DeleteCommand = CreateCommand(Delete); PropertyChanged += (_, args) => { if (args.PropertyName == nameof(Station)) { OnPropertyChanged(nameof(Name)); OnPropertyChanged(nameof(Description)); OnPropertyChanged(nameof(Location)); } }; }
public EditBikeViewModel( IDialogService dialogService, ILockService lockService, IBikeService bikeService, IMembershipService membershipService, ICommunityService communityService, ILocationPicker locationPicker, IQRCodeScanner qrCodeScanner, INavigationService navigationService, string communityId, string bikeId) { _dialogService = dialogService; _lockService = lockService; _bikeService = bikeService; _membershipService = membershipService; _communityService = communityService; _locationPicker = locationPicker; _qrCodeScanner = qrCodeScanner; _navigationService = navigationService; _communityId = communityId; _bikeId = bikeId; SetLocationCommand = CreateCommand <Bike>(SetLocation, CanSetLocation); RenameBikeCommand = CreateCommand <Bike>(RenameBike, CanRenameBike); DeleteBikeCommand = CreateCommand <Bike>(DeleteBike, CanDeleteBike); ShowCurrentLenderCommand = CreateCommand <Bike>(ShowCurrentLender, CanShowCurrentLender); AddLockCommand = CreateCommand <Bike>(AddLock, CanAddLock); AddLockWithQRCodeCommand = CreateCommand <Bike>(AddLockWithQRCode, CanAddLock); OpenLockCommand = CreateCommand <Bike>(OpenLock, CanOpenLock); CloseLockCommand = CreateCommand <Bike>(CloseLock, CanCloseLock); RemoveLockCommand = CreateCommand <Bike>(RemoveLock, CanRemoveLock); PropertyChanged += (_, args) => { switch (args.PropertyName) { case nameof(Bike): { OnPropertyChanged(nameof(Name)); OnPropertyChanged(nameof(LendState)); OnPropertyChanged(nameof(LockState)); break; } case nameof(CurrentUserMembership): { // Needed to update permissions for the commands OnPropertyChanged(nameof(Bike)); break; } } }; }
private void Start() { LocalPlayerIndex = m_viewport.LocalPlayerIndex; int playerIndex = m_gameState.LocalToPlayerIndex(LocalPlayerIndex); m_cameraController = Dependencies.GameView.GetCameraController(LocalPlayerIndex); m_locationPicker = Dependencies.GameView.GetLocationPicker(LocalPlayerIndex); m_playersBot = MatchFactoryCli.CreateBotController(m_gameState.GetPlayer(playerIndex), m_engine.GetClientTaskEngine(playerIndex), new PlayerStrategy()); m_playersBot.Init(); SerializedTask[] taskTemplates = m_gameState.GetTaskTemplates(playerIndex); SerializedNamedTaskLaunchInfo[] taskTemplatesData = m_gameState.GetTaskTemplateData(playerIndex); for (int i = 0; i < taskTemplates.Length; ++i) { TaskTemplateType coreTaskType = taskTemplatesData[i].Type; m_playersBot.RegisterTask(coreTaskType, taskTemplates[i]); } }