예제 #1
0
 private void bDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Вы действительно хотите удалить соединение " + lbConnections.Items[lbConnections.SelectedIndex] + "?",
                         "Удаление соединения", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         JeromeConnectionParams c = connections[lbConnections.SelectedIndex];
         connections.Remove(c);
         lbConnections.Items.RemoveAt(lbConnections.SelectedIndex);
         if (connectionDeleted != null)
         {
             connectionDeleted(c, null);
         }
     }
 }
예제 #2
0
        private void bNew_Click(object sender, EventArgs e)
        {
            JeromeConnectionParams nc = new JeromeConnectionParams();

            if (nc.edit())
            {
                connections.Add(nc);
                fillList();
                lbConnections.SelectedIndex = connections.Count - 1;
                if (connectionCreated != null)
                {
                    connectionCreated(nc, null);
                }
            }
        }
예제 #3
0
        public static JeromeController create(JeromeConnectionParams p)
        {
            JeromeController jc = new JeromeController();

            jc.password                   = p.password;
            jc.connectionParams           = p;
            jc.connection.onConnected    += jc._onConnected;
            jc.connection.onDisconnected += jc._onDisconnected;
            jc.connection.lineReceived   += jc.processReply;
            jc.connection.reconnect       = true;
            if (p.usartPort != 0)
            {
                jc.usartConnection = new AsyncConnection();
            }
            return(jc);
        }
예제 #4
0
        public static JeromeController create(JeromeConnectionParams p)
        {
            IPAddress hostIP;

            if (IPAddress.TryParse(p.host, out hostIP))
            {
                JeromeController jc = new JeromeController();
                jc.remoteEP         = new IPEndPoint(hostIP, p.port);
                jc.password         = p.password;
                jc.connectionParams = p;
                return(jc);
            }
            else
            {
                return(null);
            }
        }
        public FConnectionParams(JeromeConnectionParams c)
        {
            InitializeComponent();

            tbName.Text      = c.name;
            tbHost.Text      = c.host;
            tbPort.Text      = c.port.ToString();
            tbPassword.Text  = c.password;
            tbHTTPPort.Text  = c.httpPort.ToString();
            tbUSARTport.Text = c.usartPort.ToString();

            _data.name      = c.name;
            _data.host      = c.host;
            _data.port      = c.port;
            _data.password  = c.password;
            _data.httpPort  = c.httpPort;
            _data.usartPort = c.usartPort;
        }