示例#1
0
        public void RunMainLoopInCurrentThread()
        {
            lock (internalLock)
            {
                if (UiThreadId != -1)
                {
                    throw new ArgumentException(string.Format("UI thread is already running: {0}", UiThreadId));
                }
                UiThreadId = Thread.CurrentThread.ManagedThreadId;
            }

            Application.UnhandledException += (sender, arg) => CrashHandler.HandleCrash(arg.ErrorException);
#if !PLATFORM_WINDOWS && !GUI_DISABLED
            GLib.ExceptionManager.UnhandledException += arg => CrashHandler.HandleCrash((Exception)arg.ExceptionObject);
#endif
            Application.Run();

#if !PLATFORM_WINDOWS && !GUI_DISABLED
            GtkTextLayoutBackendHandler.DisposeResources();
#endif
            lock (internalLock)
            {
                UiThreadId = -1;
            }
        }
示例#2
0
        public static void RunXwtInCurrentThread()
        {
            lock (internalLock)
            {
                if (UiThreadId != -1)
                {
                    throw new ArgumentException(string.Format("UI thread is already running: {0}", UiThreadId));
                }
                UiThreadId = Thread.CurrentThread.ManagedThreadId;
            }

            Application.UnhandledException           += LocalCrashHandler;
            GLib.ExceptionManager.UnhandledException += arg => CrashHandler.HandleCrash((Exception)arg.ExceptionObject);
            Application.Run();
            GtkTextLayoutBackendHandler.DisposeResources();

            lock (internalLock)
            {
                UiThreadId = -1;
            }
        }