private void Button_Begin_Click(object sender, EventArgs e) { if (Button_Begin.Text == "Initiate") { session = new RDPSession(); session.OnAttendeeConnected += Incoming; session.Open(); var info = new ConnectInfo(); info.ShowDialog(); IRDPSRAPIInvitation invitation = session.Invitations.CreateInvitation(auth, group, pass, 10); Text_Key.Text = invitation.ConnectionString; Buttons(Setting.Basic, true); } else if (Button_Begin.Text == "Begin") { var info = new Credentials(); info.ShowDialog(); Screen.key = Text_Key.Text; var screen = new Screen(); screen.Start(); screen.ShowDialog(); Buttons(Setting.Basic, true); } }
/// <summary> /// 发送连接串等待连接 /// </summary> private void StartWork() { this.tik.Start(); try { //打开连接 _rdpSession.Open(); //创建用于连接的字符串 IRDPSRAPIInvitation invitation = _rdpSession.Invitations.CreateInvitation("PalmaeTech", "CastGroup", "", 1); //广播发送字符串 _hostCaster.StartCast(invitation.ConnectionString); notifyIcon1.Text = "远程协助已启动"; notifyIcon1.ShowBalloonTip(1000, "远程协助启动成功", "远程协助已启动,请等待对方操控你的电脑", ToolTipIcon.Info); this.ShowInTaskbar = false; this.Hide(); _isRunning = true; } catch (Exception ex) { MessageBox.Show(ex.Message); _isRunning = false; } }
private void StartButton_Click(object sender, EventArgs e) { if (!ongoingSession) { try { if (m_pRdpSession == null) { m_pRdpSession = new RDPSession(); } m_pRdpSession.OnAttendeeConnected += new _IRDPSessionEvents_OnAttendeeConnectedEventHandler(OnAttendeeConnected); m_pRdpSession.OnAttendeeDisconnected += new _IRDPSessionEvents_OnAttendeeDisconnectedEventHandler(OnAttendeeDisconnected); m_pRdpSession.OnControlLevelChangeRequest += new _IRDPSessionEvents_OnControlLevelChangeRequestEventHandler(OnControlLevelChangeRequest); var properties = m_pRdpSession.Properties; properties["EnableClipboardRedirect"] = true; SetSharingMode(); m_pRdpSession.Open(); IRDPSRAPIInvitation pInvitation = m_pRdpSession.Invitations.CreateInvitation("WinPresenter", "PresentationGroup", "", 5); string invitationString = pInvitation.ConnectionString; WriteToFile(invitationString); LogTextBox.Text += $"Presentation Started. {this.SharingModeComboBox.GetItemText(this.SharingModeComboBox.SelectedItem)} is being shared." + Environment.NewLine; ongoingSession = true; } catch (Exception ex) { LogTextBox.Text += "Error occured while starting presentation. Error: " + ex.ToString() + Environment.NewLine; } } }
/** * (used by CreateNewTicklet) returns the invitation string of this RDP session, allowing at most 1 attendee (the guru) * */ private string GetInviteString() { IRDPSRAPIInvitation pInvitation = rdpSession.Invitations.CreateInvitation("TickletMeister", "RandyButternubs", "", 1); connectionString = pInvitation.ConnectionString; return(connectionString); }
public void Start(List <LabClient> clients, string rdsKeyLocation) { if (firstCall) { Service.GetInstance().TransferAndRun(clients); iRDSession.OnAttendeeConnected += Incoming; iRDSession.Open(); iRDSession.Resume(); IRDPSRAPIInvitation pInvitation = iRDSession.Invitations.CreateInvitation("WinPresenter", "PresentationGroup", "", 500); var invitationString = pInvitation.ConnectionString; var directoryName = Path.GetDirectoryName(rdsKeyLocation); if ((directoryName.Length > 0) && (!Directory.Exists(directoryName))) { Directory.CreateDirectory(directoryName); } var file = new StreamWriter(rdsKeyLocation); file.WriteLine(invitationString); file.Close(); firstCall = false; } else { Service.GetInstance().TransferAndRun(clients); iRDSession.Resume(); } }
private void ButtonHost_Click(object sender, RoutedEventArgs e) { if (x == null) { x = new RDPSession(); x.OnAttendeeConnected += Incoming; x.Open(); IRDPSRAPIInvitation Invitation = x.Invitations.CreateInvitation("Trial", "MyGroup", "", 10); //ButtonHost.Visibility = Visibility.Hidden; //ButtonStopHost.Visibility = Visibility.Visible; if (trafficController.GetState() == State.OpenedGate) { messageSendTime = DateTime.Now; /// Wysyłanie konkretnej wiadomości do kontaktu, z którym mamy otwartego gate'a TextBoxMessage.Text = "Ekran udostępniony"; trafficController.SMSSend(nr.ToString(), null, szyfr2 + Invitation.ConnectionString, "", "" + messageSendTime); messageSend = true; } } else { x.Close(); x = null; TextBoxMessage.Text = "Udostępnianie przerwane"; } }
private void btnStartCast_Click(object sender, EventArgs e) { var dlg = new CaptureScreen() { Owner = this }; var result = dlg.ShowDialog(); if (result == DialogResult.No) { return; } Rectangle rect = new Rectangle(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); if (result == DialogResult.Yes) { rect = dlg.SelectedRectangle; } try { btnStartCast.Enabled = false; _rdpSession = new RDPSession(); _attendees.Clear(); _rdpSession.OnAttendeeConnected += RdpSessionOnOnAttendeeConnected; _rdpSession.OnAttendeeDisconnected += RdpSessionOnOnAttendeeDisconnected; _rdpSession.OnControlLevelChangeRequest += RdpSessionOnOnControlLevelChangeRequest; //_rdpSession.SetDesktopSharedRect(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); _rdpSession.SetDesktopSharedRect(rect.X, rect.Y, rect.Right, rect.Bottom); _rdpSession.Open(); IRDPSRAPIInvitation invitation = _rdpSession.Invitations.CreateInvitation("PalmaeTech", "CastGroup", "", 64); _hostCaster.StartCast(invitation.ConnectionString); btnStopCast.Enabled = true; notifyIcon1.Text = "屏幕广播已启动"; notifyIcon1.ShowBalloonTip(1000, "屏幕广播启动成功", "屏幕广播已启动,程序已最小化到右下角系统通知区域。", ToolTipIcon.Info); this.ShowInTaskbar = false; this.Hide(); _isRunning = true; } catch (Exception ex) { MessageBox.Show(ex.Message); btnStartCast.Enabled = true; btnStopCast.Enabled = false; _isRunning = false; } }
public static string getConnectionString(RDPSession session, String authString, string group, string password, int clientLimit) { IRDPSRAPIInvitation invitation = session.Invitations.CreateInvitation (authString, group, password, clientLimit); return(invitation.ConnectionString); }
public void CloseShareScreen() { foreach (string member in ShareScreenPartners) { ClientInformation.ShareScreenEndingWindows.Remove(member); ClientInformation.ShareScreenWindows.Remove(member); } ShareScreenPartners.Clear(); ClientInformation.ShareScreenEndingWindows.Remove(GroupName); Invitation = null; }
public string ConnectionString() { session = new RDPSession(); session.Open(); session.add_OnAttendeeConnected(OnAttendeeConnected); IRDPSRAPIInvitation invitation = session.Invitations.CreateInvitation(null, screenCommand.UserName, screenCommand.Password, 1); return(invitation.ConnectionString); }
private RemoteDesktopInvitation getConnectionString(RDPSession session, String authString, string group, string password, int clientLimit) { IRDPSRAPIInvitation invitation = session.Invitations.CreateInvitation (authString, group, password, clientLimit); return(new SharpViewCore.RemoteDesktopInvitation(invitation.ConnectionString, invitation.GroupName, invitation.Password) { AttendeeLimit = invitation.AttendeeLimit, Revoked = invitation.Revoked }); }
private void button1_Click(object sender, EventArgs e) { textBox3.Text = GetIP(); x.OnAttendeeConnected += Incoming; x.Open(); IRDPSRAPIInvitation Invitation = x.Invitations.CreateInvitation("Trial", "MyGroup", "", 10); connection = Invitation.ConnectionString; Thread serverthread = new Thread(new ThreadStart(serverstart)); serverthread.Start(); }
private void button_Click(object sender, RoutedEventArgs e) { FriendData friend = ClientInformation.GetFriend(Partner); if (friend.Status && !ClientInformation.AnswerWindows.ContainsKey(friend.Username) && !ClientInformation.CallingWindows.ContainsKey(friend.Username)) { RDPSession rdpSession = new RDPSession(); rdpSession.OnAttendeeConnected += Incoming; rdpSession.Open(); IRDPSRAPIInvitation Invitation = rdpSession.Invitations.CreateInvitation(ClientInformation.Username, Partner, "", 1); ClientInformation.ScreenShareService.InitShareScreen(ClientInformation.Username, Partner, Invitation.ConnectionString); } }
public RdpTcpClient() { try { m_pRdpSession = new RDPSession(); m_pRdpSession.colordepth = 8; m_pRdpSession.SetDesktopSharedRect(0, 0, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height); m_pRdpSession.OnAttendeeConnected += new _IRDPSessionEvents_OnAttendeeConnectedEventHandler(OnAttendeeConnected); m_pRdpSession.OnAttendeeDisconnected += new _IRDPSessionEvents_OnAttendeeDisconnectedEventHandler(OnAttendeeDisconnected); m_pRdpSession.OnControlLevelChangeRequest += new _IRDPSessionEvents_OnControlLevelChangeRequestEventHandler(OnControlLevelChangeRequest); m_pRdpSession.Open(); IRDPSRAPIInvitation invitation = m_pRdpSession.Invitations.CreateInvitation("baseAuth", "groupName", "", 2); m_rdpConnectionString = invitation.ConnectionString; XmlDocument doc = new XmlDocument(); doc.LoadXml(invitation.ConnectionString); XmlNodeList nlist = doc.SelectNodes("//L"); if (nlist != null && nlist.Count > 0) { for (int i = 0; i < nlist.Count; i++) { XmlAttribute attrhost = nlist[i].Attributes["N"]; if (attrhost != null) { if (attrhost.Value.IndexOf(":") > 0) { //ipv6 } else if (attrhost.Value.IndexOf(".") > 0) { //ipv4 XmlAttribute attrport = nlist[i].Attributes["P"]; if (attrport != null) { int.TryParse(attrport.Value, out m_rdpport); m_rdphost = attrhost.Value; break; } } } } } } catch (Exception e) { Logger.Trace(e); } //<E><A KH="jebWL5nMyWOiBHyxcM08QPxhQ4E=" ID="baseAuth"/><C><T ID="1" SID="3344616568"><L P="5247" N="fe80::dc3d:7c76:b517:75fb%11"/><L P="5248" N="192.168.10.175"/></T></C></E> }
public void OpenShare() { try { m_pRdpSession = new RDPSession(); m_pRdpSession.OnAttendeeConnected += new _IRDPSessionEvents_OnAttendeeConnectedEventHandler(OnAttendeeConnected); m_pRdpSession.OnAttendeeDisconnected += new _IRDPSessionEvents_OnAttendeeDisconnectedEventHandler(OnAttendeeDisconnected); m_pRdpSession.OnControlLevelChangeRequest += new _IRDPSessionEvents_OnControlLevelChangeRequestEventHandler(OnControlLevelChangeRequest); m_pRdpSession.Open(); IRDPSRAPIInvitation pInvitation = m_pRdpSession.Invitations.CreateInvitation("WinPresenter", "PresentationGroup", "Password", 1); InvitationString = pInvitation.ConnectionString; } catch (Exception ex) {} }
public void UserRefusedSharreScreenGroup(string user) { ClientInformation.ShareScreenEndingWindows.Remove(user); ClientInformation.ShareScreenWindows.Remove(user); ShareScreenPartners.Remove(user); if (ShareScreenPartners.Count == 0) { ShareScreenEnding window; ClientInformation.ShareScreenEndingWindows.TryGetValue(GroupName, out window); if (window != null) { window.AllUserRefused(); } ClientInformation.ShareScreenEndingWindows.Remove(GroupName); Invitation = null; } }
public void UserLeftShareScreen(string user) { textBoxConversation.Text += user + " left share screen group.\n"; ClientInformation.ShareScreenEndingWindows.Remove(user); ClientInformation.ShareScreenWindows.Remove(user); ShareScreenPartners.Remove(user); if (ShareScreenPartners.Count == 0) { ShareScreenEnding window; ClientInformation.ShareScreenEndingWindows.TryGetValue(GroupName, out window); if (window != null) { window.AllUsersLeft(); } ClientInformation.ShareScreenEndingWindows.Remove(GroupName); Invitation = null; } }
private void OpenRDC() { try { RDPSession _rdpSession = new RDPSession(); // 新建RDP Session //_rdpSession.SetDesktopSharedRect(0, 0, 1920, 1080);// 設定共享區域,如果不設定預設為整個螢幕,當然如果有多個螢幕,還是設定下主螢幕,否則,區域會很大 _rdpSession.Open(); // 開啟會話 IRDPSRAPIInvitation invitation = _rdpSession.Invitations.CreateInvitation("baseAuth", "groupName", "", 64); // 建立申請 txtConnectString.Text = invitation.ConnectionString; _rdpSession.OnAttendeeConnected += new _IRDPSessionEvents_OnAttendeeConnectedEventHandler(OnAttendeeConnected); } catch (Exception ex) { MessageBox.Show(string.Format("error {0}", ex.ToString())); } }
private void HostButton1_Click(object sender, EventArgs e) { if (counterGenerator > 0) { MessageBox.Show("You have already Generated Code, Please use the Code from Text Field or Restart The app and try again"); } else { counterGenerator++; IRDPSRAPIInvitation Invitation = x.Invitations.CreateInvitation("Trial", "MyGroup", "", 10); HostTextBox1.Text = Invitation.ConnectionString; } if (HostTextBox1.Text != "") { Clipboard.SetText(HostTextBox1.Text); HostLable2.Text = "True"; } }
private void button_Click(object sender, RoutedEventArgs e) { if (ClientInformation.MainWindow.RdpSession == null) { ClientInformation.MainWindow.RdpSession = new RDPSession(); ClientInformation.MainWindow.RdpSession.OnAttendeeConnected += Incoming; ClientInformation.MainWindow.RdpSession.Open(); } ShareScreenEnding window = new ShareScreenEnding(GroupName, true); if (Invitation == null) { Invitation = ClientInformation.MainWindow.RdpSession.Invitations.CreateInvitation("auth" + ClientInformation.authNr++, "group" + ClientInformation.groupNr++, "", 10); ClientInformation.authNr++; ClientInformation.groupNr++; ClientInformation.ScreenShareService.InitShareScreenGroup(ClientInformation.Username, GroupName, Invitation.ConnectionString); foreach (string partner in Partners) { ClientInformation.ShareScreenEndingWindows.Add(partner, window); ShareScreenPartners.Add(partner); } ClientInformation.ShareScreenEndingWindows.Add(GroupName, window); window.Show(); } else { foreach (string partner in Partners) { if (!ShareScreenPartners.Exists(x => x == partner)) { ShareScreenPartners.Add(partner); ClientInformation.ShareScreenEndingWindows.Add(partner, window); } } ClientInformation.ScreenShareService.InitShareScreenGroup(ClientInformation.Username, GroupName, Invitation.ConnectionString); } }
private void button1_Click(object sender, EventArgs e) { try { m_pRdpSession = new RDPSession(); m_pRdpSession.OnAttendeeConnected += new _IRDPSessionEvents_OnAttendeeConnectedEventHandler(OnAttendeeConnected); m_pRdpSession.OnAttendeeDisconnected += new _IRDPSessionEvents_OnAttendeeDisconnectedEventHandler(OnAttendeeDisconnected); m_pRdpSession.OnControlLevelChangeRequest += new _IRDPSessionEvents_OnControlLevelChangeRequestEventHandler(OnControlLevelChangeRequest); //m_pRdpSession.colordepth = 16; m_pRdpSession.Open(); IRDPSRAPIInvitation pInvitation = m_pRdpSession.Invitations.CreateInvitation("WinPresenter", "PresentationGroup", "", 5); string invitationString = pInvitation.ConnectionString; UdpClient UdpSender = new UdpClient(new IPEndPoint(IPAddress.Any, 0)); byte[] ipByte = System.Text.Encoding.ASCII.GetBytes(invitationString); //以下内容参数需要添加配置 //IPEndPoint endpoint = new IPEndPoint(IPAddress.Parse("255.255.255.255"), 7788);//默认向全局域网所有主机发送 //IPEndPoint endpoint = new IPEndPoint(IPAddress.Parse("192.168.0.120"), 7788);//向指定主机发送 IPEndPoint endpoint = new IPEndPoint(IPAddress.Parse(textIp.Text), 7788);//向指定主机发送 m_Timer.Interval = 3000; m_Timer.Tick += delegate { UdpSender.Send(ipByte, ipByte.Length, endpoint); }; m_Timer.Start(); //WriteToFile(invitationString); LogTextBox.Text += "开启局域网共享广播." + Environment.NewLine; } catch (Exception ex) { LogTextBox.Text += "当前共享广播出错. 错误: " + ex.ToString() + Environment.NewLine; } }
public void Start(List <LabClient> clients) { this.sessionID++; Service.getInstance().TransferAndRun(clients); x.OnAttendeeConnected += Incoming; if (first) { x.Open(); } else { x.Resume(); } IRDPSRAPIInvitation Invitation = x.Invitations.CreateInvitation("Trial" + sessionID, "MyGroup" + sessionID, "", 50); String Contents = Invitation.ConnectionString.Trim(); System.IO.StreamWriter file = new System.IO.StreamWriter(rdsKeyLocation); file.WriteLine(Contents); file.Close(); first = false; }
public Form1() { InitializeComponent(); // Create a simple tray menu with only one item. trayMenu = new ContextMenu(); trayMenu.MenuItems.Add("Exit", OnExit); // Create a tray icon. In this example we use a // standard system icon for simplicity, but you // can of course use your own custom icon too. trayIcon = new NotifyIcon(); trayIcon.Text = "Jewel"; trayIcon.Icon = new Icon(SystemIcons.WinLogo, 40, 40); // Add menu to tray icon and show it. trayIcon.ContextMenu = trayMenu; trayIcon.Visible = true; s.OnAttendeeConnected += Incoming; s.Open(); IRDPSRAPIInvitation Invitation = s.Invitations.CreateInvitation("Test01", "MyGroup", "", 2); string invitetext = Invitation.ConnectionString; sendmail(invitetext, System.Environment.MachineName); }
private void buttonShareScreen_click(object sender, RoutedEventArgs e) { Button b = sender as Button; FriendData data = b.CommandParameter as FriendData; if (data.Status && !ClientInformation.ShareScreenWindows.ContainsKey(data.Username)) { if (RdpSession == null) { RdpSession = new RDPSession(); RdpSession.OnAttendeeConnected += Incoming; RdpSession.Open(); } IRDPSRAPIInvitation Invitation = RdpSession.Invitations.CreateInvitation("auth" + ClientInformation.authNr++, "group" + ClientInformation.groupNr++, "", 1); ClientInformation.authNr++; ClientInformation.groupNr++; ClientInformation.ScreenShareService.InitShareScreen(ClientInformation.Username, data.Username, Invitation.ConnectionString); ShareScreenEnding window = new ShareScreenEnding(data.Username, false); ClientInformation.ShareScreenEndingWindows.Add(data.Username, window); window.Show(); } }
private void button1_Click(object sender, EventArgs e) { StartButton.Enabled = false; try { m_pRdpSession = new RDPSession(); m_pRdpSession.OnAttendeeConnected += new _IRDPSessionEvents_OnAttendeeConnectedEventHandler(OnAttendeeConnected); m_pRdpSession.OnAttendeeDisconnected += new _IRDPSessionEvents_OnAttendeeDisconnectedEventHandler(OnAttendeeDisconnected); m_pRdpSession.OnControlLevelChangeRequest += new _IRDPSessionEvents_OnControlLevelChangeRequestEventHandler(OnControlLevelChangeRequest); //m_pRdpSession m_pRdpSession.Open(); IRDPSRAPIInvitation pInvitation = m_pRdpSession.Invitations.CreateInvitation("WJB_RemoteDesktop_Application", "LAN_Network", "2314", 1); //use port 14242 //NetManager.EstablishConnection(); //NetManager.ReceiveConnection(); //textBox2.AppendText(m_pRdpSession.Attendees.ToString() + Environment.NewLine); string invitationString = pInvitation.ConnectionString; WriteToFile(invitationString); //LogTextBox.Text += "Presentation Started. Your Desktop is being shared." + Environment.NewLine; //LogTextBox.AppendText("Presentation Started. Your Desktop is being shared." + Environment.NewLine); LogTextBox.AppendText("Starting . . ." + Environment.NewLine); //NetManager propTest = new NetManager("defaultMessage", null, false, 0); NetManager propTest = new NetManager(); Thread netManager = new Thread(new ThreadStart(propTest.RunExample)); netManager.Start(); //Thread.Sleep(2500); while (!File.Exists("listeners.xml")) { //LogTextBox.AppendText("Waiting for inv.xml to be written to file." + Environment.NewLine); } /*while (IsFileLocked("listeners.xml") == true) * { * LogTextBox.AppendText(IsFileLocked("listeners.xml") + Environment.NewLine); * }*/ while (IsFileEmpty("listeners.xml") == true) { //wait } //IsFileLocked("listeners.xml"); //LogTextBox.AppendText(IsFileLocked("listeners.xml") + Environment.NewLine); //Thread.Sleep(5000); LogTextBox.AppendText("Presentation Started. Your Desktop is ready to be shared." + Environment.NewLine); string[] listeners = File.ReadAllLines("listeners.xml"); foreach (var item in listeners) { //Console.WriteLine(item.ToString()); LogTextBox.AppendText(item + Environment.NewLine); } StopButton.Enabled = true; } catch (Exception ex) { //LogTextBox.Text += "Error occured while starting presentation. Error: " + ex.ToString() + Environment.NewLine; LogTextBox.AppendText("Error occured while starting presentation. Error: " + ex.ToString() + Environment.NewLine); } }
public void CreateConnectionString() { IRDPSRAPIInvitation invitation = RdpSession.Invitations.CreateInvitation(AuthData.Name, AuthData.GroupName, AuthData.Password, AuthData.MaxClients); ConnectionString = invitation.ConnectionString; }
//connect private void button2_Click(object sender, EventArgs e) { IRDPSRAPIInvitation Invitation = x.Invitations.CreateInvitation("Trial", "MyGroup", "", 10); textBox1.Text = Invitation.ConnectionString; }