Exemple #1
0
        private async void userGridView_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
        {
            var menu = new PopupMenu();

            menu.Commands.Add(new UICommand("接受请求", async(command) =>
            {
                try
                {
                    var user = await FanfouAPI.FanfouAPI.Instance.FriendshipAccept(((sender as UserItemControl).DataContext as User).id);
                    users.Remove((from u in users where u.id == user.id select u).First());
                }
                catch (Exception)
                {
                    Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                }
            }));
            menu.Commands.Add(new UICommand("拒绝请求", async(command) =>
            {
                try
                {
                    var user = await FanfouAPI.FanfouAPI.Instance.FriendshipDeny(((sender as UserItemControl).DataContext as User).id);
                    users.Remove((from u in users where u.id == user.id select u).First());
                }
                catch (Exception)
                {
                    Utils.ToastShow.ShowInformation("加载失败,请检查网络");
                }
            }));
            var chosenCommand = await menu.ShowForSelectionAsync(Utils.MenuRect.GetElementRect((FrameworkElement)sender));

            if (chosenCommand == null)
            {
            }
        }
Exemple #2
0
        public void FindAndDelete(Status status)
        {
            var i = from s in statuses where status.id == s.id select s;

            if (i.Count() != 0)
            {
                foreach (var item in i.ToArray())
                {
                    statuses.Remove(item);
                }
            }
            i = from s in mentions where status.id == s.id select s;
            if (i.Count() != 0)
            {
                foreach (var item in i.ToArray())
                {
                    mentions.Remove(item);
                }
            }
        }