private void btn_add_contact_Click(object sender, RoutedEventArgs e)
 {
     if (allowAction && selectedGroup.GroupName.Length > 0)
     {
         Window_SelectLocalContact frm = new Window_SelectLocalContact(this, uc_AddressBook.ListAllContact, listDisplayContact);
         frm.ShowDialog();
     }
 }
 private void btn_add_contact_Click(object sender, RoutedEventArgs e)
 {
     if (allowAction && selectedGroup.Id > 0)
     {
         List<int> groupContactIdList = new List<int>();
         foreach (ContactDB contact in listContact)
         {
             groupContactIdList.Add(contact.Id);
         }
         Window_SelectLocalContact frm = new Window_SelectLocalContact(this, groupContactIdList, Window_SelectLocalContact.MODE_LOCAL_CONTACT);
         frm.ShowDialog();
     }
 }
        private void combox_add_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int index = combox_add.SelectedIndex;

            if (index < 0)
            {
                return;
            }
            switch (index)
            {
                case 0: // manually
                    if (uc_AddressBook.ListAllContact.Count() < printer.MaxContact)
                    {
                        Window_AddEditContact frm = new Window_AddEditContact(this, null, uc_AddressBook.ListGroupName);
                        frm.ShowDialog();
                    }
                    else
                    {
                        string msg = DownloadStatusUtility.StatusToString(DownloadStatus.MAXIMUM_CONTACT_EXEED);
                        MessageBox.Show(msg);
                    }
                    break;
                case 1: // from local
                    if (uc_AddressBook.ListAllContact.Count() < printer.MaxContact)
                    {
                        List<int> notInList = GetContactDBIDList();
                        Window_SelectLocalContact frm = new Window_SelectLocalContact(this, notInList, Window_SelectLocalContact.MODE_PRINTER_CONTACT);
                        frm.ShowDialog();
                    }
                    else
                    {
                        string msg = DownloadStatusUtility.StatusToString(DownloadStatus.MAXIMUM_CONTACT_EXEED);
                        MessageBox.Show(msg);
                    }
                    break;
            }
            Application.Current.Dispatcher.BeginInvoke(
              DispatcherPriority.Background,
              new Action(() => { combox_add.Text = CMLibrary.Properties.Resources.add; }));
        }