Esempio n. 1
0
        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 PlayerPageViewModel(
            INavigationService navigationService,
            ITranslationService translationService,
            IDeviceManager deviceManager,
            IDialogService dialogService,
            IGameControllerService gameControllerService,
            IUIThreadService uIThreadService,
            IPlayLogic playLogic,
            NavigationParameters parameters)
            : base(navigationService, translationService)
        {
            _deviceManager         = deviceManager;
            _dialogService         = dialogService;
            _gameControllerService = gameControllerService;
            _uIThreadService       = uIThreadService;
            _playLogic             = playLogic;

            Creation      = parameters.Get <Creation>("creation");
            ActiveProfile = Creation.ControllerProfiles.First();

            CollectDevices();

            BuWizzOutputLevelChangedCommand  = new SafeCommand <int>(level => ChangeOutputLevel(level, _buwizzDevices));
            BuWizz2OutputLevelChangedCommand = new SafeCommand <int>(level => ChangeOutputLevel(level, _buwizz2Devices));
        }
        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));
        }
Esempio n. 4
0
            public ControllerEventViewModel(
                ControllerEvent controllerEvent,
                IDeviceManager deviceManager,
                IPlayLogic playLogic,
                ITranslationService translationService)
            {
                ControllerEvent = controllerEvent;

                AddRange(controllerEvent.ControllerActions.Select(ca => new ControllerActionViewModel(ca, deviceManager, playLogic, translationService)));
            }
Esempio n. 5
0
 private void PopulateGroup(
     ControllerEvent controllerEvent,
     IDeviceManager deviceManager,
     IPlayLogic playLogic,
     ITranslationService translationService)
 {
     Clear();
     foreach (var controllerAction in controllerEvent.ControllerActions)
     {
         Add(new ControllerActionViewModel(controllerAction, deviceManager, playLogic, translationService));
     }
 }
Esempio n. 6
0
            public ControllerEventViewModel(
                ControllerEvent controllerEvent,
                IDeviceManager deviceManager,
                IPlayLogic playLogic,
                ITranslationService translationService)
            {
                ControllerEvent     = controllerEvent;
                _deviceManager      = deviceManager;
                _playLogic          = playLogic;
                _translationService = translationService;

                PopulateGroup(controllerEvent, deviceManager, playLogic, translationService);
                controllerEvent.ControllerActions.CollectionChanged += OnCollectionChanged;
            }
Esempio n. 7
0
            public ControllerActionViewModel(
                ControllerAction controllerAction,
                IDeviceManager deviceManager,
                IPlayLogic playLogic,
                ITranslationService translationService)
            {
                ControllerAction = controllerAction;
                var device = deviceManager.GetDeviceById(controllerAction.DeviceId);

                ControllerActionValid = playLogic.ValidateControllerAction(controllerAction);
                DeviceName            = device != null ? device.Name : translationService.Translate("Missing");
                DeviceType            = device != null ? device.DeviceType : DeviceType.Unknown;
                Channel    = controllerAction.Channel;
                InvertName = controllerAction.IsInvert ? translationService.Translate("Inv") : string.Empty;
            }