public static BatchStartOptions From(string[] args) { var options = new BatchStartOptions(); options.Parse(args); return(options); }
static int Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { BatchStarter.Start(); var mainPresenter = IoC.Resolve <IBatchMainPresenter>(); var options = BatchStartOptions.From(args); mainPresenter.Initialize(options); var applicationContext = createContextFrom(mainPresenter, options); Application.Run(applicationContext); return((int)ExitCodes.Success); } catch (Exception e) { e.LogError(); return((int)ExitCodes.Error); } }
private static ApplicationContext createContextFrom(IBatchMainPresenter mainPresenter, BatchStartOptions options) { if (options.IsValid()) { return(new ApplicationContext()); } return(new ApplicationContext(mainPresenter.BaseView.DowncastTo <Form>())); }