예제 #1
0
        private async void btnRefresh_Click(object sender, EventArgs e)
        {
            using var progressDlg = new ProgressForm(10000);
            try
            {
                Enabled                    = false;
                Cursor.Current             = Cursors.WaitCursor;
                progressDlg.Text           = Resources.Localization_RefreshAvailableVersion_Title;
                progressDlg.UserCancelText = Resources.Localization_Stop_Text;
                progressDlg.Show(this);
                await _currentRepository.RefreshUpdatesAsync(progressDlg.CancelToken);

                progressDlg.CurrentTaskProgress = 1.0f;
            }
            catch
            {
                if (!progressDlg.IsCanceledByUser)
                {
                    MessageBox.Show(Resources.Localization_Download_ErrorText,
                                    Resources.Localization_Download_ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                Enabled        = true;
                progressDlg.Hide();
                UpdateAvailableVersions();
            }
        }