Ejemplo n.º 1
0
 public DispatcherMessageQueueThread(string name, Action <Exception> handler)
     : base(name)
 {
     _actionSubject  = new Subject <Action>();
     _actionObserver = _actionSubject;
     _subscription   = _actionSubject
                       //Remove "ObserveOn"
                       //TODO: Need to check whether it can works well.
                       //.ObserveOn(Dispatcher.CurrentDispatcher)
                       .Subscribe(action =>
     {
         try
         {
             //Sync call
             MainSynchronizationContext.Send(action);
         }
         catch (Exception ex)
         {
             RNTracer.Error(ReactConstants.Tag, "[RN_EXCEPTION]At action:[" + ex.ToString() + "]");
             handler(ex);
         }
     });
 }