コード例 #1
0
 private void Subscribe()
 {
     if (_notifier != null)
     {
         _trace.TraceWarning("Callback channel is broken. Try to re-establish ... ");
         _notifier.Closed  -= _delClosed;
         _notifier.Faulted -= _delClosed;
     }
     _notifier          = new InstanceContext(this);
     _notifier.Closed  += _delClosed;
     _notifier.Faulted += _delClosed;
     try
     {
         svc = new MembershipPlusDuplexServiceProxy(_notifier);
         var sub = new SetSubscription
         {
             EntityType   = EntitySetType.SignalRMessage,
             EntityFilter = null
         };
         var qexpr = new QueryExpresion
         {
             FilterTks = new List <QToken>()
         };
         qexpr.FilterTks.Add(new QToken
         {
             TkName = "ApplicationID == \"" + config.App.ID + "\""
         });
         sub.EntityFilter = qexpr;
         var cntx = Cntx;
         svc.SubscribeToUpdates(cntx, cntx.CallerID, cntx.CallerID, new SetSubscription[] { sub });
         _trace.TraceWarning("Subscription done.");
         CallbackFailed = false;
     }
     catch
     {
         _trace.TraceWarning("Subscription failed.");
         CallbackFailed = true;
         // the data service is down ... wait and try again ...
     }
 }
コード例 #2
0
 private void Subscribe()
 {
     if (_notifier != null)
     {
         _trace.TraceWarning("Callback channel is broken. Try to re-establish ... ");
         _notifier.Closed -= _delClosed;
         _notifier.Faulted -= _delClosed;
     }
     _notifier = new InstanceContext(this);
     _notifier.Closed += _delClosed;
     _notifier.Faulted += _delClosed;
     try
     {
         svc = new MembershipPlusDuplexServiceProxy(_notifier);
         svc.SubscribeToUpdates(Cntx.CallerID, new EntitySetType[] { EntitySetType.SignalRMessage });
         _trace.TraceWarning("Subscription done.");
         CallbackFailed = false;
     }
     catch
     {
         _trace.TraceWarning("Subscription failed.");
         CallbackFailed = true;
         // the data service is down ... wait and try again ...
     }
 }
コード例 #3
0
 private void Subscribe()
 {
     if (_notifier != null)
     {
         _trace.TraceWarning("Callback channel is broken. Try to re-establish ... ");
         _notifier.Closed -= _delClosed;
         _notifier.Faulted -= _delClosed;
     }
     _notifier = new InstanceContext(this);
     _notifier.Closed += _delClosed;
     _notifier.Faulted += _delClosed;
     try
     {
         svc = new MembershipPlusDuplexServiceProxy(_notifier);
         var sub = new SetSubscription
         {
             EntityType = EntitySetType.SignalRMessage,
             EntityFilter = null
         };
         var qexpr = new QueryExpresion
         {
             FilterTks = new List<QToken>()
         };
         qexpr.FilterTks.Add(new QToken
         {
             TkName = "ApplicationID == \"" + config.App.ID + "\""
         });
         sub.EntityFilter = qexpr;
         var cntx = Cntx;
         svc.SubscribeToUpdates(cntx, cntx.CallerID, cntx.CallerID, new SetSubscription[] { sub });
         _trace.TraceWarning("Subscription done.");
         CallbackFailed = false;
     }
     catch
     {
         _trace.TraceWarning("Subscription failed.");
         CallbackFailed = true;
         // the data service is down ... wait and try again ...
     }
 }