Ejemplo n.º 1
0
 private bool TryConnectTerminalClient(SerialParams sp)
 {
     m_terminalClient = new SerialClient(sp);
     m_terminalClient.DataReceivedEvent += MTerminalClientDataReceivedEvent;
     if (m_terminalClient.Connect())
     {
         SetTitle(m_terminalClient.Title);
         SetConnectState();
         return(true);
     }
     MessageBox.Show(String.Format("Connecting to {0} failed.", sp.PortName));
     return(false);
 }
Ejemplo n.º 2
0
        private void ConnectWithNkParams(string address, int port)
        {
            var np = new NkParams {
                Address = address, Port = port
            };

            m_terminalClient = new NetworkClient(np);
            m_terminalClient.DataReceivedEvent += new DataReceivedHandler(MTerminalClientDataReceivedEvent);
            if (m_terminalClient.Connect())
            {
                SetTitle(m_terminalClient.Title);
                SetConnectState();
            }
            else
            {
                MessageBox.Show(String.Format("Connection to {0}:{1} failed.", np.Address, np.Port));
                m_terminalClient = null;
            }
        }