/// <summary> /// Constructor MainApp. /// </summary> public MainApp() { mainApp = this; InitializeComponent(); // Load the user list tcUserAdmin1.Load(); // Create the application header CreateHeader(); // set the logo to the header AppHeader.CompanyImageFile = Application.StartupPath + "\\Customer\\Logo.bmp"; // Language Manager try { tclm = new CTCLManager(this, false); // Delegate instance: Error handling for errors from the TCLM tclm.Error += new CTCLManager.TCLMErrorEventHandler(tclm_Error); } catch (Exception ex) { string tmp = "Error during opening language manager database!"; log.Fatal(tmp, ex); Beckhoff.App.ExceptionDialog exc = new Beckhoff.App.ExceptionDialog(); exc.SetText(Application.ProductName + " has encountered a problem.\r\n" + "For further information take a look to the application event log.", ex); exc.ShowDialog(); exc.Dispose(); exc = null; } // status bar pnlStatus = new StatusBarPanel(); try { pnlStatus.Icon = new Icon(Application.StartupPath + "\\Bitmap\\active.ico"); } catch { log.Error("File could not be opended! \\Bitmap\\active.ico"); } pnlStatus.AutoSize = StatusBarPanelAutoSize.Contents; pnlConnection = new StatusBarPanel(); pnlConnection.AutoSize = StatusBarPanelAutoSize.Spring; statusBarMain.Panels.Add(pnlStatus); statusBarMain.Panels.Add(pnlConnection); statusBarMain.Visible = appSettings.applicationViewStatusBar; // Connect all components to the Language Manager tcUserAdmin1.LanguageManager = tclm; tcUserAdmin1.CurrentUserChanged += new Beckhoff.App.Security.TcUserAdmin.CurrentUserChangedEventHandler(tcUserAdmin1_CurrentUserChanged); tcUserAdmin1.UserLogOffEvent = new Beckhoff.App.Security.TcUserAdmin.UserLogOnEventHandler(tcUserAdmin1_UserLogOffEvent); SetFormStyle(this); SetColorTheme(); }
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { if (!exceptionSignaled) { exceptionSignaled = true; MainApp.log.Fatal(sender, e.Exception); Beckhoff.App.ExceptionDialog exc = new Beckhoff.App.ExceptionDialog(); exc.SetText(Application.ProductName + " has encountered a problem.\r\n" + "For further information take a look to the application event log!", e.Exception); exc.ShowDialog(); exceptionSignaled = !exc.ExceptionSignaledChecked; exc.Dispose(); exc = null; } }