Exemplo n.º 1
0
        public ExchangeSyncService(string serverUri)
        {
            if (string.IsNullOrEmpty(serverUri))
            {
                throw new ArgumentNullException("serverUri");
            }

            this.serverUri      = serverUri;
            this.requestBuilder = new WebRequestDefaultBuilder();
        }
Exemplo n.º 2
0
        private async Task <ToodleDoApiCallResult> DownloadDataAsync(string apiCall, string password = null)
        {
            if (this.isCanceled)
            {
                this.isCanceled = false;
                throw new OperationCanceledException();
            }

            try
            {
                var requestBuilder = new WebRequestDefaultBuilder();

                string response = await requestBuilder.GetAsync(apiCall);

                string message = apiCall;
                if (!string.IsNullOrEmpty(password))
                {
                    message = apiCall.Replace(password, "***password***");
                }
                if (!string.IsNullOrEmpty(this.Key))
                {
                    message = apiCall.Replace(this.Key, "***key***");
                }

                this.LogDebugFormat("ToodleDoService: launching request to: {0}", message);

                return(this.ProcessResponse(apiCall, response));
            }
            catch (Exception e)
            {
                if (this.OnWebException != null)
                {
                    this.OnWebException(this, new EventArgs <Exception>(e));
                }

                return(new ToodleDoApiCallResult(apiCall, e.Message));
            }
        }