Пример #1
0
 private void DeleteButtonTapped(object sender, TappedRoutedEventArgs e)
 {
     try
     {
         if (sender is Ellipse ellipse && ellipse.DataContext is InstaDirectInboxThread thread)
         {
             // delete
             //ItemsSenders.Remove(uc);
             var exists = ItemsSenders.FirstOrDefault(x => x.ThreadId == thread.ThreadId);
             if (exists != null)
             {
                 //if (ItemsSenders.Count> 0)
                 ItemsSenders.Remove(exists);
             }
             var item = Items.FirstOrDefault(u => u.Thread.ThreadId == thread.ThreadId);
             if (item != null && item.Thread.Selected.HasValue && item.Thread.Selected.Value)
             {
                 item.Thread.Selected    = false;
                 item.Thread.CloseButton = false;
             }
             else
             {
                 item = ItemsSearch.FirstOrDefault(u => u.Thread.ThreadId == thread.ThreadId);
                 item.Thread.Selected    = false;
                 item.Thread.CloseButton = false;
             }
             item.UpdateStrokes();
             DoVisible();
         }
     }
     catch { }
 }
Пример #2
0
        private void LVItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                if (e.ClickedItem is UserDialogUc uc)
                {
                    if (uc.Thread.Selected != null)
                    {
                        if (uc.Thread.Selected.Value)
                        {
                            uc.Thread.Selected = false;

                            uc.Thread.CloseButton = false;
                            try
                            {
                                var exists = ItemsSenders.FirstOrDefault(x => x.ThreadId == uc.Thread.ThreadId);
                                if (exists != null)
                                {
                                    //if (ItemsSenders.Count> 0)
                                    ItemsSenders.Remove(exists);
                                }
                            }
                            catch { }
                            uc.UpdateStrokes();
                        }
                        else
                        {
                            uc.Thread.Selected = true;
                            try
                            {
                                ItemsSenders.Add(uc.Thread);
                            }
                            catch { }
                            uc.UpdateStrokes();
                        }
                    }
                    else
                    {
                        uc.Thread.Selected = false;
                        uc.UpdateStrokes();
                    }

                    DoVisible();
                }
            }
            catch { }
        }