public MainForm() { if (formInstance != null) { throw new InvalidOperationException("An instance of MainForm already exists."); } ProcessHelper.LogLoadedAssemblies(); InitializeComponent(); if (!base.DesignMode) { UIHelper.ApplyResources(uiCommandManager1); Notifier = new MainNotifier(notifyIcon1); if (ApplicationSettingsManager.Settings.StartMinimized) { base.Opacity = 0.0; } MonitorSettings.Instance.LoadCaches(); SetLogGroupByBoxImage(); formInstance = this; } }
private static void Main(string[] args) { try { if (IsProcessRunning()) { RemotingClient.Show(); } else { SVNMonitor.Helpers.ThreadHelper.SetThreadName("MAIN"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SessionInfo.SetSessionInfo(args); InitLog(); bool firstRun = InitApplicationSettings(); SVNMonitor.Helpers.ThreadHelper.SetMainThreadUICulture(ApplicationSettingsManager.Settings.UILanguage); RemotingServer.Start(); AppendStartMessages(); AppDomain.CurrentDomain.UnhandledException += Program.CurrentDomain_UnhandledException; AppDomain.CurrentDomain.AssemblyLoad += Program.CurrentDomain_AssemblyLoad; Application.ThreadException += Program.Application_ThreadException; try { MainForm form = new MainForm { ShowFirstRunNotification = firstRun }; Application.Run(form); } catch (Exception ex) { Logger.Log.Error("Fatal Error", ex); } finally { End(); } } } catch (Exception ex) { HandleException(ex, "Main"); MessageBox.Show(ex.ToString()); } }