private void remoteServerHelper1_OnOffLined(string msg) { textBox1.InvokeAction(() => { textBox1.Enabled = checkBox1.Enabled = comboBox1.Enabled = skinTrackBar1.Enabled = button1.Enabled = true; skinProgressBar1.Visible = false; SizedForm(false); PingHelper.Stop(); label3.Text = ""; }); }
/// <summary> /// 点击按钮请求连接 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { textBox1.Enabled = checkBox1.Enabled = comboBox1.Enabled = skinTrackBar1.Enabled = button1.Enabled = false; skinProgressBar1.Visible = true; try { requestRemoteHelper1.StartSendCapture(textBox1.Text, _isHelp, _qualityLevel, _fps); label1.Text = textBox1.Text + "对方已响应了你的远程协助请求"; skinProgressBar1.Visible = false; PingHelper.Start(this._serverIP, 3000, Encoding.Default.GetBytes("Ping Data"), () => { this.InvokeAction( () => { label3.Text = " 网络连接状态:" + PingHelper.IPStatus + " 延时:" + PingHelper.RoundtripTime + "ms" + " 网络异常数:" + PingHelper.ErrorCount + "次"; }); }); PingHelper.ErrorAlert( () => { this.InvokeAction( () => { label3.Text = " 网络连接状态:" + PingHelper.IPStatus + " 延时:" + PingHelper.RoundtripTime + "ms" + " 网络异常数:" + PingHelper.ErrorCount + "次" + " 当前网络不稳定,请保持网络通畅!"; }); }); } catch (Exception ex) { MessageBox.Show(ex.Message); label1.Text = "正在等待远程协助"; textBox1.Enabled = checkBox1.Enabled = comboBox1.Enabled = skinTrackBar1.Enabled = button1.Enabled = true; skinProgressBar1.Visible = false; PingHelper.Stop(); label3.Text = ""; } }