Exemple #1
0
 private static void ProceedUnregistration(AsyncCallback <bool> callback)
 {
     Backendless.Messaging.UnregisterDeviceOnServer(new AsyncCallback <bool>(response =>
     {
         _currentRegistration = null;
         callback.ResponseHandler.Invoke(response);
     }, fault => callback.ErrorHandler.Invoke(fault)));
 }
Exemple #2
0
 private static void ProceedRegistration( HttpNotificationChannel httpNotificationChannel,
                                          AsyncCallback<string> callback )
 {
   Backendless.Messaging.RegisterDeviceOnServer( httpNotificationChannel.ChannelUri.ToString(),
                                                 new AsyncCallback<string>( response =>
                                                   {
                                                     _currentRegistration =
                                                       new RegistrationDecorator( httpNotificationChannel, response,
                                                                                  DateTime.Now.AddDays( 2 ) );
                                                     callback.ResponseHandler.Invoke( response );
                                                   }, fault => callback.ErrorHandler.Invoke( fault ) ) );
 }
Exemple #3
0
 private static void ProceedRegistration(HttpNotificationChannel httpNotificationChannel,
                                         AsyncCallback <string> callback)
 {
     Backendless.Messaging.RegisterDeviceOnServer(httpNotificationChannel.ChannelUri.ToString(),
                                                  new AsyncCallback <string>(response =>
     {
         _currentRegistration =
             new RegistrationDecorator(httpNotificationChannel, response,
                                       DateTime.Now.AddDays(2));
         callback.ResponseHandler.Invoke(response);
     }, fault => callback.ErrorHandler.Invoke(fault)));
 }
Exemple #4
0
 internal static void UnregisterDevice(AsyncCallback <bool> callback)
 {
     if (_currentRegistration != null &&
         _currentRegistration.GetRegistrationInfo()
         .Channel.ConnectionStatus.Equals(ChannelConnectionStatus.Connected))
     {
         HttpNotificationChannel httpNotificationChannel = _currentRegistration.GetRegistrationInfo().Channel;
         httpNotificationChannel.ConnectionStatusChanged +=
             _onConnectionStatusChangedHandler            = delegate(object sender, NotificationChannelConnectionEventArgs args)
         {
             if (args.ConnectionStatus.Equals(ChannelConnectionStatus.Disconnected))
             {
                 ProceedUnregistration(callback);
                 httpNotificationChannel.ConnectionStatusChanged -= _onConnectionStatusChangedHandler;
             }
         };
         _currentRegistration.GetRegistrationInfo().Channel.Close();
     }
     else
     {
         _currentRegistration = null;
         callback.ResponseHandler.Invoke(true);
     }
 }
Exemple #5
0
 internal static void UnregisterDevice( AsyncCallback<bool> callback )
 {
   if( _currentRegistration != null &&
       _currentRegistration.GetRegistrationInfo()
                           .Channel.ConnectionStatus.Equals( ChannelConnectionStatus.Connected ) )
   {
     HttpNotificationChannel httpNotificationChannel = _currentRegistration.GetRegistrationInfo().Channel;
     httpNotificationChannel.ConnectionStatusChanged +=
       _onConnectionStatusChangedHandler = delegate( object sender, NotificationChannelConnectionEventArgs args )
         {
           if( args.ConnectionStatus.Equals( ChannelConnectionStatus.Disconnected ) )
           {
             ProceedUnregistration( callback );
             httpNotificationChannel.ConnectionStatusChanged -= _onConnectionStatusChangedHandler;
           }
         };
     _currentRegistration.GetRegistrationInfo().Channel.Close();
   }
   else
   {
     _currentRegistration = null;
     callback.ResponseHandler.Invoke(true); 
   }
 }
Exemple #6
0
 private static void ProceedUnregistration( AsyncCallback<bool> callback )
 {
   Backendless.Messaging.UnregisterDeviceOnServer( new AsyncCallback<bool>( response =>
     {
       _currentRegistration = null;
       callback.ResponseHandler.Invoke( response );
     }, fault => callback.ErrorHandler.Invoke( fault ) ) );
 }