private async void ActionButton_Tapped(object sender, EventArgs e)
        {
            Image     source = sender as Image;
            PopupPage page   = null;

            await PopupNavigation.Instance.PopAsync();

            switch (source.StyleId)
            {
            case "group":
                page = new SelectCardsPage(Utils.PredefinedActions.Group, null, null, false, null);
                break;

            case "share":
                page = new SelectCardsPage(Utils.PredefinedActions.Share, null, null, false, null);
                break;

            case "save":
                page = new SelectCardsPage(Utils.PredefinedActions.SaveToContacts, null, null, false, null);
                break;

            case "delete":
                page = new SelectCardsPage(Utils.PredefinedActions.Delete, null, null, false, null);
                break;
            }

            await PopupNavigation.Instance.PushAsync(page);
        }
示例#2
0
        private async void ContactsList_ItemLongPressed(object sender, LongPressedEventArgs e)
        {
            ContactModel contact = (e.Item != null) ? e.Item as ContactModel : ContactsGrouped[e.Section][e.Row];
            var          page    = new SelectCardsPage(Utils.PredefinedActions.All, null, contact, false, mainSearchBar.Text);

            page.PageClosing += SelectCardsPage_PageClosing;
            await PopupNavigation.Instance.PushAsync(page);
        }
        private async void ContactsList_ItemLongPressed(object sender, LongPressedEventArgs e)
        {
            ContactModel itemData = (e.Item != null) ? e.Item as ContactModel : FilteredGroupContacts[e.Section][e.Row];
            var          page     = new SelectCardsPage(PredefinedActions.All, _groupName, itemData, false, null);

            page.PageClosing += SelectCardsPage_PageClosing;
            await PopupNavigation.Instance.PushAsync(page);
        }
        private async void AddFromCardsHolderButton_Tapped(object sender, EventArgs e)
        {
            HideQuickActionControls();
            var page = new SelectCardsPage(Utils.PredefinedActions.Group, _groupName, null, true, null);

            page.PageClosing += SelectCardsPage_PageClosing;
            await PopupNavigation.Instance.PushAsync(page);
        }
        private async void CreateGroupButton_Tapped(object sender, EventArgs e)
        {
            newGroupEntry.Unfocus();

            if (string.IsNullOrWhiteSpace(newGroupEntry.Text))
            {
                Device.BeginInvokeOnMainThread(() => HomePage.ShowMessage(notificationMessageView, "Please enter a valid group name"));
                return;
            }

            // Add new group to the group picker string items
            if (HomePage.CurrentAppData.GroupPickerItems.Items.Contains(newGroupEntry.Text))
            {
                Device.BeginInvokeOnMainThread(() => HomePage.ShowMessage(notificationMessageView, "Group already exist"));
                return;
            }

            // deselect any previously selected group
            IEnumerable <GroupsPageItem> selectedItems = _itemsList.Where(x => x.IsSelected);

            foreach (GroupsPageItem item in selectedItems)
            {
                item.IsSelected = false;
            }

            HomePage.CurrentAppData.GroupPickerItems.AddItem(newGroupEntry.Text);

            GroupsPageItem newItem = new GroupsPageItem()
            {
                GroupName = newGroupEntry.Text, IsSelected = true
            };

            _itemsList.Add(newItem);
            _filteredItemsList = SortGroups();
            RefreshListView();

            // Save the updated contact
            HomePage.Instance.SaveContactList();

            if (_preSelectedCardsAvailable)
            {
                OnPageClosing();
            }
            else
            {
                SelectCardsPage page = new SelectCardsPage(Utils.PredefinedActions.Group, newGroupEntry.Text, null, true, null);
                page.PageClosing += SelectCardsPage_PageClosing;
                await PopupNavigation.Instance.PushAsync(page);

                await PopupNavigation.Instance.RemovePageAsync(this, false);
            }
        }