public bool Connect(VNCHost target, Crownwood.Magic.Controls.TabPage tab)
 {
     try
     {
         m_host = target;
         m_tab = tab;
         rd.Connect(target.Hostname, target.Screen, true);
         return true;
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message, "Connect Exception");
         Disconnect();
         return false;
     }
 }
        public VNCHost Display(VNCHost host)
        {
            txtDisplayName.Text = host.DisplayName;
            txtHostname.Text = host.Hostname;
            txtScreen.Value = host.Screen;
            if (host.Password.Length > 0)
                txtPassword.Text = "UNCHANGED";
            else
                txtPassword.Text = "";

            if (ShowDialog() == DialogResult.OK)
            {
                host.DisplayName = txtDisplayName.Text;
                host.Hostname = txtHostname.Text;
                host.Screen = Convert.ToInt16(txtScreen.Value);
                if (txtPassword.Text.CompareTo("UNCHANGED") != 0)
                    host.Password = txtPassword.Text;
            }
            else
                return null;

            return host;
        }
Ejemplo n.º 3
0
        private void menuMainFileQuickConnect_Click(object sender, System.EventArgs e)
        {
            QuickConnectForm qc = new QuickConnectForm();
            if (qc.ShowDialog() == DialogResult.OK)
            {
                string server = qc.Server;

                VNCHost host = new VNCHost(server);
                if (host == null)
                {
                    MessageBox.Show("Invalid server", "Error");
                    return;
                }

                if (CreateVNCWindow(host) && MessageBox.Show("Add this host to the list?", host.DisplayName, MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    AddHost(host);
                    SaveConfig();
                }
            }
        }
Ejemplo n.º 4
0
        private bool CreateVNCWindow(VNCHost target)
        {
            // TODO: Check to see if this client is already connected
            //		 Switch to the window if it is

            // Create the VNC window
            try
            {
                VNCConnectionControl vnc = new VNCConnectionControl();
                Crownwood.Magic.Controls.TabPage newtab = new Crownwood.Magic.Controls.TabPage(target.DisplayName, vnc);
                if (vnc.Connect(target, newtab))
                {
                    tabs.TabPages.Add(newtab);
                    return true;
                }

                MessageBox.Show("Failed to connect", "Connection Error");
                return false;
            }
            catch (Exception e)
            {
                MessageBox.Show("CreateVNCWindow: " + e.Message);
                return false;
            }
        }
Ejemplo n.º 5
0
 public void AddHost(VNCHost h, TreeNode nodeRoot)
 {
     if (!HostExists(h.Hostname))
     {
         try
         {
             TreeNode item = nodeRoot.Nodes.Add(h.DisplayName);
             item.Tag = h;
             item.ImageIndex = 1;
             item.SelectedImageIndex = 1;
             ResolveHost(item);
         }
         catch { }
     }
 }
Ejemplo n.º 6
0
 public void AddHost(VNCHost h)
 {
     AddHost(h, m_nodeUnassigned);
 }