Refresh() private method

private Refresh ( ) : void
return void
Ejemplo n.º 1
0
 public MainAndFilterPage()
 {
     InitializeComponent();
     var allStationsView = new CollectionViewSource { Source = Stations.GetAll() }.View;
     allStationsView.Filter = x => Filter(filter.Text, fromStation, excludeStation, (Station)x);
     allStations.ItemsSource = allStationsView;
     Observable.FromEvent<TextChangedEventArgs>(filter, "TextChanged")
         .Throttle(TimeSpan.FromMilliseconds(300))
         .Subscribe(_ => Dispatcher.BeginInvoke(() => allStationsView.Refresh()));
     Observable.FromEvent<KeyEventArgs>(filter, "KeyDown")
         .Where(x => x.EventArgs.Key == Key.Enter)
         .Subscribe(_ => Dispatcher.BeginInvoke(() =>
         {
             var stations = allStationsView.Cast<Station>().ToArray();
             if (stations.Length == 1)
             {
                 GoToStation(stations[0]);
             }
         }));
     CommonApplicationBarItems.Init(this);
 }
Ejemplo n.º 2
0
		public void RefreshEmitsCurrentChangingEvents()
		{
			var events = new List<CurrentChangingEventArgs>();
			var data = new List<object> {
				"First",
				"Second",
				"Third",
				"Fourth",
				"Fifth",
			};

			var view = new CollectionViewSource() { Source = data }.View;
			view.CurrentChanging += (o, e) => events.Add(e);

			view.Refresh();
			Assert.AreEqual(1, events.Count, "#1");

			view.Refresh();
			Assert.AreEqual(2, events.Count, "#2");
		}