private void Stop() { try { Status = "Idle"; if (_captureHost != null) { _captureHost.SampleReceived -= OnSampleReceived; _captureHost.Dispose(); _captureHost = null; } Refresh(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), ex.Source); } }
private void Start() { if (!ModbusAdapters.IsItemSelected) return; var dialog = new SaveFileDialog() { Filter = CaptureConstants.CaptureFilter }; if (dialog.ShowDialog() != true) return; CaptureViewer = null; BytesReceived = 0; //Save the filename _capturePath = dialog.FileName; _captureHost = new CaptureHost(dialog.FileName, ModbusAdapters.GetFactory().Create()); _captureHost.SampleReceived += OnSampleReceived; Status = "Capturing..."; }