Пример #1
0
        private void AddSenderIdentity(CustomerIdentity identity)
        {
            string[] subItems = new string[2];
            subItems[0] = CustomerIdentity.IdentityTypeToElbaString(identity.IdentityType);
            subItems[1] = identity.Value;

            ObjectListViewItem item = new ObjectListViewItem(identity, subItems);

            SenderIdentityListView.Items.Add(item);
            _identities.Add(identity);
        }
Пример #2
0
        private void EditSelectedItem()
        {
            ListView.SelectedListViewItemCollection items = SenderIdentityListView.SelectedItems;
            if (items.Count > 1)
            {
                MessageBox.Show("You can only edit one item at the same time.");
                return;
            }

            ObjectListViewItem lvi = items[0] as ObjectListViewItem;
            CustomerIdentity   underlyingObject = lvi?.UnderlyingObject as CustomerIdentity;

            if (underlyingObject != null)
            {
                CustomerIdentity         copy = underlyingObject.Copy();
                EditCustomerIdentityForm form = new EditCustomerIdentityForm(copy);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    copy.CopyTo(underlyingObject);
                    lvi.SubItems[0].Text = CustomerIdentity.IdentityTypeToElbaString(underlyingObject.IdentityType);
                    lvi.SubItems[1].Text = underlyingObject.Value;
                }
            }
        }