private void ClearHistory() { history.Clear(); actualHistoryItem = null; backButton.IsEnabled = false; HomeCommand.ChangeCanExecute(); ClearCacheCommand.ChangeCanExecute(); }
private bool PopHistoryItem() { if (history.Count >= 1) { HistoryItem item = history.Last(); switch (item.Type) { case HistoryType.Search: Search((string)item.Value, false); break; case HistoryType.Number: ShowByNumber((int)item.Value, false); break; case HistoryType.Key: ShowByKey((string)item.Value, false); break; case HistoryType.Random: ShowRandomRule((int?)item.Value, false); break; } /*list.UpdateLayout(); * ScrollViewer scrollViewer = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(list, 0), 0) as ScrollViewer; * scrollViewer?.ChangeView(null, item.VerticalOffset, null, true);*/ //list.ScrollTo(item.Value, ScrollToPosition.Center, true); //list.SelectedItem = item.Value; history.RemoveAt(history.Count() - 1); actualHistoryItem = item; backButton.IsEnabled = history.Count > 0; HomeCommand.ChangeCanExecute(); return(true); } return(false); }
private void PushHistoryItem(HistoryItem historyItem) { /*SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = * AppViewBackButtonVisibility.Visible; * ScrollViewer scrollViewer = * VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(list, 0), 0) as ScrollViewer; * if (scrollViewer != null) * actualSearch.VerticalOffset = scrollViewer.VerticalOffset;*/ if (actualHistoryItem == null || historyItem == null || (!actualHistoryItem.Type.Equals(historyItem.Type) || !actualHistoryItem.Value.Equals(historyItem.Value))) { if (actualHistoryItem != null) { history.Add(actualHistoryItem); backButton.IsEnabled = true; } actualHistoryItem = historyItem; HomeCommand.ChangeCanExecute(); } }