示例#1
0
        private void lstServers_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (lstServers.SelectedItems.Count > 0)
            {
                m_selectedListing = (ServerListing)lstServers.SelectedItems[0].Tag;

                m_ServerIP = m_selectedListing.ServerIP;
                m_Port     = m_selectedListing.Port;
                m_UserName = m_selectedListing.UserName != null ? m_selectedListing.UserName : "";
                m_Password = m_selectedListing.Password != null ? m_selectedListing.Password : "";

                chkSavePassword.Checked = (m_Password.Length > 0);
            }
            else
            {
                m_selectedListing = null;
                m_ServerIP        = "";
                m_Port            = 0;
                m_UserName        = "";
                m_Password        = "";
            }

            UpdateButtonState();
            UpdateDisplay();
        }
示例#2
0
        public ServerListing GetListingByID(string id)
        {
            for (int i = 0; i < List.Count; ++i)
            {
                ServerListing listing = (ServerListing)List[i];

                if (listing.GUID == id)
                {
                    return(listing);
                }
            }

            return(null);
        }
示例#3
0
        private void PopulateServerList()
        {
            lstServers.Items.Clear();

            m_selectedListing = null;
            m_ServerIP        = "";
            m_Port            = 0;
            m_UserName        = "";
            m_Password        = "";

            foreach (ServerListing server in Config.ServerListings)
            {
                ListViewItem item = new ListViewItem(server.ServerName);
                item.Tag = server;
                lstServers.Items.Add(item);
            }
        }
        public void EditListing(ServerListing listing, Form owner)
        {
            this.Owner  = owner;
            this.Text   = "Edit Listing";
            m_newRecord = false;
            m_listing   = listing;

            m_oldListingData          = new ServerListing(listing.ServerName, listing.ServerIP, listing.Port, listing.UserName);
            m_oldListingData.Password = listing.Password;

            UpdateControlStates();
            UpdateDisplay();

            ShowDialog(owner);

            if (this.DialogResult == DialogResult.Cancel)
            {
                m_listing.ServerName = m_oldListingData.ServerName;
                m_listing.ServerIP   = m_oldListingData.ServerIP;
                m_listing.Port       = m_oldListingData.Port;
                m_listing.UserName   = m_oldListingData.UserName;
                m_listing.Password   = m_oldListingData.Password;
            }
        }
示例#5
0
 public void Remove(ServerListing listing)
 {
     List.Remove(listing);
 }
示例#6
0
 public int Add(ServerListing listing)
 {
     return(List.Add(listing));
 }