private void urlClick(object sender, EventArgs e) { m_mjpeg_stream.StopStream(); // Stops the Mjpeg Stream // Prompts the user for the Mjpeg URL and begins the stream process m_url = prompt.ShowDialog("Enter Stream URL", "Thin Dashboard"); try { m_mjpeg_stream.ParseStream(new System.Uri(m_url)); } catch { } }
private void Form1_KeyDown(object sender, KeyEventArgs e) { if (!IsPreviewMode && e.KeyCode != Keys.Space && e.KeyCode != Keys.Enter) { Application.Exit(); } if (e.KeyCode == Keys.Space) { if (isPinging == true) { return; } isPinging = true; _mjpeg.StopStream(); _mjpeg = null; Display(); } if (e.KeyCode == Keys.Return) { if (isPinging == true) { return; } isPinging = true; _mjpeg.StopStream(); _mjpeg = null; _mjpeg = new MjpegDecoder(); _mjpeg.ParseStream(new Uri("http://74.76.247.25:1024/img/video.mjpeg")); _mjpeg.FrameReady += mjpeg_FrameReady; isPinging = false; NowShowing.Text = "DOGS"; update = DateTime.Now; EEEMAGE = stream.Image; } }
private void StartCamera() { // Stop the current stream if it's running AsyncFormUpdate(new Action(() => { if (stream0 != null) { stream0.StopStream(); viewCam0.Image = viewCam0.ErrorImage; } // Delay 100ms, then screate a new stream URL and connect Thread.Sleep(100); stream0 = new MjpegDecoder(); stream0.FrameReady += FrameReady_cam0; _camera0URI = "http://" + _currentCameraHost + ":" + currentCameraView + "/?action=stream"; try { //stream0.ParseStream(new Uri(_camera0URI)); } catch (Exception) { lblStatus.Text = "Could not start camera"; } })); }
private void webcam_viw_1_stp_btn_Click(object sender, RoutedEventArgs e) { _WebcamView.webcam_viw_1_txt.Content = "Streaming stopped...!!!"; _WebcamView.webcam_viw_1_txt.Visibility = Visibility.Visible; webcam1Decoder.StopStream(); webcam_view_1.Visibility = Visibility.Hidden; RoverConsole.ArcEyeContent("Web Cam View 1 Streaming Has Stopped"); }
public void StopDecoder() { if (_mjpegDecoder != null) { _mjpegDecoder.StopStream(); } }
private async void MJPEGstopButton_Click(object sender, EventArgs e) { mjpeg.StopStream(); await Task.Delay(200); videoBox.Image = Properties.Resources.no_video; }
private void stop_button_Click(object sender, EventArgs e) { _mjpeg.StopStream(); stop_button.Enabled = false; start_button.Enabled = true; frame_picturebox.Visible = false; stream_ip_textbox.Enabled = true; }
void mjpeg2_Error(object sender, ErrorEventArgs e) { lock (cameraLock) { mjpegParser2.StopStream(); camera2Error = true; } }
private void disconnect() { if (connected) { mjpeg.StopStream(); tcpStream.Close(); tcpClient.Close(); btnConnect.Text = "Connect"; tbRobotAddr.Enabled = true; connected = false; } }
private void stopButton_Click(object sender, EventArgs e) { startButton.Enabled = true; stopButton.Enabled = false; // Clear picture box. pictureBox.Image = null; pictureBox.InitialImage = null; _mjpeg.StopStream(); _client.Stop(); }
private void Start_Click(object sender, RoutedEventArgs e) { if (started == false) { Start.Content = "Stop"; _mjpeg.ParseStream(new Uri("http://lgcam1:1716/?action=stream")); started = true; } else { started = false; _mjpeg.StopStream(); Start.Content = "Start"; } }
private void DataModelOnPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName != "VideoFeed") { return; } if (streaming) { mjpeg.StopStream(); } streaming = true; mjpeg.ParseStream(_dm.VideoFeed); }
/* Fill PictureBoxFrames > Video */ //Activate Cameras private void activate_cam_Click(object sender, EventArgs e) { if (activate_cam.Text == "Kamera Deaktif") { //Open Cams input_mjpeg.ParseStream(new Uri("http://192.168.1.108/cgi-bin/video.cgi"), "admin", "admin"); output_mjpeg.ParseStream(new Uri("http://192.168.1.108/cgi-bin/video.cgi"), "admin", "admin"); activate_cam.Text = "Kamera Aktif"; activate_cam.Style = MetroFramework.MetroColorStyle.Green; } else { //Close Cams input_mjpeg.StopStream(); input_cam.InitialImage.Dispose(); // Edit After output_mjpeg.StopStream(); activate_cam.Text = "Kamera Deaktif"; activate_cam.Style = MetroFramework.MetroColorStyle.Red; } }
public MainWindow() { InitializeComponent(); mjpeg = new MjpegDecoder(); mjpeg.FrameReady += FrameReady; timer = new Timer(); timer.AutoReset = true; timer.Interval = 1000; timer.Elapsed += (sender, e) => { Application.Current.Dispatcher.Invoke(() => { if (!lastText.Equals(source.Text)) { mjpeg.StopStream(); } lastText = source.Text; mjpeg.ParseStream(new Uri(source.Text)); }); }; timer.Start(); }
private void timer1_Tick(object sender, EventArgs e) // for every second of tickings { label7.Text = DateTime.Now.ToLongTimeString(); // display date time on status label8.Text = DateTime.Now.ToLongDateString(); if (reply.Status == IPStatus.Success) // get ping status { updateToolStripMenuItem.Visible = true; updateToolStripMenuItem.Enabled = true; // re-enable and make visible update XML button label10.Text = IpAdd + "\n And Round Trip Time of the packet is:" + reply.RoundtripTime.ToString(); // get packet travel time _mjpeg.ParseStream(new Uri("http://" + IpAdd + ":8080/?action=stream")); // show video-stream } else { updateToolStripMenuItem.Visible = false; updateToolStripMenuItem.Enabled = false; // re-disable and unmake visible update XML button label10.Text = "Not Connected." + Environment.NewLine + "Please Check: Menu -> IP Config"; // re-set status bar and display error msg _mjpeg.StopStream(); // stop video-stream this.pictureBox1.Image = Properties.Resources.error404; } if (lf.successFlag == true) { ((Control)this.FunctionsTabControl).Enabled = true; } }
void _mjpeg_Error(object sender, ErrorEventArgs e) { _mjpeg.StopStream(); Errored = true; }
// Second field is so that the stream connected from a popup is reused private void InitializeModule(Datum m, SshClient client = null) { // TODO: Replace debug writeline with proper error message if (socketMap.ContainsKey(m.ip)) { Debug.WriteLine("ERROR: Key already in dict"); return; } // Establish connection first string stream; try { if (client == null) { client = new SshClient(m.ip, username, password); client.ConnectionInfo.Timeout = TimeSpan.FromSeconds(5); client.Connect(); } stream = "http://" + m.ip + ":8080/?action=stream"; } catch (Exception z) { // TODO: Make this display somewhere failedConn.Add(m); return; } // WPF visual stuff SolidColorBrush darkGray = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF333333")); SolidColorBrush bordGray = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF000000")); SolidColorBrush foreGray = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFEEEEEE")); GroupBox newGroup = new GroupBox { BorderThickness = new Thickness(0.1), Foreground = Brushes.White, FontWeight = FontWeights.Bold }; StackPanel newStack = new StackPanel(); newGroup.Content = newStack; Border border = new Border { BorderBrush = bordGray, BorderThickness = new Thickness(0.1), CornerRadius = new CornerRadius(8), Margin = new Thickness(3), Background = darkGray }; // Grid nonsense Grid minigrid = new Grid(); ColumnDefinition c1 = new ColumnDefinition(); c1.Width = new GridLength(1, GridUnitType.Star); ColumnDefinition c2 = new ColumnDefinition(); c2.Width = GridLength.Auto; minigrid.ColumnDefinitions.Add(c1); minigrid.ColumnDefinitions.Add(c2); TextBlock roomNum = new TextBlock { FontSize = 14, Text = m.num, Margin = new Thickness(5), Background = darkGray, TextAlignment = TextAlignment.Center, Foreground = foreGray, FontWeight = FontWeights.Bold }; // Module options Menu menu = new Menu(); MenuItem options = new MenuItem { Header = " + ", FontSize = 14, Background = foreGray }; MenuItem move = new MenuItem { Header = "Move to" }; MenuItem delete = new MenuItem { Header = "Delete this module" }; MenuItem reposition = new MenuItem { Header = "Move module position" }; MenuItem editRoom = new MenuItem { Header = "Edit Room #" }; MenuItem editName = new MenuItem { Header = "Edit Name" }; menu.Items.Add(options); options.Items.Add(move); options.Items.Add(delete); options.Items.Add(reposition); options.Items.Add(editRoom); options.Items.Add(editName); minigrid.Children.Add(roomNum); minigrid.Children.Add(menu); roomNum.SetValue(Grid.ColumnProperty, 0); menu.SetValue(Grid.ColumnProperty, 1); Image imgtest = new Image { MaxWidth = 288, MinWidth = 288 }; TextBlock personName = new TextBlock { FontSize = 14, Text = m.name, Margin = new Thickness(1), Background = Brushes.Gray, TextAlignment = TextAlignment.Center }; TextBlock status = new TextBlock { FontSize = 14, Text = "Status: Normal", Margin = new Thickness(1), Background = Brushes.ForestGreen, TextAlignment = TextAlignment.Center }; Button testBtn = new Button { Content = "Reset", Background = Brushes.DarkGray, Foreground = Brushes.White, }; Button disableBtn = new Button { Content = "Disable Alarms", Background = Brushes.DarkGray, Foreground = Brushes.White, }; border.Child = minigrid; newStack.Children.Add(border); newStack.Children.Add(imgtest); newStack.Children.Add(personName); newStack.Children.Add(status); newStack.Children.Add(testBtn); newStack.Children.Add(disableBtn); // TODO: CHANGE THIS LATER WHEN DEALING WITH GROUPS // m.group blah blah groupMap[m.group].Children.Add(newGroup); //Default.Children.Add(newGroup); // Create new stream thread var mjpeg = new MjpegDecoder(); mjpeg.ParseStream(new Uri(stream)); // Repeated code is bad, but I couldnt figure out a way to store the lambda as a method or a variable // Essentially sets the image component to update every frame mjpeg.FrameReady += (o, ev) => { Dispatcher.BeginInvoke(new ThreadStart(delegate { imgtest.Source = ev.BitmapImage; })); }; MJPGMaps grp = new MJPGMaps { img = imgtest, ip = stream }; mjpegs.Add(mjpeg, grp); mjpeg.Error += _mjpg_Error; // Ensure there are no duplicate python script instances running (MIGHT BE UNNECESSARY/BAD) client.RunCommand("sudo killall python3"); // REPLACE SCRIPT.PY WITH NAME OF SCRIPT, MAKE SURE IT TAKES A COMMAND ARGUMENT // Runs in background var script = client.CreateCommand("python3 script.py " + myIPString); script.BeginExecute(); // Associate reset button with the following lambda function testBtn.Click += (o, ev) => { // Kill currently running stream if it exists mjpeg.StopStream(); client.RunCommand("sudo killall mjpg_streamer"); // Line below Directly start from mjpg_streamer; unnecessary for now //client.RunCommand("mjpg_streamer -i \"input_raspicam.so - x 1280 - y 720 - fps 30\" -o output_http.so"); // Start script in background var cmd = client.CreateCommand("bash startcam.sh"); cmd.BeginExecute(); mjpeg.ParseStream(new Uri(stream)); // Need to reset stream source as well mjpeg.FrameReady += (o, ev) => { Dispatcher.BeginInvoke(new ThreadStart(delegate { imgtest.Source = ev.BitmapImage; })); }; mjpeg.Error += _mjpg_Error; //client.RunCommand("sudo killall mjpg_streamer"); //client.RunCommand("./startcam.sh"); }; SocketStuff sck = new SocketStuff { txt = status, enabled = true }; Button message = new Button(); message.ToolTip = new ToolTip { Content = "Cannot remove this until alarms are enabled" }; message.Content = DateTime.UtcNow.ToString("MM-dd-yyyy"); message.Content += " " + DateTime.Now.ToString("t"); message.Content += (" ALARMS DISABLED AT: "); // BEHOLD CRINGE message.Content += roomNum.Text; message.Background = Brushes.Blue; // Disables alarm receiving and sends a message to pi disableBtn.Click += (o, ev) => { byte[] msg; lock (sck) { sck.enabled = !sck.enabled; if (sck.enabled) { sck.txt.Text = "Status: Normal"; sck.txt.Background = Brushes.ForestGreen; disableBtn.Content = "Disable Alarms"; try { msg = Encoding.ASCII.GetBytes("ENABLE<EOF>"); sck.testSck.Send(msg); } catch (Exception exp) { Debug.WriteLine("Socket doesn't exist yet..."); } // Add disabled message to log as a reminder if (messagelog.Children.Contains(message)) { messagelog.Children.Remove(message); } } else { sck.txt.Text = "ALARMS DISABLED"; sck.txt.Background = Brushes.Blue; disableBtn.Content = "Enable Alarms"; try { msg = Encoding.ASCII.GetBytes("DISABLE<EOF>"); sck.testSck.Send(msg); } catch (Exception exp) { Debug.WriteLine("Socket doesn't exist yet..."); } messagelog.Children.Add(message); } } }; // Now to add the target IP address to the map //Debug.WriteLine(popup.ipAddr); try { socketMap.Add(m.ip, sck); } catch (Exception e) { // this should never be a problem as the check happens fairly early Debug.WriteLine("Cant add same key twice"); } // Settings button implementation List <MenuItem> temp = new List <MenuItem>(); foreach (string grptmp in module.group) { MenuItem tmp = new MenuItem { Header = grptmp }; move.Items.Add(tmp); temp.Add(tmp); tmp.Click += (o, exv) => { WrapPanel oldwrp = groupMap[m.group]; WrapPanel newwrp = groupMap[grptmp]; oldwrp.Children.Remove(newGroup); newwrp.Children.Add(newGroup); m.group = grptmp; string testy = JsonConvert.SerializeObject(module, Newtonsoft.Json.Formatting.Indented); Debug.WriteLine(testy); File.WriteAllText("config.json", testy); }; } delete.Click += (o, v) => { groupMap[m.group].Children.Remove(newGroup); mjpegs.Remove(mjpeg); }; reposition.Click += (o, v) => { }; StackPanel editRoomPanel = new StackPanel { Orientation = Orientation.Horizontal }; TextBox editRoomText = new TextBox { Width = 100 }; Button editRoomBtn = new Button { Content = "Submit" }; editRoomPanel.Children.Add(editRoomText); editRoomPanel.Children.Add(editRoomBtn); editRoom.Items.Add(editRoomPanel); editRoomBtn.Click += (o, v) => { if (editRoomText.Text == "") { return; } roomNum.Text = editRoomText.Text; }; StackPanel editNamePanel = new StackPanel { Orientation = Orientation.Horizontal }; TextBox editNameText = new TextBox { Width = 100 }; Button editNameBtn = new Button { Content = "Submit" }; editNamePanel.Children.Add(editNameText); editNamePanel.Children.Add(editNameBtn); editName.Items.Add(editNamePanel); editNameBtn.Click += (o, v) => { if (editNameText.Text == "") { return; } personName.Text = editNameText.Text; }; }
private void BrowserLeftStopButton_Click(object sender, RoutedEventArgs e) { client.Dispose(); wbListBox.ItemsSource = null; mjpegLeft.StopStream(); }
private void web_cam_2_stop_btn_Click(object sender, RoutedEventArgs e) { webcam2Decoder.StopStream(); }
public void Stop() { _mjpeg.StopStream(); beacon.Detach(); }
private void UserControl_Unloaded(object sender, RoutedEventArgs e) { _mjpeg.StopStream(); }
public void Stop() { _decoder.FrameReady -= _decoder_FrameReady; _decoder.StopStream(); }
private void disButton_Click(object sender, EventArgs e) { mjpeg.StopStream(); outputBox.Visible = false; ipAddress = null; }
protected override void OnNavigatedFrom(NavigationEventArgs e) { base.OnNavigatedFrom(e); decoder.StopStream(); }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { using (Preferences p = new Preferences(Location, this)) { p.ShowDialog(); if (p.reset == true) { Location = Properties.Settings.Default.location; Size = Properties.Settings.Default.size; p.reload = true; } if (p.reload == true) { Setpos(); d1.StopStream(); d2.StopStream(); d3.StopStream(); d4.StopStream(); d5.StopStream(); d1 = null; d2 = null; d3 = null; d4 = null; d5 = null; Thread.Sleep(200); d1 = new MjpegDecoder(); d1.FrameReady += go1; try { d1.ParseStream(new Uri(Properties.Settings.Default.URILT)); } catch { } d2 = new MjpegDecoder(); d2.FrameReady += go2; try { d2.ParseStream(new Uri(Properties.Settings.Default.URIRT)); } catch { } d3 = new MjpegDecoder(); d3.FrameReady += go3; try { d3.ParseStream(new Uri(Properties.Settings.Default.URILM)); } catch { } d4 = new MjpegDecoder(); d4.FrameReady += go4; try { d4.ParseStream(new Uri(Properties.Settings.Default.URIRM)); } catch { } d5 = new MjpegDecoder(); d5.FrameReady += go5; try { d5.ParseStream(new Uri(Properties.Settings.Default.URIRB)); } catch { } RestartMQTT(); p.reload = false; } if (Properties.Settings.Default.Usecolor) { BackColor = Properties.Settings.Default.BGColor; mqttViewer1.BackColor = Properties.Settings.Default.BGColor; } else { BackColor = Color.FromArgb(184, 204, 232); mqttViewer1.BackColor = Color.FromArgb(184, 204, 232); } p.Close(); } }
/// <summary> /// Stops the camera stream /// </summary> private void StopCamera() { camera.StopStream(); IsStreaming = false; }
private void UserControl_Unloaded(object sender, RoutedEventArgs e) { _mjpeg.StopStream(); this.Log.Info("Stopping stream:" + streamURI); }
public void Stop() { _mjpegDecoder.StopStream(); _mjpegDecoder.FrameReady -= MjpegDecoderFrameReady; IsRunning = true; }