Пример #1
0
        private void SetSerialConnection()
        {
            serialPortConnection = new SerialPortConnection();
            serialPortConnection.OnFailedConnection += new EventHandler <EventArgs>(SerialConnectionFailed);
            serialPortConnection.OnConnectionOpened += new EventHandler <EventArgs>((object sender, EventArgs e) => {
                this.Text       = TITLE + " Serial Connection";
                sendColorData   = serialPortConnection.Write;
                closeConnection = serialPortConnection.Close;
            });

            serialPortConnection.OpenConnection(connectionOptions.SerialPort);
        }
Пример #2
0
        private void SetWebSocketConnection()
        {
            webSocketConnction = new WebSocketConnection();
            webSocketConnction.OnFailedConnection += new EventHandler <EventArgs>((object s, EventArgs ev) =>
            {
                this.Text = TITLE + "  - no connection available";
            });
            webSocketConnction.OnConnectionOpened += new EventHandler <EventArgs>((object s, EventArgs ev) =>
            {
                this.Text       = TITLE + " Websocket Connection";
                sendColorData   = webSocketConnction.Write;
                closeConnection = webSocketConnction.Close;
            });

            webSocketConnction.OpenConnection(connectionOptions.IP);
        }