private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { if (this.http != null) { this.http.is_active = false; Environment.Exit(0); this.http = null; this.thread = null; } }
private void OnClickStart(object sender, EventArgs e) { if (this.http == null) { this.count = 0; this.label2.Text = this.count.ToString(); int port = int.Parse(this.textBox1.Text); this.http = new QRCodeHttpServer(port); QRCodeHttpServer expr_4B = this.http; expr_4B.WriteString = (WriteStringData)Delegate.Combine(expr_4B.WriteString, new WriteStringData(this.WriteStringDataImp)); QRCodeHttpServer expr_72 = this.http; expr_72.qrcode_post_handle = (HandleRequestData)Delegate.Combine(expr_72.qrcode_post_handle, new HandleRequestData(this.HandleRequestDataImp)); this.textBox4.Text = string.Format("http://{0}:{1}/", this.GetLocalIpv4()[0], this.textBox1.Text); this.thread = new Thread(new ThreadStart(this.http.listen)); this.thread.Start(); this.button1.Enabled = false; return; } this.http.is_active = false; this.thread.Abort(); this.http = null; this.thread = null; this.button1.Text = "开始"; }