예제 #1
0
 private void DisplayTime()
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.lblTimeRemaining.InvokeRequired)
     {
         //call itself on the main thread
         DisplayTimeCallback d = new DisplayTimeCallback(DisplayTime);
         this.Invoke(d);
     }
     else
     {
         long minutesRemaining = m_total_seconds_remaining / 60;
         long secondsRemaining = m_total_seconds_remaining % 60;
         this.lblTimeRemaining.Text = String.Format("{0:00}:{1:00}", minutesRemaining, secondsRemaining);
     }
 }
예제 #2
0
 private void DisplayTime()
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.lblTimeRemaining.InvokeRequired)
     {
         //call itself on the main thread
         DisplayTimeCallback d = new DisplayTimeCallback(DisplayTime);
         this.Invoke(d);
     }
     else
     {
         long minutesRemaining = m_total_seconds_remaining / 60;
         long secondsRemaining = m_total_seconds_remaining % 60;
         this.lblTimeRemaining.Text = String.Format("{0:00}:{1:00}", minutesRemaining, secondsRemaining);
     }
 }