Exemplo n.º 1
0
        public void ConnectNode(TreeNode servername)
        //процедура для соединения при клике по ветке с серверами
        {
            switch (servername.Tag.ToString())
            {
            case "Folder":   //если есть дети, то создаем массив рдп-компонентов и проходимся по веткам с целью коннекта
            {
                MessageBox.Show("");

                /* AxMSTSCLib.AxMsRdpClientNotSafeForScripting[] RDPClientDyn = null;
                 * for (int i = 0; i < servername.Nodes.Count; i++)
                 * {
                 *   RDPClientDyn[i] = new AxMSTSCLib.AxMsRdpClientNotSafeForScripting();
                 *   RDPClientDyn[i].Parent = frm_main.ActiveForm;
                 *   RDPClientDyn[i].Dock = System.Windows.Forms.DockStyle.Fill;
                 *   RDPClientDyn[i].Enabled = true;
                 *   RDPClientDyn[i].Location = new System.Drawing.Point(0, 0);
                 *   RDPClientDyn[i].Name = "RDPClient"+i.ToString();
                 *   RDPClientDyn[i].Size = new System.Drawing.Size(640, 480);
                 *
                 * }*/
            }
            break;

            default:   //если это сервер, о чем свидетельствует тэг, не равный Folder...
            {
                AxMSTSCLib.AxMsRdpClientNotSafeForScripting rc = servername.Tag as AxMSTSCLib.AxMsRdpClientNotSafeForScripting;
                SetRDPconfig(rc, servername, true);
                rc.BringToFront();
                rc.Connect();
            }
            break;
            }
        }
Exemplo n.º 2
0
        private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            switch (e.Button)
            {
            case MouseButtons.Left:
            {
                if (e.Node.Tag.ToString() != "Folder")
                {
                    AxMSTSCLib.AxMsRdpClientNotSafeForScripting rc = (AxMSTSCLib.AxMsRdpClientNotSafeForScripting)e.Node.Tag;
                    if (rc.Connected == 1)
                    {
                        rc.BringToFront();
                    }
                }
            }
            break;

            case MouseButtons.Right:
            {
                if (e.Node.Tag.ToString() != "Folder")
                {
                    AxMSTSCLib.AxMsRdpClientNotSafeForScripting rc = (AxMSTSCLib.AxMsRdpClientNotSafeForScripting)e.Node.Tag;
                    if (rc.Connected == 1)
                    {
                        ServersContextMenu.Items[0].Text = "Разъединить";
                    }
                    else
                    {
                        ServersContextMenu.Items[0].Text = "Соединиться";
                    }
                }
            }
            break;
            }
        }
Exemplo n.º 3
0
        private void RDPCl_OnDisconnected(object sender, AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEvent e)
        {
            connected_screens--;
            AxMSTSCLib.AxMsRdpClientNotSafeForScripting rc = (AxMSTSCLib.AxMsRdpClientNotSafeForScripting)sender;
            TreeNode helper = (TreeNode)rc.Tag;

            helper.ImageIndex         = 5;
            helper.SelectedImageIndex = 6;
        }
Exemplo n.º 4
0
        private void RDPCl_OnConnected(object sender, EventArgs e)
        {
            connected_screens++;
            AxMSTSCLib.AxMsRdpClientNotSafeForScripting rc = (AxMSTSCLib.AxMsRdpClientNotSafeForScripting)sender;
            TreeNode helper = (TreeNode)rc.Tag;

            helper.ImageIndex         = 7;
            helper.SelectedImageIndex = 8;
        }
Exemplo n.º 5
0
        private void SetRDPconfig(AxMSTSCLib.AxMsRdpClientNotSafeForScripting rdp, TreeNode linknode, bool showerrors)
        {
            string      serverstring = "Software\\SafT\\RDPClient\\Servers\\" + linknode.Text;
            RegistryKey server       = Registry.CurrentUser.OpenSubKey(serverstring);

            rdp.Server = server.GetValue("ServerName").ToString();
            string pair = server.GetValue("Pair").ToString();

            rdp.AdvancedSettings2.SmartSizing = true;

            RegistryKey login = Registry.CurrentUser.OpenSubKey("Software\\SafT\\RDPClient\\Pairs\\" + pair);

            if (login != null)
            {
                rdp.UserName = login.GetValue("Username").ToString();
                rdp.AdvancedSettings2.ClearTextPassword = Common_functions.MyCryptoStat.DecryptString(login.GetValue("Password").ToString(), Common_functions.Settings.enterp);
                rdp.Domain = login.GetValue("Domain").ToString();
                login.Close();
            }
            else
            {
                rdp.UserName = Environment.UserName;
                rdp.AdvancedSettings2.ClearTextPassword = "";
                rdp.Domain = Environment.UserDomainName;
                if (showerrors == true)
                {
                    MessageBox.Show("У сервера " + rdp.Server + " не указаны логин, пароль и домен", "Проблемы с логином и паролем");
                }
            }

            rdp.ColorDepth = Convert.ToInt32(server.GetValue("ColorDepth").ToString());
            if (showerrors == true)
            {
                string[] resolution = (server.GetValue("ScreenResolution").ToString()).Split('*');
                rdp.DesktopWidth  = Convert.ToInt32(resolution[0]);
                rdp.DesktopHeight = Convert.ToInt32(resolution[1]);
            }
            else
            {
                rdp.DesktopWidth  = rdp.Width;
                rdp.DesktopHeight = rdp.Height;
            }



            //rdp.AdvancedSettings2.SmartSizing = Convert.ToBoolean(server.GetValue("Username").ToString());
            rdp.AdvancedSettings2.DisplayConnectionBar = true;
            rdp.FullScreen      = Convert.ToBoolean(server.GetValue("FullScreen").ToString());
            rdp.FullScreenTitle = rdp.UserName + " on " + rdp.Server;
            rdp.AdvancedSettings2.ConnectToServerConsole = Convert.ToBoolean(server.GetValue("Console").ToString());
            rdp.SecuredSettings2.AudioRedirectionMode    = Convert.ToInt32(server.GetValue("AudioMode").ToString());
            rdp.AdvancedSettings2.RDPPort = Convert.ToInt32(server.GetValue("Port").ToString());
            rdp.Tag = linknode;
            server.Close();
        }
