Пример #1
0
        private void Init()
        {
            // Load Account Types
            CapitalServiceClient service = service = new CapitalServiceClient();
            try
            {
                IsBusy = true;

                service.GetAccountTypesCompleted += (s, e) =>
                {
                    if (e.Error == null)
                    {
                        if (e.Result != null)
                        {
                            AccountTypes = e.Result;
                        }
                    }
                    else if (e.Error is FaultException<CapitalError>)
                    {
                        ErrorMessages.FaultError(e.Error.Message);
                    }
                    else
                    {
                        ErrorMessages.UnexpectedError();
                    }
                    IsBusy = false;
                };

                service.GetAccountTypesAsync();
            }
            catch (Exception)
            {
                service.Abort();
            }
            finally
            {
                service.CloseAsync();
            }
        }