예제 #1
0
        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;
        }
예제 #2
0
        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);
        }
예제 #3
0
        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;
        }
예제 #5
0
        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;
        }
예제 #6
0
        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;
        }
예제 #7
0
        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;
        }
예제 #8
0
 public InstallCommand(IInstallerFactory installerFactory) : base(installerFactory)
 {
 }
 public InstallAndStartInitialization(IInstallerFactory installerFactory, IStartServices serviceStarter)
 {
     _installerFactory = installerFactory;
     _serviceStarter   = serviceStarter;
 }
예제 #10
0
 protected BaseCommand(IInstallerFactory installerFactory)
 {
     InstallerFactory = installerFactory;
     Parameters = new Hashtable();
 }
예제 #11
0
 protected BaseCommand(IInstallerFactory installerFactory)
 {
     InstallerFactory = installerFactory;
     Parameters       = new Hashtable();
 }
예제 #12
0
 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 InstallCommand(IInstallerFactory installerFactory)
     : base(installerFactory)
 {
 }
 public InstallInitialization(IInstallerFactory installerFactory)
 {
     _installerFactory = installerFactory;
 }