예제 #1
0
        //

        public HomeViewModel(ISettingsRepository settingsService, IVersionService versionService)
        {
            _settingsService = settingsService;
            _versionService  = versionService;

            Version       = "v" + _versionService.LocalVersion;
            UpdateCommand = new RelayCommand(Update);

            UpdateNotificationLogic();

            MessengerInstance.Register <Request>(this, async request =>
            {
                if (request == Request.CheckForUpdates &&
                    DateTime.Now > _updateCheckDelay &&
                    DateTime.Now > _settingsService.Version.LastChecked)
                {
                    await _versionService.RefreshVersion();
                    CheckForUpdates();
                    _updateCheckDelay = DateTime.Now.AddMinutes(20);
                }
            });
        }