public void InvokeOnMainLoop (InvokerHelper helper)
		{
			var potentialMethods = Application.GetMethods (System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
			var invokeOnMainThreadMethod = potentialMethods.First (m => m.Name == "InvokeOnMainThread" && m.GetParameters ().Length == 1);
			var invoker = Delegate.CreateDelegate (invokeOnMainThreadMethod.GetParameters () [0].ParameterType, helper, "Invoke");
			invokeOnMainThreadMethod.Invoke (SharedApplication, new [] { invoker });
		}
		public void InvokeOnMainLoop (InvokerHelper helper)
		{
			var application = Type.GetType ("Xwt.Application, Xwt");
			var invokeOnMainThreadMethod = application.GetMethod ("Invoke", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
			var invoker = Delegate.CreateDelegate (invokeOnMainThreadMethod.GetParameters () [0].ParameterType, helper, "Invoke");
			invokeOnMainThreadMethod.Invoke (null, new [] { invoker });
		}
Esempio n. 3
0
        public void InvokeOnMainLoop(InvokerHelper helper)
        {
            var potentialMethods         = Application.GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
            var invokeOnMainThreadMethod = potentialMethods.First(m => m.Name == "InvokeOnMainThread" && m.GetParameters().Length == 1);
            var invoker = Delegate.CreateDelegate(invokeOnMainThreadMethod.GetParameters() [0].ParameterType, helper, "Invoke");

            invokeOnMainThreadMethod.Invoke(SharedApplication, new [] { invoker });
        }
        public void InvokeOnMainLoop(InvokerHelper helper)
        {
            var application = Type.GetType("Xwt.Application, Xwt");
            var invokeOnMainThreadMethod = application.GetMethod("Invoke", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
            var invoker = Delegate.CreateDelegate(invokeOnMainThreadMethod.GetParameters() [0].ParameterType, helper, "Invoke");

            invokeOnMainThreadMethod.Invoke(null, new [] { invoker });
        }
Esempio n. 5
0
        static void Shutdown()
        {
            // Run the shutdown method on the main thread
            var helper = new InvokerHelper {
                Func = () => {
                    if (BeforeShutdown != null)
                    {
                        BeforeShutdown(null, EventArgs.Empty);
                    }
                    MainLoop.Shutdown();
                    return(null);
                }
            };

            MainLoop.InvokeOnMainLoop(helper);
        }
Esempio n. 6
0
        static void Shutdown()
        {
            // Run the shutdown method on the main thread
            var helper = new InvokerHelper {
                Func = () => {
                    try {
                        if (BeforeShutdown != null)
                        {
                            BeforeShutdown(null, EventArgs.Empty);
                        }
                    } catch (Exception ex) {
                        Console.WriteLine("Unexpected error during `BeforeShutdown`: {0}", ex);
                    } finally {
                        MainLoop.Shutdown();
                    }
                    return(null);
                }
            };

            MainLoop.InvokeOnMainLoop(helper);
        }
Esempio n. 7
0
 public void InvokeOnMainLoop(InvokerHelper helper)
 {
     NSApplication.SharedApplication.InvokeOnMainThread (helper.Invoke);
 }
Esempio n. 8
0
		static void Shutdown ()
		{
			// Run the shutdown method on the main thread
			var helper = new InvokerHelper {
				Func = () => {
					if (BeforeShutdown != null)
						BeforeShutdown (null, EventArgs.Empty);
					MainLoop.Shutdown ();
					return null;
				}
			};
			MainLoop.InvokeOnMainLoop (helper);
		}