public MainWindow(IInstallerFactory installerFactory, Version version, Action exit, string logPath) { _installerFactory = installerFactory; _exit = exit; _logPath = logPath; InitializeComponent(); Title += " " + version.ToString(3) + " installer"; DataContext = this; var introductionView = new IntroductionView(); introductionView.OnInstall += (sender, args) => { var progress = StartInstallation(installerFactory); InnerContent = progress; }; introductionView.OnCancel += (sender, args) => { Cancel(); }; InnerContent = introductionView; }
ProgressView StartInstallation(IInstallerFactory installerFactory) { var ctSource = new CancellationTokenSource(); var p = new ProgressView(); installerFactory .Start(p.Progress, p.UpdateCommand, ctSource.Token) .ContinueWith(t => { if (t.IsFaulted) { if (t.Exception?.InnerException is OperationCanceledException) { Exit(); return; } Dispatcher.Invoke(() => { InnerContent = new ErrorView(_logPath, Exit); }); } else { Exit(); } }); p.OnCancel += (o, eventArgs) => ctSource.Cancel(); return(p); }
ProgressView StartInstallation(IInstallerFactory installerFactory) { var ctSource = new CancellationTokenSource(); var p = new ProgressView(); installerFactory .Start(p.Progress, p.UpdateCommand, ctSource.Token) .ContinueWith(t => { if (t.IsFaulted) { if (t.Exception?.InnerException is OperationCanceledException) { Exit(); return; } Dispatcher.Invoke(() => { InnerContent = new ErrorView(_logPath, Exit); }); } else { Exit(); } }); p.OnCancel += (o, eventArgs) => ctSource.Cancel(); return p; }
public NuGetInstaller(IInstallerFactory factory, IEngineEnvironmentSettings settings, string installPath, IDownloader packageDownloader, IUpdateChecker updateChecker) { Factory = factory ?? throw new ArgumentNullException(nameof(factory)); _environmentSettings = settings ?? throw new ArgumentNullException(nameof(settings)); _packageDownloader = packageDownloader ?? throw new ArgumentNullException(nameof(packageDownloader)); _updateChecker = updateChecker ?? throw new ArgumentNullException(nameof(updateChecker)); if (string.IsNullOrWhiteSpace(installPath)) { throw new ArgumentException($"{nameof(installPath)} should not be null or empty", nameof(installPath)); } if (!_environmentSettings.Host.FileSystem.DirectoryExists(installPath)) { _environmentSettings.Host.FileSystem.CreateDirectory(installPath); } _installPath = installPath; }
public static async Task ShowWindow(Version version, IInstallerFactory factory, string logPath) { var tcs = new TaskCompletionSource<object>(); var thread = new Thread(() => { try { var application = new Application(); var installerWindow = new MainWindow(factory, version, () => application.Dispatcher.Invoke(() => application.Shutdown()), logPath); application.Run(installerWindow); } finally { tcs.TrySetResult(new object()); } }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); await tcs.Task; }
public static async Task ShowWindow(Version version, IInstallerFactory factory, string logPath) { var tcs = new TaskCompletionSource <object>(); var thread = new Thread(() => { try { var application = new Application(); var installerWindow = new MainWindow(factory, version, () => application.Dispatcher.Invoke(() => application.Shutdown()), logPath); application.Run(installerWindow); } finally { tcs.TrySetResult(new object()); } }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); await tcs.Task; }
public MainWindow(IInstallerFactory installerFactory, Version version, Action exit, string logPath) { _installerFactory = installerFactory; _exit = exit; _logPath = logPath; InitializeComponent(); Title += " " + version.ToString(3) + " beta installer"; DataContext = this; var introductionView = new IntroductionView(); introductionView.OnInstall += (sender, args) => { var progress = StartInstallation(installerFactory); InnerContent = progress; }; introductionView.OnCancel += (sender, args) => { Cancel(); }; InnerContent = introductionView; }
public InstallCommand(IInstallerFactory installerFactory) : base(installerFactory) { }
public InstallAndStartInitialization(IInstallerFactory installerFactory, IStartServices serviceStarter) { _installerFactory = installerFactory; _serviceStarter = serviceStarter; }
protected BaseCommand(IInstallerFactory installerFactory) { InstallerFactory = installerFactory; Parameters = new Hashtable(); }
public FolderInstaller(IEngineEnvironmentSettings settings, IInstallerFactory factory) { _settings = settings ?? throw new ArgumentNullException(nameof(settings)); Factory = factory ?? throw new ArgumentNullException(nameof(factory)); }
public IntitializationStrategyFactory(IServiceRunnerFactory serviceRunnerFactory, IInstallerFactory installerFactory, IStartServices serviceStarter) { _serviceRunnerFactory = serviceRunnerFactory; _installerFactory = installerFactory; _serviceStarter = serviceStarter; }
public InstallInitialization(IInstallerFactory installerFactory) { _installerFactory = installerFactory; }