public Task PublishAsync(IMobileServiceEvent mobileServiceEvent)
        {
            if (mobileServiceEvent == null)
            {
                throw new ArgumentNullException("mobileServiceEvent");
            }

            return(Task.Run(() =>
            {
                TypeInfo messageType = mobileServiceEvent.GetType().GetTypeInfo();

                this.subscriptionLock.EnterReadLock();

                IList <ISubscription> subscriptionMatches = null;

                try
                {
                    subscriptionMatches = this.subscriptions.Where(s => s.TargetMessageType.GetTypeInfo()
                                                                   .IsAssignableFrom(messageType)).ToList();
                }
                finally
                {
                    this.subscriptionLock.ExitReadLock();
                }

                foreach (var subscription in subscriptionMatches)
                {
                    subscription.OnNext(mobileServiceEvent);
                }
            }));
        }
        public Task PublishAsync(IMobileServiceEvent mobileServiceEvent)
        {
            Arguments.IsNotNull(mobileServiceEvent, nameof(mobileServiceEvent));

            return(Task.Run(() =>
            {
                TypeInfo messageType = mobileServiceEvent.GetType().GetTypeInfo();
                subscriptionLock.EnterReadLock();
                IList <ISubscription> subscriptionMatches = null;
                try
                {
                    subscriptionMatches = subscriptions.Where(s => s.TargetMessageType.GetTypeInfo().IsAssignableFrom(messageType)).ToList();
                }
                finally
                {
                    subscriptionLock.ExitReadLock();
                }

                foreach (var subscription in subscriptionMatches)
                {
                    subscription.OnNext(mobileServiceEvent);
                }
            }));
        }
 public async Task PublishAsync(IMobileServiceEvent mobileServiceEvent)
 {
     await PublishAsyncFunc(mobileServiceEvent);
 }
 internal static void BackgroundPublish(this IMobileServiceEventManager manager, IMobileServiceEvent mobileServiceEvent)
 {
     manager.PublishAsync(mobileServiceEvent)
     .ContinueWith(t => t.Exception.Handle(e => true), TaskContinuationOptions.OnlyOnFaulted);
 }
 internal static void BackgroundPublish(this IMobileServiceEventManager manager, IMobileServiceEvent mobileServiceEvent)
 {
     manager.PublishAsync(mobileServiceEvent)
         .ContinueWith(t => t.Exception.Handle(e => true), TaskContinuationOptions.OnlyOnFaulted);
 }
 public void OnNext(IMobileServiceEvent mobileServiceEvent)
 {
     this.observer.OnNext((T)mobileServiceEvent);
 }
 public void OnNext(IMobileServiceEvent value)
 {
     this.next((T)value);
 }
 private void GeneralEventHandler(IMobileServiceEvent mobileServiceEvent)
 {
     Debug.WriteLine("Event handled: " + mobileServiceEvent.Name);
 }
Exemple #9
0
 private void GeneralEventHandler(IMobileServiceEvent mobileServiceEvent)
 {
     Debug.WriteLine("Event handled: " + mobileServiceEvent.Name);
 }