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))); }
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 ) ) ); }
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))); }
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); } }
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); } }
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 ) ) ); }