Exemplo n.º 6
0
 private void разъединитьToolStripMenuItem_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < treeView1.SelectedNode.Nodes.Count; i++)
     {
         AxMSTSCLib.AxMsRdpClientNotSafeForScripting rc = (AxMSTSCLib.AxMsRdpClientNotSafeForScripting)treeView1.SelectedNode.Nodes[i].Tag;
         if (rc.Connected == 1)
         {
             rc.Disconnect();
         }
     }
 }
Exemplo n.º 7
0
 private void соединитьсяToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     AxMSTSCLib.AxMsRdpClientNotSafeForScripting rc = treeView1.SelectedNode.Tag as AxMSTSCLib.AxMsRdpClientNotSafeForScripting;
     if (rc.Connected != 1)
     {
         ConnectNode(treeView1.SelectedNode);
     }
     else
     {
         rc.Disconnect();
     }
 }
Exemplo n.º 8
0
        private void показатьВсеПодключенныеСервераВОдномОкнеToolStripMenuItem_Click(object sender, EventArgs e)
        {
            panel5.Controls.Clear();
            panel5.Size    = panel4.Size;
            panel5.Visible = true;
            panel5.BringToFront();
            Common_functions.Other.MultiScreen(connected_screens, panel4.Width, panel4.Height, 5);
            int screencount = 0;

            for (int i = 0; i < panel4.Controls.Count; i++)
            {
                if (panel4.Controls[i] is /*AxMSTSCLib.AxMsRdpClientNotSafeForScripting*/ myRDP)
                {
                    AxMSTSCLib.AxMsRdpClientNotSafeForScripting rc = (/*AxMSTSCLib.AxMsRdpClientNotSafeForScripting*/ myRDP)panel4.Controls[i];
                    if (rc.Connected != 0)
                    {
                        screencount++;
                        TreeNode thumb_node = (TreeNode)rc.Tag;

                        /*AxMSTSCLib.AxMsRdpClientNotSafeForScripting*/
                        myRDP thumbnail = new /*AxMSTSCLib.AxMsRdpClientNotSafeForScripting*/ myRDP();
                        thumbnail.Name = "thumbnail_" + rc.Name;
                        panel5.Controls.Add(thumbnail);
                        thumbnail.EndInit();
                        thumbnail.Width  = Common_functions.Other.pos_size[2];
                        thumbnail.Height = Common_functions.Other.pos_size[3];
                        SetRDPconfig(thumbnail, thumb_node, false);

                        thumbnail.Connect();

                        /*Label thumbnail_name = new Label();
                         * thumbnail_name.Text = rc.Name;
                         * thumbnail_name.Left = (int)(thumbnail.Width / 2) + thumbnail.Left;
                         * thumbnail_name.Top = thumbnail.Top + thumbnail.Height;
                         * panel5.Controls.Add(thumbnail_name);*/
                    }
                }
            }

            int screen_number = 0;



            for (int i = 0; i < Common_functions.Other.pos_size[1]; i++)     //строки
            {
                for (int j = 0; j < Common_functions.Other.pos_size[0]; j++) //столбцы
                {
                    if (screen_number < panel5.Controls.Count)
                    {
                        panel5.Controls[screen_number].Left = j * (Common_functions.Other.pos_size[2] + 5);
                        panel5.Controls[screen_number].Top  = i * (Common_functions.Other.pos_size[3] + 5);



                        screen_number++;
                    }
                    else
                    {
                        break;
                    }
                }
            }


            for (int i = 0; i < panel5.Controls.Count; i++)
            {
                panel5.Controls[i].BringToFront();

                /*
                 * Bitmap pict = new Bitmap(panel5.Controls[i].Width, panel5.Controls[i].Height);
                 * panel5.Controls[i].DrawToBitmap(pict, panel5.Controls[i].Bounds);
                 * pict.Save("c:\\rdp\\" + panel5.Controls[i].Name + ".bmp");
                 */
            }
        }
Exemplo n.º 9
0
 public void ConnectServer(AxMSTSCLib.AxMsRdpClientNotSafeForScripting RDPClientComponentComponent)
 {
 }