private async void CheckNow_Click(object sender, EventArgs e)
        {
            var check = UpdateManager.CheckForUpdateAsync(Config.Update.UpdateChannel);

            var updateDetails = await check;

            if (updateDetails.UpdateAvailable)
            {
                using (var update = new UpdateDialog(updateDetails.UpdateNotes))
                {
                    update.ShowDialog();
                }
            }

            Config.Update.LastCheckDate = DateTime.Today;

            ConfigurationManager.UpdateLastUpdateDate();

            LastCheck.Text = $"Last checked: {Config.Update.LastCheckDate:yyyy-MM-dd}";
        }
Exemple #2
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            _config = ConfigurationManager.LoadConfiguration();

            if (_config.Update.LastCheckDate.AddDays(_config.Update.CheckFrequency) <= DateTime.Today)
            {
                var check = UpdateManager.CheckForUpdateAsync(_config.Update.UpdateChannel);

                var updateDetails = await check;

                if (updateDetails.UpdateAvailable)
                {
                    using (var update = new UpdateDialog(updateDetails.UpdateNotes))
                    {
                        update.ShowDialog();
                    }
                }

                _config.Update.LastCheckDate = DateTime.Today;
                ConfigurationManager.UpdateLastUpdateDate();
            }
        }