Example #1
0
        public async Task DisconnectDevice()
        {
            _connectedPortManager?.Stop();
            await Task.Delay(500); //To let things wrap up

            _receivedDataAction = null;
            _connectedPortManager?.Dispose();
            _connectedPortManager = null;
        }
Example #2
0
        public async void SetDeviceAsDisconnected()
        {
            _receivedDataAction = null;
            if (_connectedPortManager != null)
            {
                if (_connectedPortManager.IsRunning)
                {
                    _connectedPortManager.Stop();
                    await Task.Delay(500); //To let things wrap up
                }

                if (!_connectedPortManager.IsDisposed)
                {
                    _connectedPortManager.Dispose();
                }
                _connectedPortManager = null;
            }
        }
Example #3
0
 private void OnShutdownStarted(object sender, EventArgs e)
 {
     SettingsManager.Save();
     PortManager.Dispose();
     _usbNotification.Dispose();
 }