static void Main(string[] args) { var options = new Options(); var parser = new CommandLine.Parser(with => with.HelpWriter = System.Console.Error); if (parser.ParseArguments(args, options)) { if (options.Debug) { utils.Logger.Instance.BasicConfig(); } else { utils.Logger.Instance.XmlConfig(); } utils.Logger.Instance.Log.Info("Program Start"); utils.Logger.Instance.Log.Info("Arg RequestUri: " + options.RequestUri); Run(options); } }
static void Run(Options options) { Application.ThreadException += Application_ThreadException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { var mainForm = (options.RequestUri != null) ? new UI.FormMain(options.RequestUri) : new UI.FormMain(); //mainForm.OnException += mainForm_OnException; Application.Run(mainForm); mainForm.CleanUp(); } catch (Exception ex) //handle exception on startup { System.Console.WriteLine(ex.ToString()); } }