Пример #1
0
 private void btn_add_Click(object sender, RoutedEventArgs e)
 {
     if(allowAction)
     {
         Window_AddEditContact win = new Window_AddEditContact(this, -1);
         win.ShowDialog();
     }
 }
Пример #2
0
 private void btn_edit_Click(object sender, RoutedEventArgs e)
 {
     if (allowAction)
     {
         ListViewContactItem item;
         int count = listview_contacts.Items.Count;
         for (int i = 0; i < count; i++)
         {
             item = (ListViewContactItem)listview_contacts.Items[i];
             if (item.IsCheck)
             {
                 int idx = item.Index;
                 Object contactObj = uc_AddressBook.ListDisplayContact[idx];
                 Window_AddEditContact frm = new Window_AddEditContact(this, contactObj, uc_AddressBook.ListGroupName);
                 frm.ShowDialog();
                 return;
             }
         }
     }
 }
Пример #3
0
        private void btn_edit_Click(object sender, RoutedEventArgs e)
        {
            if (allowAction)
            {
                int count = listview_contacts.Items.Count;
                int editId = -1;
                for (int i = 0; i < count; i++)
                {
                    Object item = listview_contacts.Items[i];
                    if (item is ListViewContactItem)
                    {
                        if (((ListViewContactItem)item).IsCheck)
                        {
                            editId = ((ListViewContactItem)item).Id;
                            break;
                        }

                    }
                }

                if (editId > 0)
                {
                    Window_AddEditContact win = new Window_AddEditContact(this, editId);
                    win.ShowDialog();
                }
            }
        }
Пример #4
0
        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; }));
        }