예제 #1
0
 void IRealTimeStartStop.Stop()
 {
     if (ss != null)
     {
         ss.Stop();
     }
 }
예제 #2
0
 /// <summary>
 /// Enable runtime
 /// </summary>
 /// <param name="control">Control</param>
 /// <param name="enable">Enable</param>
 /// <param name="calculationReason">Calculation reason</param>
 /// <param name="list">List of updates</param>
 public static void EnableRuntime(this Control control, bool enable, string calculationReason = null,
                                  List <IRealtimeUpdate> list = null)
 {
     foreach (Control c in control.Controls)
     {
         c.EnableRuntime(enable, calculationReason, list);
     }
     if (control is IShowForm)
     {
         Control f = (control as IShowForm).Form as Control;
         if (f != null)
         {
             if (!f.IsDisposed)
             {
                 f.EnableRuntime(enable, calculationReason, list);
             }
         }
     }
     if (calculationReason != null)
     {
         if (control is ICalculationReason)
         {
             (control as ICalculationReason).CalculationReason = calculationReason;
         }
     }
     if (control is IRealTimeStartStop)
     {
         IRealTimeStartStop rt = control as IRealTimeStartStop;
         if (enable)
         {
             control.InvokeIfNeeded(() => rt.Start());
         }
         else
         {
             rt.Stop();
         }
     }
     if (list != null)
     {
         if (control is IRealtimeUpdate)
         {
             IRealtimeUpdate up = control as IRealtimeUpdate;
             if (!list.Contains(up))
             {
                 list.Add(up);
             }
         }
     }
 }