ユーザーが長時間実行中のプロセスを開始している間に、スピンホイールのアニメーションgifが進行します。 スタートをクリックすると、プロセスが開始され、同じタイムホイールが回転を開始します。C#、winform - Spining Wheelの進行状況が断続的に途切れて再開します。
しかし、問題は、車輪が途中で衝突して再開することです。これは、長時間のプロセスで複数回発生します。それは連続的に回転しているはずです。同じスレッド()でタスクとアニメーションGIFの両方を実行していますが、インジケータは実際の進捗値ではなくアニメーションの画像であるため、)。
コードは、されているプロセスが終了するまで、私はホイールの非interepted連続画面を表示するにはどうすればよい
this.progressPictureBox.Visible = true;
this.Refresh(); // this - an user controll
this.progressPictureBox.Refresh();
Application.DoEvents();
OnStartCalibration(); // Starts long running process
this.progressPictureBox.Visible = false;
OnStartCalibration()
{
int count = 6;
int sleepInterval = 5000;
bool success = false;
for (int i = 0; i < count; i++)
{
Application.DoEvents();
m_keywordList.Clear();
m_keywordList.Add("HeatCoolModeStatus");
m_role.ReadValueForKeys(m_keywordList, null, null);
l_currentValue = (int)m_role.GetValue("HeatCoolModeStatus");
if (l_currentValue == 16)
{
success = true;
break;
}
System.Threading.Thread.Sleep(sleepInterval);
}
}
を使用しましたか?
を..あなたは、長時間実行されるプロセスを処理する方法にBackgroundWorkerのをいくつかのコードを投稿してください? BeginInvoke? –