public ApplicationExitDispatcher() { var type = DynamicInvoker.GetType("System.Windows.Forms", "Application"); if (type != null) { DynamicInvoker.AddEventHandler <EventHandler>(type, "ApplicationExit", Application_ApplicationExit); } }
public UIThreadInvoker() { _mainThreadId = Thread.CurrentThread.ManagedThreadId; var type = DynamicInvoker.GetType("System.Windows.Forms", "Control"); var control = Activator.CreateInstance(type); DynamicInvoker.InvokeMethod(control, "CreateControl"); invokeMethod = new MethodInvoker(control, "Invoke", new Type[] { typeof(Delegate) }); beginInvokeMethod = new MethodInvoker(control, "BeginInvoke", new Type[] { typeof(Delegate) }); }
public AppCrash() { var applicationType = DynamicInvoker.GetType("System.Windows.Forms", "Application"); if (applicationType != null) { DynamicInvoker.AddEventHandler <ThreadExceptionEventHandler>(applicationType, "ThreadException", Application_ThreadException); } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; ProductName = DynamicInvoker.GetPropertyValue(applicationType, "ProductName") as string; DeveloperMail = "*****@*****.**"; CrashDir = "CrashLogs"; }
public static bool IsSupported() { var type = DynamicInvoker.GetType("System.Windows.Forms", "Control"); return(type != null); }