static void Main() { bool is45 = Type.GetType("System.Reflection.ReflectionContext", false) != null; if (!is45) { FrameworkMessage message = new FrameworkMessage(); message.ShowDialog(); return; } Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException); AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException; Application.ThreadException += NBug.Handler.ThreadException; TaskScheduler.UnobservedTaskException += NBug.Handler.UnobservedTaskException; ImportPlugins(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AttachConsole(ATTACH_PARENT_PROCESS); Main main = new Main(); if (!main.Disposing && !main.IsDisposed) { UpdateManager.Instance.UpdateFeedReader = new InstallerAwareAppcastReader(Application.ProductVersion); UpdateManager.Instance.UpdateSource = new NAppUpdate.Framework.Sources.SimpleWebSource( Common.CompanyWebsiteUrl + "/alloclave/updatefeed.xml"); UpdateManager.Instance.ReinstateIfRestarted(); Application.Run(main); } FreeConsole(); }
public Main() { Instance = this; InitializeComponent(); menuStrip1.Hide(); menuStrip1.Renderer = new MyRenderer(); ToolStripSystemTextBox licenseItem = new ToolStripSystemTextBox(); licenseItem.TextBox.BackColor = Color.FromArgb(64, 64, 64); licenseItem.TextBox.ForeColor = Color.FromArgb(200, 200, 200); licenseItem.TextBox.Text = Licensing.LicenseName + " "; licenseItem.TextBox.Font = new System.Drawing.Font("Arial", 8, FontStyle.Regular); licenseItem.TextBox.Cursor = System.Windows.Forms.Cursors.Arrow; licenseItem.TextBox.BorderStyle = BorderStyle.None; licenseItem.Width = 300; licenseItem.TextBox.ReadOnly = true; licenseItem.TextBox.TabStop = false; licenseItem.Alignment = ToolStripItemAlignment.Right; this.menuStrip1.Items.Add(licenseItem); Application.AddMessageFilter(this); var settings = new CommandLineParserSettings(); settings.CaseSensitive = false; settings.HelpWriter = Console.Error; ICommandLineParser parser = new CommandLineParser(settings); String[] args = Environment.GetCommandLineArgs(); if (parser.ParseArguments(args, options)) { if (options.TransportType != null) { foreach (ExportFactory<Transport, ITransportName> transportAdapter in Program.TransportAdapters) { String transportName = transportAdapter.Metadata.Name; if (transportName == options.TransportType) { SpawnTransport(transportAdapter); } } } } else { Close(); return; } //licenseToolStripMenuItem.Text = Licensing.LicenseName; FormClosing += Main_FormClosing; ReturnToStartScreen(); }