static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string configFilePath = null;

            foreach (var arg in args)
            {
                if (arg.ToLowerInvariant().StartsWith("/c:")) configFilePath = arg.Substring(3);

                if (arg.ToLowerInvariant() == "/t")
                {
                    if (AttachConsole(ATTACH_PARENT_PROCESS))  // Try to attach to existing console. Otherwise, create the trace window.
                    {
                        Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
                        Trace.WriteLine("");
                    }
                    else
                    {
                        traceForm = new TraceForm();
                        Trace.Listeners.Add(new TraceFormListener(traceForm));
                        traceForm.Show();
                    }
                }
            }

            var applicationContext = new CherryTomatoApplicationContext(configFilePath);
            Application.Run(applicationContext);
        }
示例#2
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string configFilePath = null;

            foreach (var arg in args)
            {
                if (arg.ToLowerInvariant().StartsWith("/c:"))
                {
                    configFilePath = arg.Substring(3);
                }

                if (arg.ToLowerInvariant() == "/t")
                {
                    if (AttachConsole(ATTACH_PARENT_PROCESS))  // Try to attach to existing console. Otherwise, create the trace window.
                    {
                        Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
                        Trace.WriteLine("");
                    }
                    else
                    {
                        traceForm = new TraceForm();
                        Trace.Listeners.Add(new TraceFormListener(traceForm));
                        traceForm.Show();
                    }
                }
            }

            var applicationContext = new CherryTomatoApplicationContext(configFilePath);

            Application.Run(applicationContext);
        }
 public TraceFormListener(TraceForm traceForm)
 {
     this.traceForm = traceForm;
 }
示例#4
0
 public TraceFormListener(TraceForm traceForm)
 {
     this.traceForm = traceForm;
 }