public DeploymentViewModel(IDeviceProvider deviceProvider,
                                   IWindowsOptionsProvider optionsProvider,
                                   IWoaDeployer deployer, UIServices uiServices, AdvancedViewModel advancedViewModel,
                                   WimPickViewModel wimPickViewModel, ILowLevelApi lowLevelApi)
        {
            this.optionsProvider   = optionsProvider;
            this.deployer          = deployer;
            this.uiServices        = uiServices;
            this.advancedViewModel = advancedViewModel;
            this.wimPickViewModel  = wimPickViewModel;

            var isSelectedWim = wimPickViewModel.WhenAnyObservable(x => x.WimMetadata.SelectedImageObs)
                                .Select(metadata => metadata != null);

            FullInstallWrapper = new CommandWrapper <Unit, Unit>(this,
                                                                 ReactiveCommand.CreateFromTask(Deploy, isSelectedWim), uiServices.Dialog);
            IsBusyObservable = FullInstallWrapper.Command.IsExecuting;
            isBusy           = IsBusyObservable.ToProperty(this, model => model.IsBusy);

            RefreshDisksCommandWrapper = new CommandWrapper <Unit, ICollection <Disk> >(this,
                                                                                        ReactiveCommand.CreateFromTask(lowLevelApi.GetDisks), uiServices.Dialog);
            disks = RefreshDisksCommandWrapper.Command
                    .Select(x => x.Select(disk => new DiskViewModel(disk)))
                    .ToProperty(this, x => x.Disks);

            this.WhenAnyValue(x => x.SelectedDisk).Where(x => x != null).Subscribe(x => deviceProvider.Device = new RaspberryPi(lowLevelApi, x.Disk));
        }
Esempio n. 2
0
        public DeploymentViewModel(
            IDeploymentContext context,
            IOperationContext operationContext,
            IWoaDeployer deployer, UIServices uiServices, AdvancedViewModel advancedViewModel,
            WimPickViewModel wimPickViewModel, IFileSystemOperations fileSystemOperations, IRaspberryPiSettingsService raspberryPiSettingsService,
            IDiskRoot diskRoot)
        {
            this.context                    = context;
            this.deployer                   = deployer;
            this.uiServices                 = uiServices;
            this.advancedViewModel          = advancedViewModel;
            this.wimPickViewModel           = wimPickViewModel;
            this.fileSystemOperations       = fileSystemOperations;
            this.raspberryPiSettingsService = raspberryPiSettingsService;

            var isSelectedWim = wimPickViewModel.WhenAnyObservable(x => x.WimMetadata.SelectedImageObs)
                                .Select(metadata => metadata != null);

            FullInstallWrapper = new CommandWrapper <Unit, Unit>(this,
                                                                 ReactiveCommand.CreateFromTask(Deploy, isSelectedWim), uiServices.ContextDialog, operationContext);
            IsBusyObservable = FullInstallWrapper.Command.IsExecuting;
            isBusyHelper     = IsBusyObservable.ToProperty(this, model => model.IsBusy);

            RefreshDisksCommandWrapper = new CommandWrapper <Unit, IList <IDisk> >(this,
                                                                                   ReactiveCommand.CreateFromTask(diskRoot.GetDisks), uiServices.ContextDialog, operationContext);
            disks = RefreshDisksCommandWrapper.Command
                    .Select(x => x.Select(disk => new DiskViewModel(disk)))
                    .ToProperty(this, x => x.Disks);

            this.WhenAnyValue(x => x.SelectedDisk).Where(x => x != null).Subscribe(x => context.Device = new RaspberryPi(x.IDisk));
        }