示例#1
0
        public void Disconnect()
        {
            LogMessage("Disconnecting");
            ThrowWhenNotConnected();

            try
            {
                TxtCommunication.CloseConnection();
                Connection = ConnectionStatus.NotConnected;
            }
            catch (Exception e)
            {
                LogMessage($"Exception while disconnecting: {e.Message}");
                Connection = ConnectionStatus.Invalid;
                HandleException(e);
            }

            _disconnected?.Invoke(this, new EventArgs());

            TxtCommunication.Dispose();
            TxtCommunication = null;

            TxtCamera.Dispose();
            TxtCamera = null;

            LogMessage("Disconnected");
            _masterInterface.ResetValues();
        }
示例#2
0
        public void Dispose()
        {
            Connection = ConnectionStatus.NotConnected;

            if (TxtCommunication != null)
            {
                TxtCommunication.Dispose();
                TxtCommunication = null;
            }

            if (TxtCamera != null)
            {
                TxtCamera.Dispose();
                TxtCamera = null;
            }

            _masterInterface.ResetValues();
        }