Example #1
0
        //Start remote desktop
        private void btnRemoteDesktop_Click(object sender, EventArgs e)
        {
            try
            {
                if (lbConnectedClients.SelectedItems.Count < 0)
                {
                    MessageBox.Show("Please select a client!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                int ConnectionId = CurrentSelectedID;
                if (RDActive)
                {
                    MessageBox.Show("Remote desktop is already active!", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }

                if (bwUpdateImage.IsBusy)
                {
                    return;
                }
                RDActive = true;
                MainServer.Send(ConnectionId, Encoding.ASCII.GetBytes("StartRD"));
                RDC = new RDC();
                RDC.ConnectionID = ConnectionId;
                RDC.Text         = "Remote Desktop Viewer - " + ConnectionId;
                RDC.Show();
                bwUpdateImage.RunWorkerAsync();
            }
            catch
            {
            }
        }