Пример #1
0
        private void ExecuteOperation(ThreadTerminator currentTerminator)
        {
            lock(sync)
            {
                MoneyConverterClient wcfClient = new MoneyConverterClient();

                try
                {
                    wcfClient.Open();
                    method.Invoke(wcfClient);
                    wcfClient.Close();

                    currentTerminator.ThrowIfCancellationRequested();
                }
                catch (TimeoutException timeout)
                {
                    JobState.Invoke(jobTimeout);
                    wcfClient.Abort();
                }
                catch (CommunicationException commException)
                {
                    JobState.Invoke(jobCommunicationException);
                    wcfClient.Abort();
                }
            }
        }
Пример #2
0
        private void ExecuteOperation(ThreadTerminator currentTerminator)
        {
            lock (sync)
            {
                MoneyConverterClient wcfClient = new MoneyConverterClient();

                try
                {
                    wcfClient.Open();
                    method.Invoke(wcfClient);
                    wcfClient.Close();

                    currentTerminator.ThrowIfCancellationRequested();
                }
                catch (TimeoutException timeout)
                {
                    JobState.Invoke(jobTimeout);
                    wcfClient.Abort();
                }
                catch (CommunicationException commException)
                {
                    JobState.Invoke(jobCommunicationException);
                    wcfClient.Abort();
                }
            }
        }