Пример #1
0
        internal static void RunGUIAction(ActionDelegate action)
        {
            if (EditorDispatcher.IsOnMainThread)
            {
                action();
                return;
            }

            lock (mLock)
            {
                ManualResetEvent syncEvent = new ManualResetEvent(false);

                EditorDispatcher.Dispatch(delegate {
                    try
                    {
                        action();
                    }
                    catch (Exception e)
                    {
                        mLog.ErrorFormat("GUI action failed: {0}", e.Message);
                        mLog.DebugFormat("Stack trace:{0}{1}", Environment.NewLine, e.StackTrace);
                        throw;
                    }
                    finally
                    {
                        syncEvent.Set();
                    }
                });

                syncEvent.WaitOne();
            }
        }
Пример #2
0
        void OnTimerTick()
        {
            if (mThreadOperation.IsRunning)
            {
                if (mTimerTickDelegate != null)
                {
                    EditorDispatcher.Dispatch(() => mTimerTickDelegate());
                }

                return;
            }

            mPlasticTimer.Stop();

            if (mbCancelled)
            {
                return;
            }

            EditorDispatcher.Dispatch(() => mAfterOperationDelegate());
        }