Exemplo n.º 1
0
        public IActionResult AddClient(Client newClient)
        {
            RPClient rpC = new RPClient();

            rpC.AddNewClient(newClient);
            return(CreatedAtAction(nameof(AddClient), newClient));
        }
Exemplo n.º 2
0
        public RPTester()
        {
            var serverEndpoint = new IPEndPoint(IPAddress.Loopback, 12000);
            var serverID       = PrivateIdentity.Create();

            server    = new RPServer(serverID, serverEndpoint, this);
            listening = server.ListenForClients();

            var clientID = PrivateIdentity.Create();

            client = RPClient.CreateAndConnect(serverID.ID, serverEndpoint, clientID).Result;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles clicking the CONNECT menu item located in the NETWORK menu.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Connect_ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.client = new RPClient();

            using (ConnectDialog connDialog = new ConnectDialog())
            {
                if (connDialog.ShowDialog() == DialogResult.OK)
                {
                    ipAddress = connDialog.IpAddress;

                    client.ReceiveMessage += new ReceiveMessageEventHandler(RPClientLib_ReceiveMessage);

                    if (!client.Connect(ipAddress, port))
                    {
                        tb_log.AppendText("Could not connect.\n");
                        client = null;
                    }
                    else
                    {
                        client.ListenForMessages();
                        tb_log.AppendText("Connection successful.\n");
                        connected = true;

                        disconnectToolStripMenuItem.Enabled = true;
                        connectToolStripMenuItem.Enabled    = false;

                        // We are now connected so we can change sound banks
                        c3POToolStripMenuItem.Enabled        = true;
                        lostInSpaceToolStripMenuItem.Enabled = true;
                        dalekToolStripMenuItem.Enabled       = true;

                        StartVideo();
                        stopVideoToolStripMenuItem.Enabled = true;
                    }
                }
            }
        }
Exemplo n.º 4
0
        public IActionResult Get()
        {
            RPClient rpC = new RPClient();

            return(Ok(rpC.getClients()));
        }