Example #1
0
        public WizardViewModelBase()
        {
            CancelCommand = ReactiveCommand.Create(ExecuteCancelCommand, outputScheduler: RxApp.MainThreadScheduler);

            var canExecuteFinishCommand = this.WhenAnyValue(x => x.CanFinish,
                                                            (canFinish) => (canFinish == true));

            FinishCommand = ReactiveCommand.Create(ExecuteFinishCommand, canExecuteFinishCommand, RxApp.MainThreadScheduler);

            var canExecuteHelpCommand = this.WhenAnyValue(x => x.IsHelpButtonVisible,
                                                          (isHelpAvailable) => (isHelpAvailable == true));

            HelpCommand = ReactiveCommand.Create(ExecuteHelpCommand, canExecuteHelpCommand, RxApp.MainThreadScheduler);

            var canExecuteNextPageCommand = this.WhenAnyValue(x => x.HasNextPage,
                                                              (nextPageExists) => (nextPageExists == true));

            NextPageCommand = ReactiveCommand.Create(ExecuteNextPageCommand, canExecuteNextPageCommand, RxApp.MainThreadScheduler);  //new DelegateCommand(x => ExecuteNextPageCommand(), x => CanExecuteNextPageCommand());//

            var canExecutePreviousPageCommand = this.WhenAnyValue(x => x.HasPreviousPage,
                                                                  (previousPageExists) => (previousPageExists == true));

            PreviousPageCommand = ReactiveCommand.Create(ExecutePreviousPageCommand, canExecutePreviousPageCommand, RxApp.MainThreadScheduler); //new DelegateCommand(x => ExecutePreviousPageCommand(), x => CanExecutePreviousPageCommand());//

            WizardPages.CollectionChanged += (o, e) =>
            {
                CurrentPage = WizardPages.FirstOrDefault();
                UpdatePageCommand();
            };
        }
        public async Task <Download?> DownloadAsync(Server server)
        {
            if (server.DownloadUrl == null)
            {
                throw new ArgumentNullException(nameof(server.DownloadUrl));
            }

            var download = new Download(server.DownloadUrl, server.InstallationPath);

            if (!download.CanStart())
            {
                return(null);
            }

            _downloads.Remove(_downloads.FirstOrDefault(d => d.ForkAndVersion == download.ForkAndVersion));

            _downloads.Add(download);
            await download.StartAsync(_http);

            return(download);
        }