public AdvancedViewModel(ILumiaSettingsService lumiaSettingsService, IFileSystemOperations fileSystemOperations,
                                 UIServices uiServices, IDeploymentContext context, IOperationContext operationContext, IOperationProgress progress,
                                 IList <Meta <IDiskLayoutPreparer> > diskPreparers,
                                 ILogCollector logCollector)
        {
            this.lumiaSettingsService = lumiaSettingsService;
            this.uiServices           = uiServices;
            this.context      = context;
            this.logCollector = logCollector;

            DiskPreparers = diskPreparers;

            DeleteDownloadedWrapper = new ProgressViewModel(ReactiveCommand.CreateFromTask(() => DeleteDownloaded(fileSystemOperations)), progress, this, uiServices.ContextDialog, operationContext);

            ForceDualBootWrapper = new ProgressViewModel(ReactiveCommand.CreateFromTask(ForceDualBoot), progress, this, uiServices.ContextDialog, operationContext);

            ForceSingleBootWrapper = new ProgressViewModel(ReactiveCommand.CreateFromTask(ForceDisableDualBoot), progress, this, uiServices.ContextDialog, operationContext);

            CollectLogsCommmandWrapper = new ProgressViewModel(ReactiveCommand.CreateFromTask(CollectLogs), progress, this, uiServices.ContextDialog, operationContext);

            IsBusyObservable = Observable.Merge(DeleteDownloadedWrapper.Command.IsExecuting,
                                                ForceDualBootWrapper.Command.IsExecuting, ForceSingleBootWrapper.Command.IsExecuting,
                                                CollectLogsCommmandWrapper.Command.IsExecuting);

            preparerUpdater = this.WhenAnyValue(x => x.SelectedPreparer)
                              .Where(x => x != null)
                              .Subscribe(x =>
            {
                context.DiskLayoutPreparer        = x.Value;
                lumiaSettingsService.DiskPreparer = (string)x.Metadata["Name"];
            });

            SelectedPreparer = GetInitialDiskPreparer();
        }
Example #2
0
        public DeploymentViewModel(
            IDeploymentContext context,
            IWoaDeployer woaDeployer,
            IOperationContext operationContext, UIServices uiServices, AdvancedViewModel advancedViewModel, IOperationProgress progress,
            WimPickViewModel wimPickViewModel, IFileSystemOperations fileSystemOperations, ILumiaSettingsService lumiaSettingsService)
        {
            this.context              = context;
            this.woaDeployer          = woaDeployer;
            this.uiServices           = uiServices;
            this.advancedViewModel    = advancedViewModel;
            this.wimPickViewModel     = wimPickViewModel;
            this.fileSystemOperations = fileSystemOperations;
            this.lumiaSettingsService = lumiaSettingsService;

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

            FullInstallWrapper = new ProgressViewModel(ReactiveCommand.CreateFromTask(Deploy, isSelectedWim), progress, this, uiServices.ContextDialog, operationContext);
            IsBusyObservable   = FullInstallWrapper.Command.IsExecuting;
            isBusyHelper       = IsBusyObservable.ToProperty(this, model => model.IsBusy);
        }
        public AdvancedViewModel(ILumiaSettingsService lumiaSettingsService, IFileSystemOperations fileSystemOperations,
                                 UIServices uiServices, IDeploymentContext context,
                                 IList <Meta <IDiskLayoutPreparer> > diskPreparers,
                                 IWindowsDeployer deployer,
                                 IOperationProgress progress)
        {
            this.lumiaSettingsService = lumiaSettingsService;
            this.uiServices           = uiServices;
            this.context  = context;
            this.deployer = deployer;
            this.progress = progress;

            DiskPreparers = diskPreparers;

            DeleteDownloadedWrapper = new CommandWrapper <Unit, Unit>(this,
                                                                      ReactiveCommand.CreateFromTask(() => DeleteDownloaded(fileSystemOperations)), uiServices.Dialog);
            ForceDualBootWrapper = new CommandWrapper <Unit, Unit>(this, ReactiveCommand.CreateFromTask(ForceDualBoot),
                                                                   uiServices.Dialog);
            ForceSingleBootWrapper = new CommandWrapper <Unit, Unit>(this,
                                                                     ReactiveCommand.CreateFromTask(ForceDisableDualBoot), uiServices.Dialog);

            BackupCommandWrapper =
                new CommandWrapper <Unit, Unit>(this, ReactiveCommand.CreateFromTask(Backup), uiServices.Dialog);
            RestoreCommandWrapper =
                new CommandWrapper <Unit, Unit>(this, ReactiveCommand.CreateFromTask(Restore), uiServices.Dialog);

            IsBusyObservable = Observable.Merge(DeleteDownloadedWrapper.Command.IsExecuting,
                                                BackupCommandWrapper.Command.IsExecuting, RestoreCommandWrapper.Command.IsExecuting,
                                                ForceDualBootWrapper.Command.IsExecuting, ForceSingleBootWrapper.Command.IsExecuting);

            preparerUpdater = this.WhenAnyValue(x => x.SelectedPreparer)
                              .Where(x => x != null)
                              .Subscribe(x =>
            {
                context.DiskLayoutPreparer        = x.Value;
                lumiaSettingsService.DiskPreparer = (string)x.Metadata["Name"];
            });

            SelectedPreparer = GetInitialDiskPreparer();
        }
        public WoaMaintenanceViewModel(IWindowsDeployer deployer,
                                       UIServices uiServices,
                                       IDeploymentContext context,
                                       IOperationProgress progress,
                                       IOperationContext operationContext,
                                       ILumiaSettingsService lumiaSettingsService)
        {
            this.deployer             = deployer;
            this.uiServices           = uiServices;
            this.context              = context;
            this.progress             = progress;
            this.lumiaSettingsService = lumiaSettingsService;

            BackupProgressViewModel  = new ProgressViewModel(ReactiveCommand.CreateFromTask(Backup), progress, this, uiServices.ContextDialog, operationContext);
            RestoreProgressViewModel = new ProgressViewModel(ReactiveCommand.CreateFromTask(Restore), progress, this, uiServices.ContextDialog, operationContext);

            IsBusyObservable = Observable.Merge(new[]
            {
                BackupProgressViewModel.Command.IsExecuting,
                RestoreProgressViewModel.Command.IsExecuting,
            });
        }
 public KeepMobileOSDiskLayoutPreparer(IDeploymentContext context, IEnumerable <ISpaceAllocator <IPhone> > spaceAllocators, IExistingDeploymentCleaner cleaner, ILumiaSettingsService lumiaSettingsService) : base(context, cleaner)
 {
     this.spaceAllocators      = spaceAllocators;
     this.lumiaSettingsService = lumiaSettingsService;
 }