コード例 #1
0
 private void ShowUsers()
 {
     try
     {                
         // Calling the web service for 'GetUsers' for retrieving all the currently logged users. 
         string strUList = chat.GetUsers();
         iUserCnt = String.Compare(strCacheUser, strUList);
         if (iUserCnt != 0)                
         {
             lstUsers.Items.Clear();                   
             string[] strUsers = strUList.Split('|');
             strCacheUser = strUList;
             for (int i = 0; i < strUsers.Length - 1; i++)
             {
                 if (strUsers[i].ToUpper() != lblUserName.Text.Trim().ToUpper())
                 {
                     lstUsers.Items.Add(strUsers[i], 1);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         //MessageBox.Show("Error in connecting to the chat server. Please wait.");
     }
 }
コード例 #2
0
        private void PopulateUsers()
        {
            lstAllUser.Items.Clear();
            lstSelectUser.Items.Clear();
            bool bflag = true;

            // Calling the web service for 'GetUsers' for retrieving all the currently logged users.
            string[] strUsers = chat.GetUsers().Split('|');
            for (int i = 0; i < strUsers.Length - 1; i++)
            {
                if (strUsers[i].ToUpper() != Form1.strMe.ToUpper())
                {
                    bflag = true;
                    for (int j = 0; j < Form1.arrConf.Count - 1; j++)
                    {
                        if (strUsers[i].ToUpper() == Form1.arrConf[j].ToString().ToUpper())
                        {
                            bflag = false;
                        }
                    }
                    if (bflag == true)
                    {
                        lstAllUser.Items.Add(strUsers[i]);
                    }
                }
            }

            for (int i = 0; i < Form1.arrConf.Count - 1; i++)
            {
                lstSelectUser.Items.Add(Form1.arrConf[i]);
            }
        }