public VersionCheckerViewModel(VersionChecker versionChecker, FileDownloader fileDownloader,
            IUserInterface userInterface, IVersionCheckerConfig config, IVersionCheckerUserInterface versionCheckerUserInterface)
        {
            if (versionChecker == null) throw new ArgumentNullException("versionChecker");
            if (fileDownloader == null) throw new ArgumentNullException("fileDownloader");
            if (userInterface == null) throw new ArgumentNullException("userInterface");
            if (config == null) throw new ArgumentNullException("config");
            if (versionCheckerUserInterface == null) throw new ArgumentNullException("versionCheckerUserInterface");

            this.versionChecker = versionChecker;
            this.fileDownloader = fileDownloader;
            this.userInterface = userInterface;
            this.config = config;
            this.versionCheckerUserInterface = versionCheckerUserInterface;

            CheckAgainCommand = new RelayCommand(p => true, CheckAgainClicked);
            DownloadCommand = new RelayCommand(p => true, DownloadClicked);
            OpenDownloadedFileCommand = new RelayCommand(p => true, OpenDownloadedFileClicked);
            CheckAtStartupCommand = new RelayCommand(p => true, CheckAtStartupChanged);
            CloseCommand = new RelayCommand(p => true, CloseClicked);

            ChangeStateToEmpty();

            versionChecker.CheckStarting += HandleVersionCheckStarting;
            versionChecker.CheckCompleted += HandleCheckCompleted;

            this.fileDownloader.DownloadFileStarting += HandleDownloadFileStarting;
            this.fileDownloader.DownloadProgressChanged += HandleDownloadProgressChanged;
            this.fileDownloader.DownloadFileCompleted += HandleDownloadFileCompleted;

            config.CheckAtStartUpChanged += HandleOptionsCheckAtStartupChanged;

            CheckAtStartupEnabled = true;
            CheckAtStartupValue = config.CheckAtStartUp;
        }
        public VersionCheckerUserInterface(VersionChecker versionChecker, FileDownloader fileDownloader,
            IUserInterface userInterface, IVersionCheckerConfig versionCheckerConfig)
        {
            if (versionChecker == null) throw new ArgumentNullException("versionChecker");
            if (fileDownloader == null) throw new ArgumentNullException("fileDownloader");
            if (userInterface == null) throw new ArgumentNullException("userInterface");
            if (versionCheckerConfig == null) throw new ArgumentNullException("versionCheckerConfig");

            this.versionChecker = versionChecker;
            this.fileDownloader = fileDownloader;
            this.userInterface = userInterface;
            this.versionCheckerConfig = versionCheckerConfig;
        }
Esempio n. 3
0
        protected VersioningModuleBase(Configuration config)
        {
            if (config == null) throw new ArgumentNullException("config");

            Config = new VersionCheckerConfig(config);

            IUserInterface userInterface = CreateUserInterfaceHelper();

            Checker = new VersionChecker
            {
                MinCheckTime = TimeSpan.FromSeconds(1),
                AppInfoFileLocation = Config.Url,
                AppInfoProvider = new HttpFileProvider()
            };

            FileDownloader fileDownloader = new FileDownloader(userInterface);
            UserInterface = CreateVersionCheckerUserInterface(Checker, fileDownloader, userInterface, Config);

            Config.UrlChanged += HandleConfigUrlChanged;
        }
Esempio n. 4
0
 protected override IVersionCheckerUserInterface CreateVersionCheckerUserInterface(VersionChecker versionChecker, FileDownloader fileDownloader, IUserInterface userInterface, IVersionCheckerConfig versionCheckerConfig)
 {
     return new VersionCheckerUserInterface(versionChecker, fileDownloader, userInterface, versionCheckerConfig);
 }
Esempio n. 5
0
 protected abstract IVersionCheckerUserInterface CreateVersionCheckerUserInterface(VersionChecker versionChecker, FileDownloader fileDownloader, IUserInterface userInterface, IVersionCheckerConfig versionCheckerConfig);