Пример #1
0
 private void Window_Deactivated(object sender, EventArgs e)
 {
     AppController.Current.CurrentlyInBackground = true;
     ScrollToItem     = ListOfItems.GetCurrentlyTopmostShownItem();
     TopMostShownItem = ScrollToItem;
     storeTweetMarkerOfCurrentSelectView();
 }
Пример #2
0
        public void ScrollToItemInListbox(IItem item)
        {
            if (item == null)
            {
                return;
            }
            if (lastScrollToTimes.ContainsKey(item.Id))
            {
                DateTime?lastTimeScrolledTo = lastScrollToTimes[item.Id];
                if (lastTimeScrolledTo != null)
                {
                    if (lastTimeScrolledTo.Value.AddSeconds(2) > DateTime.Now)
                    {
                        return;
                    }
                }
            }
            lastScrollToTimes[item.Id] = DateTime.Now;

            //AppController.Current.sendNotification("General", "Scroll to item", item.Text, "", item);
            if (ListOfItems.listView_Tweets.ItemContainerGenerator.Status != System.Windows.Controls.Primitives.GeneratorStatus.GeneratingContainers)
            {
                AppController.Current.Logger.addDebugMessage("Scroll to item", "ItemContainerGenerator is free", item: item, type: DebugMessage.DebugMessageTypes.ScrollIntoView);
                if (!ListOfItems.listView_Tweets.Items.Contains(item))
                {
                    item = ListOfItems.GetCurrentlyTopmostShownItem();
                    AppController.Current.Logger.addDebugMessage("Scroll to item not displayed!", "Initated retrieval of new top item", item: item, type: DebugMessage.DebugMessageTypes.ScrollIntoView);
                }
                if (ListOfItems.listView_Tweets.Items.Count < 2)
                {
                    return;
                }


                ListOfItems.listView_Tweets.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Input, new Action(() =>
                {
                    try
                    {
                        //ttt
                        //ListOfItems.listView_Tweets.ScrollIntoView(ListOfItems.listView_Tweets.Items[ListOfItems.listView_Tweets.Items.Count - 1]);
                        //ListOfItems.listView_Tweets.ScrollIntoView(item);
                    }
                    catch { }
                }));


                ScrollToItem = item;
            }
            else
            {
                AppController.Current.Logger.addDebugMessage("Scroll to item", "ItemContainerGenerator is in use", item: item, type: DebugMessage.DebugMessageTypes.ScrollIntoView);
                if (!ListOfItems.listView_Tweets.Items.Contains(item))
                {
                    item = ListOfItems.GetCurrentlyTopmostShownItem();
                    AppController.Current.Logger.addDebugMessage("Scroll to item not displayed!", "Initated retrieval of new top item", item: item, type: DebugMessage.DebugMessageTypes.ScrollIntoView);
                }
                ScrollToItem = item;
            }
        }
Пример #3
0
 void ItemContainerGenerator_StatusChanged(object sender, EventArgs e)
 {
     if (ScrollToItem != null)
     {
         if (!ListOfItems.listView_Tweets.Items.Contains(ScrollToItem))
         {
             ScrollToItem = ListOfItems.GetCurrentlyTopmostShownItem();
             AppController.Current.Logger.addDebugMessage("Listbox did not contain the CurrentTopMostItem", "Selected new one (if item is empty none has been found", item: ScrollToItem, type: DebugMessage.DebugMessageTypes.ScrollIntoView, view: comboBoxViews.SelectedItem as View);
         }
         if (ScrollToItem != null)
         {
             ScrollToItemInListbox(ScrollToItem);
         }
     }
     ScrollToItem = null;
 }