Beispiel #1
0
        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var svc = new ReactiveService.LongRunningServiceClient();

            IObservable <string> inputChanges =
                (from keyup in Observable.FromEventPattern <KeyEventArgs>(this.Input, "KeyUp")
                 select Input.Text)
                .Throttle(TimeSpan.FromSeconds(1))
                .ObserveOnDispatcher()
                .Do(val => svc.SortItAsync(val))
            ;

            var svcCompleted = Observable.FromEventPattern <SortItCompletedEventArgs>(svc, "SortItCompleted");

            var results = from change in inputChanges
                          from res in svcCompleted
                          .TakeUntil(inputChanges)
                          select res;

            ObservableCollection <string> resultList = new ObservableCollection <string>();

            destList.ItemsSource = resultList;

            results.ObserveOnDispatcher().Subscribe(res => resultList.Add(res.EventArgs.Result));
        }
Beispiel #2
0
        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var svc = new ReactiveService.LongRunningServiceClient();

            IObservable<string> inputChanges =
               (from keyup in Observable.FromEventPattern<KeyEventArgs>(this.Input, "KeyUp")
                select Input.Text)
               .Throttle(TimeSpan.FromSeconds(1))
               .ObserveOnDispatcher()
               .Do(val => svc.SortItAsync(val))
               ;

            var svcCompleted = Observable.FromEventPattern<SortItCompletedEventArgs>(svc, "SortItCompleted");

            var results = from change in inputChanges
                          from res in svcCompleted
                            .TakeUntil(inputChanges)
                          select res;

            ObservableCollection<string> resultList = new ObservableCollection<string>();
            destList.ItemsSource = resultList;

            results.ObserveOnDispatcher().Subscribe(res => resultList.Add(res.EventArgs.Result));


        }