Beispiel #1
0
        private static void Free(byte id)
        {
            var notificationManager = new Client.NotificationManager();

            try
            {
                notificationManager.Free(id);
                notificationManager.Close();
            }
#pragma warning disable 168
            catch (FaultException faultException)
#pragma warning restore 168
            {
                notificationManager.Abort();
                throw new ServerUnavailableException("Notification Server is unavailable.", faultException);
            }
#pragma warning disable 168
            catch (CommunicationException communicationException)
#pragma warning restore 168
            {
                notificationManager.Abort();
                throw new ServerUnavailableException("Notification Server is unavailable.", communicationException);
            }
#pragma warning disable 168
            catch (TimeoutException timeoutException)
#pragma warning restore 168
            {
                notificationManager.Abort();
                throw new ServerUnavailableException("Notification Server is unavailable.", timeoutException);
            }
        }
Beispiel #2
0
        private static Notification Reserve()
        {
            Contract.Ensures(Contract.Result <Notification>() != null);

            var notificationManager = new Client.NotificationManager();

            try
            {
                var slot = notificationManager.Reserve(SystemParameters.WorkArea);
                notificationManager.Close();
                return(slot);
            }
#pragma warning disable 168
            catch (FaultException faultException)
#pragma warning restore 168
            {
                notificationManager.Abort();
                throw new ServerUnavailableException("Notification Server is unavailable.", faultException);
            }
#pragma warning disable 168
            catch (CommunicationException communicationException)
#pragma warning restore 168
            {
                notificationManager.Abort();
                throw new ServerUnavailableException("Notification Server is unavailable.", communicationException);
            }
#pragma warning disable 168
            catch (TimeoutException timeoutException)
#pragma warning restore 168
            {
                notificationManager.Abort();
                throw new ServerUnavailableException("Notification Server is unavailable.", timeoutException);
            }
        }