Пример #1
0
        /// <summary>
        /// 检查新版本
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void poeLable_Click(object sender, EventArgs e)
        {
            //initial delegate
            AsyncMsgBox.msgDelegateInstance = new AsyncMsgBox.msgDelegate(AsyncMsgBox.msgMethod);
            updateStatusBox("Checking PoeDB version...");
            updateStatusBox("Local PoeDB version is " + poeLable.Text.Split('_')[1]);

            var updateRequired = false;
            var progress       = new Progress <VersionCheckProgress>();

            progress.ProgressChanged += (o, report) => {
                Console.WriteLine(report.PercentComplete);
                versionBar.Value = report.PercentComplete;
                versionBar.Update();
            };
            await Task.Run(() => ProcessData(100, progress));

            if (updateRequired)
            {
                AsyncMsgBox.showMsg("Update required");
            }
            else
            {
                AsyncMsgBox.showMsg("Version is latest");
            }
            //string wait = await PageContent.update();
            //statusBox.Items.Add(wait);
            //todo: add latest version from fetched data
            updateStatusBox("PoeDB version check complete");

            versionBar.Value = 0;
        }
Пример #2
0
 private void loadingAsync()
 {
     if (!loadWork.IsBusy && !loadPageWork.IsBusy)
     {
         loadWork.RunWorkerAsync();
         loadPageWork.RunWorkerAsync();
         Console.Out.WriteLine("monBtn");
     }
     else
     {
         AsyncMsgBox.msgDelegateInstance = new AsyncMsgBox.msgDelegate(AsyncMsgBox.msgMethod);
         AsyncMsgBox.showMsg("loading is busy");
     }
 }