Example #1
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            string str = currentUser.GroupsFriends;
            string delimit = ",";
            string[] groups = null;

            groups = str.Split(delimit.ToCharArray());
            for (int i = 0; i < groups.Length; i++)
            {
                string group = groups[i];
                delimit = "[] ";

                string[] friends = group.Split(delimit.ToCharArray());
                if (friends[0].CompareTo(RemoveGrouptextBox.Text) == 0)
                {
                    str.Replace(group, "");
                    ConnSQL connSQL = new ConnSQL();
                    this.currentUser.GroupsFriends = str;
                    connSQL.updateGF(this.currentUser.Username, this.currentUser.GroupsFriends);
                    parrentCW.user = currentUser;
                    parrentCW.updateContactListBox();
                }
                break;

            }

            SendMessageFriendOp(2, RemoveGrouptextBox.Text, "");
            
          
        }
Example #2
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     ConnSQL connSQL = new ConnSQL();
     this.currentUser.GroupsFriends += "," + AddGrouptextBox.Text + "[]";
     connSQL.updateGF(this.currentUser.Username, this.currentUser.GroupsFriends);
     parrentCW.user = currentUser;
     parrentCW.updateContactListBox();
     SendMessageFriendOp(1, AddGrouptextBox.Text, "");
 }
Example #3
0
        void MiRemoveUser_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show(this.selectedlabel.Content.ToString());
            ConnSQL connSQL = new ConnSQL();

            this.user.GroupsFriends=this.user.GroupsFriends.Replace(this.selectedlabel.Content.ToString(), "");
            MessageBox.Show(this.user.GroupsFriends);
            connSQL.updateGF(user.Username, user.GroupsFriends);
            updateContactListBox();

        }
Example #4
0
        private void button4_Click(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show(RemoveContacttextBox.Text);
            ConnSQL connSQL = new ConnSQL();

            this.currentUser.GroupsFriends = this.currentUser.GroupsFriends.Replace(RemoveContacttextBox.Text, "");
            //MessageBox.Show(this.currentUser.GroupsFriends);
            connSQL.updateGF(currentUser.Username, currentUser.GroupsFriends);
            parrentCW.updateContactListBox();

            SendMessageFriendOp(4, "", RemoveContacttextBox.Text);

        }
Example #5
0
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            try
            {


         //       MessageBox.Show(SelectGroupComboBox.Text);
                string str = currentUser.GroupsFriends;
                string delimit = ",";
                string[] groups = null;

                groups = str.Split(delimit.ToCharArray());
                int i;
                string[] friends = null;
                string newgroupfriend = "";
                string group = "";
                for (i = 0; i < groups.Length; i++)
                {
                    group = groups[i];
                    delimit = "[] ";

                    friends = group.Split(delimit.ToCharArray());
                    //    newlabel.Content = friends[0];
            //        MessageBox.Show(friends[0]);
                    if (SelectGroupComboBox.Text.CompareTo(friends[0]) == 0)
                    {
                        SendMessageFriendOp(3, friends[0], AddContacttextBox.Text);
                        break;

                    }
                }
                newgroupfriend = friends[0] + "[" + AddContacttextBox.Text;

                for (int k = 1; k < friends.Length - 1; k++)
                {
                    if (friends[k].CompareTo(" ") != 0 && friends[k].CompareTo("") != 0)
                    {


                        newgroupfriend += " " + friends[k];
                    }
                }
                if (friends[friends.Length - 1].CompareTo(" ") != 0 && friends[friends.Length - 1].CompareTo("") != 0)
                {
                    newgroupfriend += friends[friends.Length];

                }


                newgroupfriend += "]";
                ConnSQL connSQL = new ConnSQL();
                this.currentUser.GroupsFriends = this.currentUser.GroupsFriends.Replace(group, newgroupfriend);
       //         MessageBox.Show(newgroupfriend);
                connSQL.updateGF(this.currentUser.Username, this.currentUser.GroupsFriends);
                parrentCW.user = currentUser;
                parrentCW.updateContactListBox();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.ToString());
            }



          
        }