1
votes

Is it possible to add an Rx event handling method to wp7 ApplicationBar item. I tried the below mentioned code but getting a null reference exception. Please help me to avoid this issue.

 var res = Observable.FromEvent<EventArgs>(button1, "Click")
              .SubscribeOn(Scheduler.ThreadPool)
              .Throttle(TimeSpan.FromMilliseconds(230))
              .Subscribe(

                 _ => {
                     ++i;
                     Debug.WriteLine("Clicked{0}", i);

                 }

              );
1
"but getting a null reference exception" at the time you are doing this, Scheduler or Scheduler.ThreadPool or some other bit of the puzzle is null. You have to figure that part out (call stack, inner exceptions usually help). Solution: Do it later. - user1228

1 Answers

-1
votes

Try using FromEventPattern rather than FromEvent.