private void bunifuThinButton21_Click(object sender, EventArgs e) { streamingip = TxtHex.Text + ".ngrok.io"; port = int.Parse(TxtPort.Text); ip = "0.tcp.ngrok.io"; Stream = new MJPEGStream($"http://{streamingip}/?action=stream"); try { sendmessage("C"); sendmessage("Q"); Stream.NewFrame += Stream_NewFrame; streamexist = 1; Txt_ip.Clear(); if (Rb_normal.Checked == true) { Pb_up.Visible = true; Pb_left.Visible = true; Pb_right.Visible = true; Pb_down.Visible = true; Pb_center.Visible = true; } else { pb_updivieto.Visible = true; pb_downdivieto.Visible = true; pb_leftdivieto.Visible = true; pb_rightdivieto.Visible = true; pb_centerdivieto.Visible = true; label_divieto.Visible = true; } Btn_stream.Visible = true; Btn_go.Visible = true; Rb_normal.Visible = true; Rb_tracking.Visible = true; Rb_detection.Visible = true; Btn_screenshot.Visible = true; Btn_ip.Visible = false; Txt_ip.Visible = false; label3.Visible = false; Btn_go.Visible = false; Txt_search.Visible = false; Label_search.Visible = false; btn_visible.Visible = true; pictureBox1.Visible = true; listBoxHostnames.Visible = false; Btn_eliminacronologia.Visible = false; btVideo.Visible = true; btZoom.Visible = true; trackBar1.Visible = true; pictureBox2.Visible = true; Txt_ip.Clear(); label4.Visible = false; Txt_search.Clear(); label5.Visible = false; btngrok.Visible = false; TxtHex.Visible = false; TxtPort.Visible = false; label2.Visible = false; label6.Visible = false; Labelzoom.Visible = true; label7.Visible = false; } catch { Txt_ip.Clear(); MessageBox.Show("L'IP inserito non è corretto o il raspberry pi non risponde, riprova"); return; } }
private void Btn_ip_Click(object sender, EventArgs e) { port = 8081; if (!Regex.IsMatch(Txt_ip.Text, @"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b")) { Label_ip.Text = "indirizzo non valido"; Txt_ip.Clear(); return; } if (Label_ip.Text != "") { Label_ip.Text = ""; } streamingip = Txt_ip.Text.ToString(); ip = Txt_ip.Text.ToString();; Stream = new MJPEGStream($"http://{streamingip}:8080/?action=stream"); try { sendmessage("C"); sendmessage("Q"); Stream.NewFrame += Stream_NewFrame; streamexist = 1; Txt_ip.Clear(); if (Rb_normal.Checked == true) { Pb_up.Visible = true; Pb_left.Visible = true; Pb_right.Visible = true; Pb_down.Visible = true; Pb_center.Visible = true; } else { pb_updivieto.Visible = true; pb_downdivieto.Visible = true; pb_leftdivieto.Visible = true; pb_rightdivieto.Visible = true; pb_centerdivieto.Visible = true; label_divieto.Visible = true; } Btn_stream.Visible = true; Btn_go.Visible = true; Rb_normal.Visible = true; Rb_tracking.Visible = true; Rb_detection.Visible = true; Btn_screenshot.Visible = true; Btn_ip.Visible = false; Txt_ip.Visible = false; label3.Visible = false; Btn_go.Visible = false; Txt_search.Visible = false; Label_search.Visible = false; btn_visible.Visible = true; pictureBox1.Visible = true; listBoxHostnames.Visible = false; Btn_eliminacronologia.Visible = false; btVideo.Visible = true; btZoom.Visible = true; trackBar1.Visible = true; pictureBox2.Visible = true; Txt_ip.Clear(); label4.Visible = false; Txt_search.Clear(); label5.Visible = false; btngrok.Visible = false; TxtHex.Visible = false; TxtPort.Visible = false; label2.Visible = false; label6.Visible = false; label7.Visible = false; Labelzoom.Visible = true; } catch { Txt_ip.Clear(); MessageBox.Show("L'IP inserito non è corretto o il raspberry pi non risponde, riprova"); return; } }