private void button1_Click(object sender, EventArgs e) { UInt16 port; int porti; string pstr; if ((textBox1.Text == null) || (textBox3.Text == null)) { MessageBox.Show("请输入IP!"); } if (textBox2.Text == null) { MessageBox.Show("请输入端口号!"); } pstr = textBox2.Text; porti = (pstr[0] - '0') * 10000 + (pstr[1] - '0') * 1000 + (pstr[2] - '0') * 100 + (pstr[3] - '0') * 10 + (pstr[4] - '0'); port = (UInt16)porti; //HNC_Connect.start_connect(textBox1.Text, port); if (!HNC_Connect.start_connect(textBox1.Text, textBox3.Text, port)) { MessageBox.Show("连接失败,请重试"); return; } connect_event = true; this.Visible = false; HNC_Connect.start_transfer = true; Setting_save.savefile("save.dat"); //HNC_Connect.thread_connect(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Setting_save.openfile("save.dat"); //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Image_save.thread_video(); Control.CheckForIllegalCrossThreadCalls = false; Application.Run(new NCVM_Form()); }