Exemplo n.º 1
0
        public virtual async Task <GetMagentoInfoResponse> GetMagentoInfoAsync(bool suppressException, Mark mark = null)
        {
            try
            {
                const int maxCheckCount    = 2;
                const int delayBeforeCheck = 1800000;

                var res           = new magentoInfoResponse();
                var privateClient = this._clientFactory.GetClient();

                await ActionPolicies.GetWithMarkAsync(mark).Do(async() =>
                {
                    var statusChecker = new StatusChecker(maxCheckCount);
                    TimerCallback tcb = statusChecker.CheckStatus;

                    privateClient = this._clientFactory.RefreshClient(privateClient);
                    var sessionId = await this.GetSessionId().ConfigureAwait(false);

                    using (var stateTimer = new Timer(tcb, privateClient, 1000, delayBeforeCheck))
                        res = await privateClient.magentoInfoAsync(sessionId.SessionId).ConfigureAwait(false);
                }).ConfigureAwait(false);

                return(new GetMagentoInfoResponse(res, this.GetServiceVersion()));
            }
            catch (Exception exc)
            {
                if (suppressException)
                {
                    return(null);
                }
                throw new MagentoSoapException(string.Format("An error occured during GetMagentoInfoAsync()"), exc);
            }
        }
Exemplo n.º 2
0
        public virtual async Task <GetMagentoInfoResponse> GetMagentoInfoAsync(bool suppressException)
        {
            try
            {
                const int maxCheckCount    = 2;
                const int delayBeforeCheck = 1800000;

                var res           = new magentoInfoResponse();
                var privateClient = this.CreateMagentoServiceClient(this.BaseMagentoUrl);

                await ActionPolicies.GetAsync.Do(async() =>
                {
                    var statusChecker = new StatusChecker(maxCheckCount);
                    TimerCallback tcb = statusChecker.CheckStatus;

                    if (privateClient.State != CommunicationState.Opened &&
                        privateClient.State != CommunicationState.Created &&
                        privateClient.State != CommunicationState.Opening)
                    {
                        privateClient = this.CreateMagentoServiceClient(this.BaseMagentoUrl);
                    }

                    var sessionId = await this.GetSessionId().ConfigureAwait(false);

                    using (var stateTimer = new Timer(tcb, privateClient, 1000, delayBeforeCheck))
                        res = await privateClient.magentoInfoAsync(sessionId.SessionId).ConfigureAwait(false);
                }).ConfigureAwait(false);

                return(new GetMagentoInfoResponse(res));
            }
            catch (Exception exc)
            {
                if (suppressException)
                {
                    return(null);
                }
                throw new MagentoSoapException(string.Format("An error occured during GetMagentoInfoAsync()"), exc);
            }
        }
 public GetMagentoInfoResponse(magentoInfoResponse res, string serviceVersion)
 {
     this.MagentoEdition = res.result.magento_edition;
     this.MagentoVersion = res.result.magento_version;
     this.ServiceVersion = serviceVersion;
 }
Exemplo n.º 4
0
 public GetMagentoInfoResponse(magentoInfoResponse res)
 {
     this.MagentoEdition = res.result.magento_edition;
     this.MagentoVersion = res.result.magento_version;
 }