private Error(String ErrorSubHeading, String ErrorDetail, Exception ex) { if (!Init()) { return; } if (showing) { return; } showing = true; Init(); // this.Name = ErrorHeading; this.ErrorHeading.Text = ex.GetType().FullName; this.ErrorSubHeading.Text = ex.Message; this.StackTrace = UnhandledExceptionManager.EnhancedStackTrace(ex); this.ErrorSubHeading.Text = ErrorSubHeading; this.ErrorDetail.Text = ErrorSubHeading + "\r\n\r\n" + ErrorDetail; // Report(ErrorSubHeading, ErrorDetail); Show(); }
static void Main() { UnhandledExceptionManager.AddHandler(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); }
public bool Init() { if (showing) { this.InError = true; return(false); } showing = true; UnhandledExceptionManager.ExceptionToScreenshot(); if (!String.IsNullOrEmpty(UnhandledExceptionManager._strScreenshotFullPath)) { ScreenshotFullPath = UnhandledExceptionManager._strScreenshotFullPath; } InitializeComponent(); Random r = new Random(); authorTextBox.Text = App.Prefs.GetPreference("User.ExceptionAuthorName", "anonymous" + r.Next()); App.Prefs.SetPreference("User.ExceptionAuthorName", authorTextBox.Text); int sw = Screen.PrimaryScreen.Bounds.Width; int sh = Screen.PrimaryScreen.Bounds.Height; int ww = this.Bounds.Width; int wh = this.Bounds.Height; this.Location = new Point((sw >> 1) - (ww >> 1), (sh >> 1) - (ww >> 1)); Color bg = System.Drawing.SystemColors.Control; return(true); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { UnhandledExceptionManager.AddHandler(); ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new YAMS_Service() }; ServiceBase.Run(ServicesToRun); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { UnhandledExceptionManager.AddHandler(); ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new LabelXClientServ() }; ServiceBase.Run(ServicesToRun); }
public void Execute() { try { if (_onExecute != null) _onExecute(); } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
public static void InstallHandler() { UnhandledExceptionManager.ParentAssembly(); AppDomain currentDomain = AppDomain.CurrentDomain; Assembly execAssembly = Assembly.GetExecutingAssembly(); // VhdDirectorApp Assembly callAssembly = Assembly.GetCallingAssembly(); // VhdDirectorApp Assembly entryAssembly = Assembly.GetEntryAssembly(); // Main //-- for winforms applications // Application.ThreadException -= ThreadExceptionHandler; // Application.ThreadException += ThreadExceptionHandler; Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(ThreadExceptionHandler); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); }
// -- // -- converts exception to a formatted "more" string // -- private static string ExceptionToMore(System.Exception objException) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); // With... //if (_blnEmailError) { // sb.Append( // "Information about this problem was automatically mailed to ") // .Append(AppSettings().GetString("UnhandledExceptionManager/EmailTo")) // .Append((Environment.NewLine + Environment.NewLine)); //} sb.Append(("Detailed technical information follows: " + Environment.NewLine)).Append(("---" + Environment.NewLine)); string x = UnhandledExceptionManager.ExceptionToString(objException); sb.Append(x); return(sb.ToString()); }
public void Execute(IAppDocReturn aDocReturn, string AStatusName, int aOldValue, int AValue) { try { if (_onExecute != null) { _onExecute(aDocReturn, AStatusName, aOldValue, AValue); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
public void Execute(string aClientFileHeaderKey) { try { if (_onExecute != null) { _onExecute(aClientFileHeaderKey); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
public void Execute(IAppDocReturn aDocReturn) { try { if (_onExecute != null) { _onExecute(aDocReturn); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
public void Execute(string aLevel, string aSection, string aKey, string AValue) { try { if (_onExecute != null) { _onExecute(aLevel, aSection, aKey, AValue); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
public void Execute(IAppDocReturn aDocReturn, int ADiagGroup, string ADiagName) { try { if (_onExecute != null) { _onExecute(aDocReturn, ADiagGroup, ADiagName); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
static void Main() { // The next line, will take action whenever an unhandled exceptions is thrown which // will kill the application. The hander will generate a messagebox and other // output (file or e-mail or eventlog as set in the config file) UnhandledExceptionManager.AddHandler(); //throw new ApplicationException("Test"); string lang = ACA.LabelX.GlobalDataStore.GetAppSetting("LanguageId"); ACA.LabelX.GlobalDataStore.LanguageId = int.Parse(lang); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new PrintCommanderMainForm()); }
public void Execute(IAppGroupArray aGroup) { try { if (_onExecute != null) { _onExecute(aGroup); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
public void Execute(IAppClientFile AOldClientFile, IAppClientFile ANewClientFile) { try { if (_onExecute != null) { _onExecute(AOldClientFile, ANewClientFile); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
public void Execute(string aFileName) { try { if (_onExecute != null) { _onExecute(aFileName); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
public void Execute(IAppTaxDocument OldDocument, IAppTaxDocument NewDocument) { try { if (_onExecute != null) { _onExecute(OldDocument, NewDocument); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
public void Execute(IAppTaxCell aCell) { try { if (_onExecute != null) { _onExecute(aCell); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
public bool Execute(IAppDocReturn aDocReturn, int AGroupNo, string ADiagName) { try { if (_onExecute != null) { return(_onExecute(aDocReturn, AGroupNo, ADiagName)); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } return(false); }
public bool Execute(IAppClientFile aClientFile) { try { if (_onExecute != null) { return(_onExecute(aClientFile)); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } return(true); }
public void Execute(string aFileName, out bool aAccept) { try { if (_onExecute != null) { _onExecute(aFileName, out aAccept); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } aAccept = true; }
public void Execute(out bool aProcessed) { aProcessed = true; try { if (_onExecute != null) { _onExecute(out aProcessed); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
public dynamic GetData(IAppCellSelectionIter aSelection) { try { if (_onExecute != null) { return(_onExecute(aSelection)); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } return(null); }
public void Execute(out string AParameterName, out string AData) { AParameterName = ""; AData = ""; try { if (_onExecute != null) { _onExecute(out AParameterName, out AData); } } catch (Exception e) { if (!UnhandledExceptionManager.HandleException(this, e)) { throw; } } }
private void SetDetail() { data.Add("Name", this.Name); data.Add("ErrorHeading", this.ErrorHeading.Text); data.Add("ErrorSubHeading", this.ErrorSubHeading.Text); data.Add("EnhancedStackTrace", UnhandledExceptionManager.EnhancedStackTrace(Ex)); this.StackTrace = UnhandledExceptionManager.SysInfoToString(true); string ErrorDetail = ""; ErrorDetail += "Error: " + this.Name + Environment.NewLine + "ErrorHeading: " + this.ErrorHeading.Text + Environment.NewLine + "ErrorSubHeading: " + this.ErrorSubHeading.Text + Environment.NewLine + "TargetSite: " + this.Ex.TargetSite.ToString() + Environment.NewLine + GetVersions() + Environment.NewLine + this.StackTrace + Environment.NewLine; this.ErrorDetail.Text = ErrorDetail; }
static void Main(string[] args) { args = new string[] { "ok" }; args = new string[] { "ok" }; if (args[0] == "ok") { try { UnhandledExceptionManager.AddHandler(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); RegistryKey reg; Registry.CurrentUser.DeleteSubKeyTree("Software\\BlueSheep", false); reg = Registry.CurrentUser.CreateSubKey("Software\\BlueSheep"); reg = Registry.CurrentUser.OpenSubKey("Software\\BlueSheep", true); if (reg.ValueCount > 1) { reg.DeleteValue("Version"); reg.DeleteValue("Minor"); System.Threading.Thread.Sleep(1000); } reg.SetValue("Version", 0.9); reg.SetValue("Minor", "8,1"); Application.Run(new MainForm("0.9.7.1")); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } } else { System.Windows.Forms.MessageBox.Show("Veuillez lancer BlueSheep via l'updater !"); Environment.Exit(0); } /* Changelog : * Flood : Modos * Déplacements : Fix * Trajets : Implantation d'un watchdog * Trajets : Fix des variables %PODS% * */ }
static void Main(string[] args) { UnhandledExceptionManager.AddHandler(); System.Threading.Thread.CurrentThread.Name = "MT"; GlobalDataStore.RunningWithConsole = true; GlobalDataStore.Logger.Info("ACALabelXTestServer has started..."); GlobalDataStore.Logger.AutoFlush = false; Thread thrdBackup = new Thread(new ThreadStart(ACA.LabelX.Managers.LabelXServerBackupManager.DoThreadWork)); thrdBackup.Name = "BK"; thrdBackup.Start(); Thread thrd1 = new Thread(new ThreadStart(ACA.LabelX.Managers.LabelXServerManager.DoThreadWork)); thrd1.Name = "SV"; thrd1.Start(); Console.WriteLine("Press <enter> to stop this application anytime..."); Console.ReadLine(); ACA.LabelX.Managers.LabelXServerManager.Stop(); if (thrdBackup.IsAlive) { if (!thrdBackup.Join(5000)) { thrdBackup.Abort(); Console.WriteLine("BK aborted"); } else { Console.WriteLine("BK Stopped"); } } if (thrd1.IsAlive) { thrd1.Join(60000); Console.WriteLine("SV stopped"); } }
static void Main(string[] args) { UnhandledExceptionManager.AddHandler(); System.Threading.Thread.CurrentThread.Name = "MT"; GlobalDataStore.RunningWithConsole = true; GlobalDataStore.Logger.Warning("Starting ACA LabelX Test Client..."); GlobalDataStore.Logger.AutoFlush = true; //Testing structure on XP/Visa 32 and 64!!! //bool bRet = ACA.LabelX.Toolbox.Win32ApiFunctions.DeleteFilesToRecycleBin(@"c:\temp\test.xml"); Thread thrdBackup = new Thread(new ThreadStart(ACA.LabelX.Managers.LabelXClientBackupManager.DoThreadWork)); thrdBackup.Name = "BK"; thrdBackup.Start(); Thread thrd1 = new Thread(new ThreadStart(ACA.LabelX.Managers.LabelXClientServerManager.DoThreadWork)); thrd1.Name = "ST"; thrd1.Start(); Thread thrd2 = new Thread(new ThreadStart(ACA.LabelX.Managers.LabelXRemoteControlManager.DoThreadWork)); thrd2.Name = "RT"; thrd2.Start(); Thread thrd3 = new Thread(new ThreadStart(ACA.LabelX.Managers.LabelXPrintgroupsManager.DoThreadWork)); thrd3.Name = "PT"; thrd3.Start(); Console.ReadLine(); ACA.LabelX.Managers.LabelXClientBackupManager.Stop(); ACA.LabelX.Managers.LabelXClientServerManager.Stop(); ACA.LabelX.Managers.LabelXRemoteControlManager.Stop(); ACA.LabelX.Managers.LabelXPrintgroupsManager.Stop(); Console.WriteLine("Stopping threads and waiting on completion."); if (thrdBackup.IsAlive) { if (!thrdBackup.Join(5000)) { thrdBackup.Abort(); Console.WriteLine("BK aborted"); } else { Console.WriteLine("BK Stopped"); } } if (thrd1.IsAlive) { if (!thrd1.Join(5000)) { thrd1.Abort(); Console.WriteLine("ST aborted"); } else { Console.WriteLine("ST Stopped"); } } if (thrd2.IsAlive) { if (!thrd2.Join(5000)) { thrd2.Abort(); Console.WriteLine("RT Aborted"); } else { Console.WriteLine("RT Stopped"); } } if (thrd3.IsAlive) { if (!thrd3.Join(5000)) { thrd3.Abort(); Console.WriteLine("PT aborted."); } else { Console.WriteLine("PT Stopped"); } } if (thrd1.IsAlive | thrd2.IsAlive | thrd3.IsAlive) { Environment.Exit(1); } }
static void Main(string[] args) { UnhandledExceptionManager.AddHandler(); //We need Admin for almost everything in here // Needs UAC elevation for webmin to run WindowsPrincipal principal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); bool hasAdministrativeRight = principal.IsInRole(WindowsBuiltInRole.Administrator); if (!hasAdministrativeRight) { ProcessStartInfo processInfo = new ProcessStartInfo(); processInfo.Verb = "runas"; processInfo.FileName = Application.ExecutablePath; if (args.Length > 0) { processInfo.Arguments = args.ToString(); } try { Process.Start(processInfo); } catch { Environment.Exit(0); } Environment.Exit(0); } //svcYAMS = new ServiceController("YAMS_Service"); Console.WriteLine("*** YAMS Updater ***"); YAMS.Database.init(); YAMS.Database.AddLog("YAMS-Updater run on local machine"); if (args.Contains <string>("/restart")) { //We're just here to restart the service safely after some updates Console.WriteLine("Restarting service..."); StopService(); StartService(); Environment.Exit(0); } else if (args.Contains <string>("/start")) { StartService(); Environment.Exit(0); } else if (args.Contains <string>("/stop")) { StopService(); Environment.Exit(0); } else { try { IntPtr conWnd = GetConsoleWindow(); if (conWnd != IntPtr.Zero) { ShowWindow(conWnd, 0); } } catch { } System.Windows.Forms.Application.EnableVisualStyles(); //Have they run the app before? if (YAMS.Database.GetSetting("FirstRun", "YAMS") != "true") { Application.Run(new frmDependencies()); Application.Run(new frmFirstRun()); } else { Application.Run(new frmMain()); } return; } }