public UpdateViewModel(IUpdateService updateService,
                               ITaskRunner taskRunner,
                               IStatusBar statusBar,
                               IUpdaterSettingsProvider settingsProvider,
                               IAutoUpdatePlatformService platformService,
                               IFileSystem fileSystem,
                               IStandaloneUpdater standaloneUpdater,
                               IApplication application,
                               IMessageBoxService messageBoxService)
        {
            this.updateService     = updateService;
            this.taskRunner        = taskRunner;
            this.statusBar         = statusBar;
            this.settingsProvider  = settingsProvider;
            this.platformService   = platformService;
            this.fileSystem        = fileSystem;
            this.messageBoxService = messageBoxService;
            CheckForUpdatesCommand = new DelegateCommand(() =>
            {
                if (updateService.CanCheckForUpdates())
                {
                    taskRunner.ScheduleTask("Check for updates", UpdatesCheck);
                }
            }, updateService.CanCheckForUpdates);

            if (!settingsProvider.Settings.DisableAutoUpdates)
            {
                CheckForUpdatesCommand.Execute(null);
            }
        }
 public void Init()
 {
     updateService     = Substitute.For <IUpdateService>();
     taskRunner        = Substitute.For <ITaskRunner>();
     statusBar         = Substitute.For <IStatusBar>();
     settingsProvider  = Substitute.For <IUpdaterSettingsProvider>();
     platformService   = Substitute.For <IAutoUpdatePlatformService>();
     fileSystem        = Substitute.For <IFileSystem>();
     messageBoxService = Substitute.For <IMessageBoxService>();
     application       = Substitute.For <IApplication>();
     standaloneUpdater = Substitute.For <IStandaloneUpdater>();
 }
 public void Init()
 {
     data               = Substitute.For <IUpdateServerDataProvider>();
     clientFactory      = Substitute.For <IUpdateClientFactory>();
     applicationVersion = Substitute.For <IApplicationVersion>();
     application        = Substitute.For <IApplication>();
     fileSystem         = Substitute.For <IFileSystem>();
     standaloneUpdate   = Substitute.For <IStandaloneUpdater>();
     updateClient       = Substitute.For <IUpdateClient>();
     settings           = Substitute.For <IUpdaterSettingsProvider>();
     platformService    = Substitute.For <IAutoUpdatePlatformService>();
     clientFactory
     .Create(Arg.Any <Uri>(), Arg.Any <string>(), Arg.Any <string?>(), Arg.Any <Platforms>())
     .Returns(updateClient);
 }
 public UpdateService(IUpdateServerDataProvider data,
                      IUpdateClientFactory clientFactory,
                      IApplicationVersion applicationVersion,
                      IApplication application,
                      IFileSystem fileSystem,
                      IStandaloneUpdater standaloneUpdater,
                      IUpdaterSettingsProvider settings,
                      IAutoUpdatePlatformService platformService)
 {
     this.data               = data;
     this.clientFactory      = clientFactory;
     this.applicationVersion = applicationVersion;
     this.application        = application;
     this.fileSystem         = fileSystem;
     this.standaloneUpdater  = standaloneUpdater;
     this.settings           = settings;
     this.platformService    = platformService;
     standaloneUpdater.RenameIfNeeded();
 }