Пример #1
0
 public void DispatchPendingEvents()
 {
     try {
         toolkit.ExitUserCode(null);
         toolkit.Backend.DispatchPendingEvents();
     } finally {
         toolkit.EnterUserCode();
     }
 }
Пример #2
0
 public static void DispatchPendingEvents()
 {
     try {
         Toolkit.ExitUserCode(null);
         engine.DispatchPendingEvents();
     } finally {
         Toolkit.EnterUserCode();
     }
 }
Пример #3
0
 /// <summary>
 /// Invokes an action in the GUI thread
 /// </summary>
 /// <param name='action'>
 /// The action to execute.
 /// </param>
 public static void Invoke(Action action)
 {
     engine.Invoke(delegate {
         try {
             Toolkit.EnterUserCode();
             action();
             Toolkit.ExitUserCode(null);
         } catch (Exception ex) {
             Toolkit.ExitUserCode(ex);
         }
     });
 }
Пример #4
0
        /// <summary>
        /// Invokes an action in the GUI thread after the provided time span
        /// </summary>
        /// <returns>
        /// A timer object
        /// </returns>
        /// <param name='action'>
        /// The action to execute.
        /// </param>
        /// <remarks>
        /// This method schedules the execution of the provided function. The function
        /// must return 'true' if it has to be executed again after the time span, or 'false'
        /// if the timer can be discarded.
        /// The execution of the funciton can be canceled by disposing the returned object.
        /// </remarks>
        public static IDisposable TimeoutInvoke(TimeSpan timeSpan, Func <bool> action)
        {
            Timer t = new Timer();

            t.Id = engine.TimeoutInvoke(delegate {
                bool res = false;
                try {
                    Toolkit.EnterUserCode();
                    res = action();
                    Toolkit.ExitUserCode(null);
                } catch (Exception ex) {
                    Toolkit.ExitUserCode(ex);
                }
                return(res);
            }, timeSpan);
            return(t);
        }
Пример #5
0
 public static void InitializeAsGuest(ToolkitType type)
 {
     Initialize(type);
     toolkit.ExitUserCode(null);
 }