public static bool HostIMS(IMainWindow mainWindow) { try { InstanceManagementService svc = new InstanceManagementService(mainWindow); Uri uri = new Uri("net.pipe://localhost/JinxBot-" + Process.GetCurrentProcess().Id.ToString()); ServiceHost host = new ServiceHost(svc, uri); host.AddServiceEndpoint(typeof(IJinxBotSingleInstanceService), new NetNamedPipeBinding(), uri); host.Open(TimeSpan.MaxValue); return(true); } catch (Exception ex) { #if DEBUG GlobalErrorHandler.ReportException(ex); #endif return(false); } }
static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { GlobalErrorHandler.ReportException(e.Exception); }