예제 #1
0
 public void SetClock(TimeSpan ts)
 {
     //cross threading non-sense
     if (textBoxHours.InvokeRequired || textBoxMin.InvokeRequired || textBoxSeconds.InvokeRequired)
     {
         try
         {
             ClockCallBack d = new ClockCallBack(SetClock);
             this.Invoke(d, new object[] { ts });
         }
         catch (ObjectDisposedException ode) { }//saw this when app was closed without ending race first
         catch (Exception e) { MessageBox.Show(e.Message); }
     }
     else
     {
         textBoxHours.Text   = ts.Hours.ToString();
         textBoxMin.Text     = ts.Minutes.ToString();
         textBoxSeconds.Text = ts.Seconds.ToString();
     }
 }
예제 #2
0
 public void SetClock(TimeSpan ts)
 {
     //cross threading non-sense
     if (textBoxHours.InvokeRequired || textBoxMin.InvokeRequired || textBoxSeconds.InvokeRequired)
     {
         try
         {
             ClockCallBack d = new ClockCallBack(SetClock);
             this.Invoke(d, new object[] { ts });
         }
         catch (ObjectDisposedException ode) { }//saw this when app was closed without ending race first
         catch (Exception e) { MessageBox.Show(e.Message); }
     }
     else
     {
         textBoxHours.Text = ts.Hours.ToString();
         textBoxMin.Text = ts.Minutes.ToString();
         textBoxSeconds.Text = ts.Seconds.ToString();
     }
 }