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 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));
        }
Beispiel #4
0
        public SequenceListPageViewModel(
            INavigationService navigationService,
            ITranslationService translationService,
            ICreationManager creationManager,
            IDialogService dialogService,
            ISharedFileStorageService sharedFileStorageService)
            : base(navigationService, translationService)
        {
            _creationManager         = creationManager;
            _dialogService           = dialogService;
            SharedFileStorageService = sharedFileStorageService;

            ImportSequenceCommand = new SafeCommand(async() => await ImportSequenceAsync(), () => SharedFileStorageService.IsSharedStorageAvailable);
            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));
        }