示例#1
0
        /// <summary>
        /// Check new version
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button12_Click(object sender, EventArgs e)
        {
            new Thread(async() =>
            {
                var result         = await Task.WhenAll(GithubHelper.CheckGitHubLatestVersion(), GithubHelper.CheckGitHublatestBuild());
                var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;
                currentVersion     = new Version(currentVersion.Major, currentVersion.Minor, currentVersion.Build);
                var isNewAvailable = result[0] != null && (currentVersion.CompareTo(result[0]) < 0);

                using (var form = new NewRelease())
                {
                    form.IsNewVersion = isNewAvailable;

                    form.CurrentVersion = currentVersion;
                    form.LatestVersion  = result[0] ?? currentVersion;
                    form.LatestBuild    = result[1] ?? currentVersion;

                    _ = form.ShowDialog();
                }
            }).Start();
        }