private static void Main(string[] args) { // redirect console output to parent process; // must be before any calls to Console.WriteLine() AttachConsole(AttachParentProcess); if (args.Length > 0) { try { var arguments = CommandLine.Parse<InputArguments>(); ISteps ladder = new Steps(); ladder.LogEnabled = arguments.EnableLog; ladder.TotalFlow(new FileInfo(arguments.TargetFile)); } catch (Exception e) { Console.WriteLine(e); Console.ReadKey(); } // sending the enter key is not really needed, but otherwise the user thinks the app is still running by looking at the commandline. The enter key takes care of displaying the prompt again. SendKeys.SendWait("{ENTER}"); Application.Exit(); } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } }
private void button1_Click(object sender, EventArgs e) { ISteps ladder = new Steps(); ladder.LogEnabled = checkBox1.Checked; ladder.TotalFlow(new FileInfo(textBox1.Text)); }