Example #1
0
        internal RdpClient(ContainerControl parent, Size size, EventHandler resizeHandler)
        {
            this.parent = parent;
            this.size = size;
            try
            {
                rdpControl = new MsRdpClient6();
                RDPConfigure(size);

                // CA-96135: Try adding rdpControl to parent.Controls list; this will throw exception when
                // MsRdpClient6 control cannot be created (there is no appropriate version of dll present)
                parent.Controls.Add(rdpControl);

                RDPSetSettings();

                rdpControl.Resize += resizeHandler;
            }
            catch (Exception ex)
            {
                Log.Error("MsRdpClient6 control cannot be added.", ex);

                if (rdpControl != null)
                {
                    if (parent.Controls.Contains(rdpControl))
                        parent.Controls.Remove(rdpControl);

                    rdpControl.Dispose();
                    rdpControl = null;
                }
            }
        }
Example #2
0
        internal RdpClient(ContainerControl parent, Size size, EventHandler resizeHandler)
        {
            this.parent = parent;
            this.size = size;
            try
            {
                rdpControl = rdpClient6 = new MsRdpClient6();
                RDPConfigure(size);

                // CA-96135: Try adding rdpControl to parent.Controls list; this will throw exception when
                // MsRdpClient6 control cannot be created (there is no appropriate version of dll present)
                parent.Controls.Add(rdpControl);
            }
            catch
            {
                if (parent.Controls.Contains(rdpControl))
                    parent.Controls.Remove(rdpControl);
                rdpClient6 = null;
                rdpControl = rdpClient2 = new MsRdpClient2();
                RDPConfigure(size);
                parent.Controls.Add(rdpControl);
            }
            rdpControl.Resize += resizeHandler;
        }