ユーザーが実行時間の長いプロセスを開始している間、スピン ホイールの進行状況のアニメーション GIF を表示します。開始をクリックすると、プロセスが開始され、同時にホイールが回転し始めます。
しかし、問題は、ホイールが途中で衝突して再開することです。これは、長期的なプロセス中に何度も発生します。継続的に回転する必要があります。タスクとアニメーション gif の両方を同じスレッドで実行しています (インジケータは単なるアニメーション画像であり、実際の進行状況の値ではないため)。
使用されるコードは、
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);
}
}
プロセスが終了するまでホイールを連続して表示するにはどうすればよいですか?