private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { if (device.IsOpen) { device.Close(); } Close(); }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { if (device is object) { device.Close(); } } disposedValue = true; } }