private void UpdateListViewGroup()
        {
            if (!Application.Current.Dispatcher.CheckAccess())
            {
                Application.Current.Dispatcher.BeginInvoke(
                  DispatcherPriority.Background,
                  new Action(UpdateListViewGroup));
                return;
            }
            listview_groups.Items.Clear();
            int size = listGroup.Count();
            GroupDB group;
            listGroupItem.Clear();
            for (int i = 0; i < size; i++)
            {
                group = listGroup[i];
                string name = group.Name;
                ListViewGroupItem item = new ListViewGroupItem();
                item.IsCheck = isAllGroupCheck;
                item.Index = i;
                item.Id = group.Id;
                item.GroupName = group.Name;

                if (group.Id == selectedGroup.Id)
                {
                    item.MakeBold();
                    selectedGroup = item;
                }
                else
                {
                    item.MakeRegular();
                }
                listGroupItem.Add(item);
                listview_groups.Items.Add(item);
            }
            ReSortingGroupList();
        }
        private void UpdateSelectedGroupAndRelatedButtons(ListViewGroupItem selected)
        {
            selectedGroup = selected != null ? selected : new ListViewGroupItem();

            bool enabled = selectedGroup.Id > 0;
            btn_add_contact.IsEnabled = enabled;
            btn_rename.IsEnabled = enabled;
            btn_remove_contact.IsEnabled = enabled;
        }
        private void UpdateListViewGroup()
        {
            if (!Application.Current.Dispatcher.CheckAccess())
            {
                Application.Current.Dispatcher.BeginInvoke(
                  DispatcherPriority.Background,
                  new Action(UpdateListViewGroup));
                return;
            }
            string selectedGroupName = selectedGroup.GroupName;

            listview_groups.Items.Clear();
            listGroupItem.Clear();
            int size = uc_AddressBook.ListGroupName.Count();

            for (int i = 0; i < size; i++)
            {
                string group = uc_AddressBook.ListGroupName[i];
                if (group.Contains(searchText))
                {

                    ListViewGroupItem item = new ListViewGroupItem();
                    item.IsCheck = isAllGroupCheck;
                    item.Index = i;
                    item.GroupName = group;


                    if (String.Compare(group, selectedGroupName) == 0)
                    {
                        item.MakeBold();
                        selectedGroup = item;
                    }
                    else
                    {
                        item.MakeRegular();
                    }

                    listGroupItem.Add(item);
                    listview_groups.Items.Add(item);
                }
            }

            ReSortingGroupList();
        }