コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public UpdaterConfigurationViewModel(IUpdaterSettingsProvider settings,
                                             IApplicationVersion applicationVersion,
                                             IChangelogProvider changelogProvider,
                                             UpdateViewModel updateViewModel)
        {
            this.settings = settings;
            Watch(settings, s => s.Settings, nameof(LastCheckForUpdates));
            Watch(this, t => t.DisableAutoUpdates, nameof(IsModified));
            Watch(this, t => t.EnableSilentUpdates, nameof(IsModified));

            ShowChangelog = new DelegateCommand(changelogProvider.TryShowChangelog, changelogProvider.HasChangelog);
            Save          = new DelegateCommand(() =>
            {
                var sett = settings.Settings;
                sett.DisableAutoUpdates  = DisableAutoUpdates;
                sett.EnableSilentUpdates = EnableSilentUpdates;
                settings.Settings        = sett;
                RaisePropertyChanged(nameof(IsModified));
            });
            EnableSilentUpdates    = settings.Settings.EnableSilentUpdates;
            DisableAutoUpdates     = settings.Settings.DisableAutoUpdates;
            CheckForUpdatesCommand = updateViewModel.CheckForUpdatesCommand;
            CurrentVersion         = applicationVersion.VersionKnown
                ? $"build {applicationVersion.BuildVersion}"
                : "-- not known --";
        }
コード例 #3
0
        public void Init()
        {
            settings        = Substitute.For <IUpdaterSettingsProvider>();
            currentVersion  = Substitute.For <IApplicationVersion>();
            documentManager = Substitute.For <IDocumentManager>();
            fileSystem      = Substitute.For <IFileSystem>();

            fileSystem.Exists("changelog.json").Returns(true);
            fileSystem.ReadAllText("changelog.json").Returns(@"[{""Version"":294,""VersionName"":""Build 0.1.294"",""Date"":""2021-03-13T17:38:00"",""UpdateTitle"":null,""Changes"":[]}]");
        }
コード例 #4
0
 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>();
 }
コード例 #5
0
 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);
 }
コード例 #6
0
        public ChangelogProvider(IUpdaterSettingsProvider settings,
                                 IApplicationVersion currentVersion,
                                 IDocumentManager documentManager,
                                 IFileSystem fileSystem)
        {
            this.settings        = settings;
            this.currentVersion  = currentVersion;
            this.documentManager = documentManager;
            this.fileSystem      = fileSystem;

            if (settings.Settings.LastShowedChangelog < currentVersion.BuildVersion)
            {
                TryShowChangelog();
            }
        }
コード例 #7
0
 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();
 }