public SequenceEditorPageViewModel( INavigationService navigationService, ITranslationService translationService, IDialogService dialogService, ICreationManager creationManager, ISharedFileStorageService sharedFileStorageService, NavigationParameters parameters) : base(navigationService, translationService) { _dialogService = dialogService; _creationManager = creationManager; SharedFileStorageService = sharedFileStorageService; OriginalSequence = parameters.Get <Sequence>("sequence"); Sequence = new Sequence { Name = OriginalSequence.Name, Loop = OriginalSequence.Loop, Interpolate = OriginalSequence.Interpolate, ControlPoints = new ObservableCollection <SequenceControlPoint>(OriginalSequence.ControlPoints.Select(cp => new SequenceControlPoint { Value = cp.Value, DurationMs = cp.DurationMs }).ToArray()) }; ExportSequenceCommand = new SafeCommand(async() => await ExportSequenceAsync(), () => SharedFileStorageService.IsSharedStorageAvailable); RenameSequenceCommand = new SafeCommand(async() => await RenameSequenceAsync()); AddControlPointCommand = new SafeCommand(() => AddControlPoint()); DeleteControlPointCommand = new SafeCommand <SequenceControlPoint>(async(controlPoint) => await DeleteControlPointAsync(controlPoint)); SaveSequenceCommand = new SafeCommand(async() => await SaveSequenceAsync(), () => !_dialogService.IsDialogOpen); ChangeControlPointDurationCommand = new SafeCommand <SequenceControlPoint>(async(controlPoint) => await ChangeControlPointDurationAsync(controlPoint)); }
public ControllerProfilePageViewModel( INavigationService navigationService, ITranslationService translationService, ICreationManager creationManager, IDeviceManager deviceManager, IDialogService dialogService, IPlayLogic playLogic, NavigationParameters parameters) : base(navigationService, translationService) { _creationManager = creationManager; _deviceManager = deviceManager; _dialogService = dialogService; _playLogic = playLogic; ControllerProfile = parameters.Get <ControllerProfile>("controllerprofile"); RenameProfileCommand = new SafeCommand(async() => await RenameControllerProfileAsync()); AddControllerEventCommand = new SafeCommand(async() => await AddControllerEventAsync()); PlayCommand = new SafeCommand(async() => await PlayAsync()); ControllerActionTappedCommand = new SafeCommand <ControllerActionViewModel>(async controllerActionViewModel => await NavigationService.NavigateToAsync <ControllerActionPageViewModel>(new NavigationParameters(("controlleraction", controllerActionViewModel.ControllerAction)))); DeleteControllerEventCommand = new SafeCommand <ControllerEvent>(async controllerEvent => await DeleteControllerEventAsync(controllerEvent)); DeleteControllerActionCommand = new SafeCommand <ControllerAction>(async controllerAction => await DeleteControllerActionAsync(controllerAction)); PopulateControllerEvents(); }
public CreationListPageViewModel( INavigationService navigationService, ITranslationService translationService, ICreationManager creationManager, IDeviceManager deviceManager, IDialogService dialogService, ISharedFileStorageService sharedFileStorageService, IReadWriteExternalStoragePermission readWriteExternalStoragePermission) : base(navigationService, translationService) { _creationManager = creationManager; _deviceManager = deviceManager; _dialogService = dialogService; _readWriteExternalStoragePermission = readWriteExternalStoragePermission; SharedFileStorageService = sharedFileStorageService; ImportCreationCommand = new SafeCommand(async() => await ImportCreationAsync(), () => SharedFileStorageService.IsSharedStorageAvailable); OpenSettingsPageCommand = new SafeCommand(async() => await navigationService.NavigateToAsync <SettingsPageViewModel>(), () => !_dialogService.IsDialogOpen); AddCreationCommand = new SafeCommand(async() => await AddCreationAsync()); CreationTappedCommand = new SafeCommand <Creation>(async creation => await NavigationService.NavigateToAsync <CreationPageViewModel>(new NavigationParameters(("creation", creation)))); DeleteCreationCommand = new SafeCommand <Creation>(async creation => await DeleteCreationAsync(creation)); NavigateToDevicesCommand = new SafeCommand(async() => await NavigationService.NavigateToAsync <DeviceListPageViewModel>()); NavigateToControllerTesterCommand = new SafeCommand(async() => await NavigationService.NavigateToAsync <ControllerTesterPageViewModel>()); NavigateToSequencesCommand = new SafeCommand(async() => await NavigationService.NavigateToAsync <SequenceListPageViewModel>()); NavigateToAboutCommand = new SafeCommand(async() => await NavigationService.NavigateToAsync <AboutPageViewModel>()); }
public CreationPageViewModel( INavigationService navigationService, ITranslationService translationService, ICreationManager creationManager, IDialogService dialogService, ISharedFileStorageService sharedFileStorageService, IPlayLogic playLogic, NavigationParameters parameters) : base(navigationService, translationService) { _creationManager = creationManager; _dialogService = dialogService; SharedFileStorageService = sharedFileStorageService; _playLogic = playLogic; Creation = parameters.Get <Creation>("creation"); ImportControllerProfileCommand = new SafeCommand(async() => await ImportControllerProfileAsync(), () => SharedFileStorageService.IsSharedStorageAvailable); ExportCreationCommand = new SafeCommand(async() => await ExportCreationAsync(), () => SharedFileStorageService.IsSharedStorageAvailable); RenameCreationCommand = new SafeCommand(async() => await RenameCreationAsync()); PlayCommand = new SafeCommand(async() => await PlayAsync()); AddControllerProfileCommand = new SafeCommand(async() => await AddControllerProfileAsync()); ControllerProfileTappedCommand = new SafeCommand <ControllerProfile>(async controllerProfile => await NavigationService.NavigateToAsync <ControllerProfilePageViewModel>(new NavigationParameters(("controllerprofile", controllerProfile)))); DeleteControllerProfileCommand = new SafeCommand <ControllerProfile>(async controllerProfile => await DeleteControllerProfileAsync(controllerProfile)); }
public ControllerActionPageViewModel( INavigationService navigationService, ITranslationService translationService, ICreationManager creationManager, IDeviceManager deviceManager, IDialogService dialogService, IPreferences preferences, NavigationParameters parameters) : base(navigationService, translationService) { _creationManager = creationManager; _deviceManager = deviceManager; _dialogService = dialogService; _preferences = preferences; ControllerAction = parameters.Get <ControllerAction>("controlleraction", null); ControllerEvent = parameters.Get <ControllerEvent>("controllerevent", null) ?? ControllerAction?.ControllerEvent; var device = _deviceManager.GetDeviceById(ControllerAction?.DeviceId); if (ControllerAction != null && device != null) { SelectedDevice = device; Action.Channel = ControllerAction.Channel; Action.IsInvert = ControllerAction.IsInvert; Action.ChannelOutputType = ControllerAction.ChannelOutputType; Action.MaxServoAngle = ControllerAction.MaxServoAngle; Action.ButtonType = ControllerAction.ButtonType; Action.AxisType = ControllerAction.AxisType; Action.AxisCharacteristic = ControllerAction.AxisCharacteristic; Action.MaxOutputPercent = ControllerAction.MaxOutputPercent; Action.AxisDeadZonePercent = ControllerAction.AxisDeadZonePercent; Action.ServoBaseAngle = ControllerAction.ServoBaseAngle; Action.StepperAngle = ControllerAction.StepperAngle; Action.SequenceName = ControllerAction.SequenceName; } else { var lastSelectedDeviceId = _preferences.Get <string>("LastSelectedDeviceId", null, "com.scn.BrickController2.ControllerActionPage"); SelectedDevice = _deviceManager.GetDeviceById(lastSelectedDeviceId) ?? _deviceManager.Devices.FirstOrDefault(); Action.Channel = 0; Action.IsInvert = false; Action.ChannelOutputType = ChannelOutputType.NormalMotor; Action.MaxServoAngle = 90; Action.ButtonType = ControllerButtonType.Normal; Action.AxisType = ControllerAxisType.Normal; Action.AxisCharacteristic = ControllerAxisCharacteristic.Linear; Action.MaxOutputPercent = 100; Action.AxisDeadZonePercent = 0; Action.ServoBaseAngle = 0; Action.StepperAngle = 90; Action.SequenceName = string.Empty; } SaveControllerActionCommand = new SafeCommand(async() => await SaveControllerActionAsync(), () => SelectedDevice != null); DeleteControllerActionCommand = new SafeCommand(async() => await DeleteControllerActionAsync()); OpenDeviceDetailsCommand = new SafeCommand(async() => await OpenDeviceDetailsAsync(), () => SelectedDevice != null); OpenChannelSetupCommand = new SafeCommand(async() => await OpenChannelSetupAsync(), () => SelectedDevice != null); OpenSequenceEditorCommand = new SafeCommand(async() => await OpenSequenceEditorAsync()); }
public void Construct(ObstaclesController obstaclesController, LocationSettings locationSettings, FinalPopup finalPopup, StartText startText, ICreationManager creationManager) { _obstaclesController = obstaclesController; _finalPopup = finalPopup; _startText = startText; _creationManager = creationManager; _jumpForce = locationSettings.JumpForce; _firstTap = true; }
public SequenceListPageViewModel( INavigationService navigationService, ITranslationService translationService, ICreationManager creationManager, IDialogService dialogService) : base(navigationService, translationService) { _creationManager = creationManager; _dialogService = dialogService; AddSequenceCommand = new SafeCommand(async() => await AddSequenceAsync()); SequenceTappedCommand = new SafeCommand <Sequence>(async sequence => await NavigationService.NavigateToAsync <SequenceEditorPageViewModel>(new NavigationParameters(("sequence", sequence)))); DeleteSequenceCommand = new SafeCommand <Sequence>(async(sequence) => await DeleteSequenceAsync(sequence)); }
public ControllerActionPageViewModel( INavigationService navigationService, ITranslationService translationService, ICreationManager creationManager, IDeviceManager deviceManager, IDialogService dialogService, NavigationParameters parameters) : base(navigationService, translationService) { _creationManager = creationManager; _deviceManager = deviceManager; _dialogService = dialogService; ControllerAction = parameters.Get <ControllerAction>("controlleraction", null); ControllerEvent = parameters.Get <ControllerEvent>("controllerevent", null) ?? ControllerAction.ControllerEvent; var device = _deviceManager.GetDeviceById(ControllerAction?.DeviceId); if (ControllerAction != null && device != null) { SelectedDevice = device; Channel = ControllerAction.Channel; IsInvert = ControllerAction.IsInvert; ChannelOutputType = ControllerAction.ChannelOutputType; MaxServoAngle = ControllerAction.MaxServoAngle; ButtonType = ControllerAction.ButtonType; AxisCharacteristic = ControllerAction.AxisCharacteristic; MaxOutputPercent = ControllerAction.MaxOutputPercent; AxisDeadZonePercent = ControllerAction.AxisDeadZonePercent; } else { SelectedDevice = _deviceManager.Devices.FirstOrDefault(); Channel = 0; IsInvert = false; ChannelOutputType = ChannelOutputType.NormalMotor; MaxServoAngle = 90; ButtonType = ControllerButtonType.Normal; AxisCharacteristic = ControllerAxisCharacteristic.Linear; MaxOutputPercent = 100; AxisDeadZonePercent = 0; } SaveControllerActionCommand = new SafeCommand(async() => await SaveControllerActionAsync(), () => SelectedDevice != null); DeleteControllerActionCommand = new SafeCommand(async() => await DeleteControllerActionAsync()); OpenDeviceDetailsCommand = new SafeCommand(async() => await OpenDeviceDetailsAsync(), () => SelectedDevice != null); }
public CreationListPageViewModel( INavigationService navigationService, ICreationManager creationManager, IDeviceManager deviceManager, IDialogService dialogService) : base(navigationService) { _creationManager = creationManager; _deviceManager = deviceManager; _dialogService = dialogService; AddCreationCommand = new SafeCommand(async() => await AddCreation()); CreationTappedCommand = new SafeCommand <Creation>(async creation => await NavigationService.NavigateToAsync <CreationPageViewModel>(new NavigationParameters(("creation", creation)))); DeleteCreationCommand = new SafeCommand <Creation>(async creation => await DeleteCreationAsync(creation)); NavigateToDevicesCommand = new SafeCommand(async() => await NavigationService.NavigateToAsync <DeviceListPageViewModel>()); NavigateToControllerTesterCommand = new SafeCommand(async() => await NavigationService.NavigateToAsync <ControllerTesterPageViewModel>()); NavigateToAboutCommand = new SafeCommand(async() => await NavigationService.NavigateToAsync <AboutPageViewModel>()); }
public CreationPageViewModel( INavigationService navigationService, ICreationManager creationManager, IDeviceManager deviceManager, IDialogService dialogService, NavigationParameters parameters) : base(navigationService) { _creationManager = creationManager; _deviceManager = deviceManager; _dialogService = dialogService; Creation = parameters.Get <Creation>("creation"); RenameCreationCommand = new SafeCommand(async() => await RenameCreationAsync()); PlayCommand = new SafeCommand(async() => await PlayAsync()); AddControllerProfileCommand = new SafeCommand(async() => await AddControllerProfileAsync()); ControllerProfileTappedCommand = new SafeCommand <ControllerProfile>(async controllerProfile => await NavigationService.NavigateToAsync <ControllerProfilePageViewModel>(new NavigationParameters(("controllerprofile", controllerProfile)))); DeleteControllerProfileCommand = new SafeCommand <ControllerProfile>(async controllerProfile => await DeleteControllerProfileAsync(controllerProfile)); }
public void Construct(LocationSettings locationSettings, ICreationManager creationManager) { _locationSettings = locationSettings; _creationManager = creationManager; _position = transform.position.x; }
public FlappyBirdGameController(ICreationManager creationManager) { _creationManager = creationManager; }