예제 #1
0
파일: Program.cs 프로젝트: hex11/cmdhost
 static void Main()
 {
     #if !DEBUG
     //Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
     Application.ThreadException += (sender, e) =>
     {
         MessageBox.Show(
             String.Format("程序发生了一个未处理的异常。\r\n异常信息:{0}\r\n\r\n堆栈追踪:{1}",
                             e.Exception.Message, e.Exception.StackTrace),
             "程序将退出", MessageBoxButtons.OK, MessageBoxIcon.Error);
     };
     #endif
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     mainWindow = new FormSvr();
     Application.Run(mainWindow);
 }
예제 #2
0
파일: FormSvr.cs 프로젝트: hex11/cmdhost
        public FormSvr()
        {
            InitializeComponent();

            main = this;

            startToolStripMenuItem.Tag = false;

            this.FormClosed += (a1, a2) => Process.GetCurrentProcess().Kill();

            server.log += (str) => logLine(str);
            server.newClient += server_newClient;
            server.newProc += server_newProc;

            f5Title();

            showAfterCreateToolStripMenuItem.Checked = Settings.Default.ShowAfterCreate;
            closeAfterExitToolStripMenuItem.Checked = Settings.Default.CloseAfterExit;
            portToolStripTextBox_TextChanged(null, null);
        }