private void btOpen_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); if (openFileDialog.ShowDialog() != DialogResult.OK) { return; } try { _device.Stop(); } catch { } _filename = openFileDialog.FileName; _device = new SeekableFileSource(openFileDialog.FileName); _device.NewFrame += device_NewFrame; _device.Start(); trackBarControl1.Properties.Maximum = (int)_device.Length; TimerPos = new Timer(); TimerPos.Tick += timerPos_Tick; TimerPos.Enabled = true; TimerPos.Interval = 1000; StartDetection(); }
private void btPlay_Click(object sender, EventArgs e) { if (_device != null && !_device.IsRunning) { try { _device.Start(); StartDetection(); } catch { } } else { try { _device.Stop(); } catch { } try { if (_filename == "") { btOpen_Click(new object(), new EventArgs()); } else { _device = new SeekableFileSource(_filename); _device.NewFrame += device_NewFrame; _device.Start(); trackBarControl1.Properties.Maximum = (int)_device.Length; TimerPos = new Timer(); TimerPos.Tick += timerPos_Tick; TimerPos.Enabled = true; TimerPos.Interval = 1000; StartDetection(); } } catch { } } }