Пример #1
0
        public void SetSharingMode()
        {
            string selected = this.SharingModeComboBox.GetItemText(this.SharingModeComboBox.SelectedItem);

            if (selected.Equals("Desktop"))
            {
                Screen screen = Screen.FromControl(this);
                m_pRdpSession.SetDesktopSharedRect(screen.Bounds.Left, screen.Bounds.Top, screen.Bounds.Right, screen.Bounds.Bottom);
                LogTextBox.Text += ($"Sharing desktop: {this.LogicalToDeviceUnits(screen.Bounds.Left)}, {this.LogicalToDeviceUnits(screen.Bounds.Top)}, {this.LogicalToDeviceUnits(screen.Bounds.Right)}, {this.LogicalToDeviceUnits(screen.Bounds.Bottom)}" + Environment.NewLine);
            }
            else
            {
                m_pRdpSession.ApplicationFilter.Enabled = true;

                var applications = m_pRdpSession.ApplicationFilter.Applications;
                foreach (var appObj in applications)
                {
                    RDPSRAPIApplication app = appObj as RDPSRAPIApplication;
                    if (!string.IsNullOrEmpty(app.Name) && app.Name.Equals(selected))
                    {
                        app.Shared = true;
                    }
                }
            }
        }
Пример #2
0
        private void WinSharer_Load(object sender, EventArgs e)
        {
            m_pRdpSession = new RDPSession();
            SharingModeComboBox.Items.Add("Desktop");
            SharingModeComboBox.SelectedIndex = 0;
            var applications = m_pRdpSession.ApplicationFilter.Applications;

            foreach (var appObj in applications)
            {
                RDPSRAPIApplication app = appObj as RDPSRAPIApplication;
                if (!string.IsNullOrEmpty(app.Name))
                {
                    SharingModeComboBox.Items.Add(app.Name);
                }
            }
        }