private void OnItemTapped(object sender, C1TappedEventArgs e)
        {
            e.Handled = true;
            SuggestListPopup.IsOpen = false;
            C1ListBoxItem item = sender as C1ListBoxItem;
            string        tag  = (item.Content as Mail)?.Name?.Trim();

            if (!string.IsNullOrEmpty(tag) && !AddressEditor.Text.Contains(tag))
            {
                // add new tag
                AddressEditor.InsertTag(tag);
                AddressEditor.SetEditorText(string.Empty);
                AddressEditor.Focus(FocusState.Programmatic);
                Mail selectedMail = Mails[MyIndexOf(tag)];
                _changedSelectedItemsInternal = true;
                if (ContactList.SelectedItems == null)
                {
                    object[] selectedItems = new object[] { selectedMail };
                    ContactList.SelectedItems = selectedItems;
                }
                else
                {
                    object[] selectedItems = ContactList.SelectedItems as object[];
                    var      list          = selectedItems.ToList();
                    if (!list.Contains(selectedMail))
                    {
                        list.Add(selectedMail);
                        ContactList.SelectedItems = list.ToArray();
                    }
                }
                _changedSelectedItemsInternal = false;
            }
        }
示例#2
0
        public CheckoutProfileEditViewModel()
        {
            EditBillingAddress = new DelegateCommand(parameter =>
            {
                Address address = BillingAddress != null ? new Address(BillingAddress) : new Address();

                AddressEditor editor = new AddressEditor()
                {
                    DataContext = new AddressEditViewModel()
                    {
                        Model = address
                    }
                };

                if (editor.ShowDialog() ?? false)
                {
                    BillingAddress = address;
                }
            });

            EditShippingAddress = new DelegateCommand(parameter =>
            {
                Address address = ShippingAddress != null ? new Address(ShippingAddress) : new Address();

                AddressEditor editor = new AddressEditor()
                {
                    DataContext = new AddressEditViewModel()
                    {
                        Model = address
                    }
                };

                if (editor.ShowDialog() ?? false)
                {
                    ShippingAddress = address;
                }
            });

            EditPayCard = new DelegateCommand(parameter =>
            {
                PayCard card = PayCard != null ? new PayCard(PayCard) : new PayCard()
                {
                    Type = PayCardTypeCollection.Types.ElementAt(0)
                };

                PayCardEditor editor = new PayCardEditor()
                {
                    DataContext = new PayCardEditViewModel()
                    {
                        Model = card
                    }
                };

                if (editor.ShowDialog() ?? false)
                {
                    PayCard = card;
                }
            });
        }
示例#3
0
        private void button2_Click(object sender, EventArgs e)
        {
            address a = (address)cbAddress.SelectedItem;

            if (a != null)
            {
                AddressEditor editor = new AddressEditor(db, a);
                editor.Show();
            }
        }
        private void RemoveTagByName(string value)
        {
            int removeIndex = -1;

            for (int index = 0; index < AddressEditor.Tags.Count; index++)
            {
                string tagContent = (string)AddressEditor.Tags[index].Content;
                if (tagContent == value)
                {
                    removeIndex = index;
                    break;
                }
            }
            if (removeIndex > -1)
            {
                AddressEditor.RemoveTagAt(removeIndex);
            }
        }
 private void OnListBoxSelectionChanged(object sender, SelectionChangedEventArgs <int> e)
 {
     if (_changedSelectedItemsInternal)
     {
         return;
     }
     foreach (int index in e.AddedItems)
     {
         Mail item = (Mail)ContactList.Items[index];
         _changedSelectedItemsInternal = true;
         AddressEditor.InsertTag(item.Name);
         AddressEditor.SetEditorText(string.Empty);
         _changedSelectedItemsInternal = false;
         AddressEditor.Focus(FocusState.Programmatic);
     }
     foreach (int index in e.RemovedItems)
     {
         Mail item = (Mail)ContactList.Items[index];
         _changedSelectedItemsInternal = true;
         RemoveTagByName(item.Name);
         _changedSelectedItemsInternal = false;
     }
 }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            AddressEditor editor = new AddressEditor(db, (address)cbAddress.SelectedItem);

            editor.Show();
        }