private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { this.device.Dispose(); }