• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IWebClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IWebClient的典型用法代码示例。如果您正苦于以下问题:C# IWebClient类的具体用法?C# IWebClient怎么用?C# IWebClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IWebClient类属于命名空间,在下文中一共展示了IWebClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TwitterAccountProvider

        public TwitterAccountProvider(IWebClient webClient, UserCredential userCredential)
            :base(webClient)
        {
            if (userCredential.AccessToken == null)
            {
                throw new ArgumentException("TwitterAccountProvider didn't receive AccessToken");
            }
            if (userCredential.AccessTokenSecret == null)
            {
                throw new ArgumentException("TwitterAccountProvider didn't receive AccessTokenSecret");
            }
            if (userCredential.ConsumerKey == null)
            {
                throw new ArgumentException("TwitterAccountProvider didn't receive ConsumerKey");
            }
            if (userCredential.ConsumerSecret == null)
            {
                throw new ArgumentException("TwitterAccountProvider didn't receive ConsumerSecret");
            }

            _accessToken = userCredential.AccessToken;
            _accessTokenSecret = userCredential.AccessTokenSecret;
            _consumerKey = userCredential.ConsumerKey;
            _consumerSecret = userCredential.ConsumerSecret;
        }
开发者ID:IhorSyerkov,项目名称:Azimuth,代码行数:25,代码来源:TwitterAccountProvider.cs


示例2: WebQueueValidator

 public WebQueueValidator(Uri managementUri, IWebTokenProvider tokenProvider, IWebClient webClient)
 {
     _managementUri = managementUri;
     _webClient = webClient;
     _requestFactory = new WebRequestFactory(tokenProvider);
     _uriCreator = new UriCreator(managementUri);
 }
开发者ID:nordvall,项目名称:letterbox,代码行数:7,代码来源:WebQueueValidator.cs


示例3: TryDownloadAsync

        async Task TryDownloadAsync(TransferSpec spec, IWebClient webClient, IAbsoluteFilePath tmpFile) {
            try {
                tmpFile.RemoveReadonlyWhenExists();
                if (!string.IsNullOrWhiteSpace(spec.Uri.UserInfo))
                    webClient.SetAuthInfo(spec.Uri);
                using (webClient.HandleCancellationToken(spec))
                    await webClient.DownloadFileTaskAsync(spec.Uri, tmpFile.ToString()).ConfigureAwait(false);
                VerifyIfNeeded(spec, tmpFile);
                _fileOps.Move(tmpFile, spec.LocalFile);
            } catch (OperationCanceledException e) {
                _fileOps.DeleteIfExists(tmpFile.ToString());
                throw CreateTimeoutException(spec, e);
            } catch (WebException ex) {
                _fileOps.DeleteIfExists(tmpFile.ToString());
                var cancelledEx = ex.InnerException as OperationCanceledException;
                if (cancelledEx != null)
                    throw CreateTimeoutException(spec, cancelledEx);
                if (ex.Status == WebExceptionStatus.RequestCanceled)
                    throw CreateTimeoutException(spec, ex);

                var response = ex.Response as HttpWebResponse;
                if (response == null)
                    throw GenerateDownloadException(spec, ex);

                switch (response.StatusCode) {
                case HttpStatusCode.NotFound:
                    throw new RequestFailedException("Received a 404: NotFound response", ex);
                case HttpStatusCode.Forbidden:
                    throw new RequestFailedException("Received a 403: Forbidden response", ex);
                case HttpStatusCode.Unauthorized:
                    throw new RequestFailedException("Received a 401: Unauthorized response", ex);
                }
                throw GenerateDownloadException(spec, ex);
            }
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:35,代码来源:HttpDownloadProtocol.cs


示例4: Setup

        public void Setup()
        {
            // Query to facebook api
            UserInfoUrl = String.Format(@"https://graph.facebook.com/v2.0/me?access_token={0}&fields=id,first_name,last_name,name,gender,email,birthday,timezone,location,picture.type(large)",
                    AccessToken);

            // Object that we will make Json
            _fbUserData = new FacebookUserData
            {
                Id = "12345",
                FirstName = "Beseda",
                LastName = "Dmitrij",
                Name = "Beseda Dmitrij",
                Gender = "male",
                Email = "[email protected]",
                Birthday = "12/1/1992",
                Timqzone = 2,
                Location = new FacebookUserData.FbLocation() {Id = "1", Name = "Donetsk, Ukraine"},
                Picture = new FacebookUserData.FbPicture()
                {
                    Data = new FacebookUserData.Data
                    {
                        Url = "photo.jpg"
                    }
                },
            };

            _userToJson = JsonConvert.SerializeObject(_fbUserData);

            _webRequest = Substitute.For<IWebClient>();
            _webRequest.GetWebData(UserInfoUrl).Returns(Task.FromResult(_userToJson));
        }
开发者ID:B1naryStudio,项目名称:Azimuth,代码行数:32,代码来源:FacebookAccountProviderTests.cs


示例5: RssPlugin

 public RssPlugin(IBitTorrentEngine torrentEngine, IDataRepository dataRepository, ITimerFactory timerFactory, IWebClient webClient)
 {
     _torrentEngine = torrentEngine;
     _dataRepository = dataRepository;
     _timer = timerFactory.CreateTimer();
     _webClient = webClient;
 }
开发者ID:randacc,项目名称:hdkn,代码行数:7,代码来源:RssPlugin.cs


示例6: Setup

        public void Setup()
        {
            client = Substitute.For<IWebClient>();
            client.Download().Returns(downloadStringResult);

            target = new WebRequestBuilder(client);
        }
开发者ID:ianchute,项目名称:OWiki,代码行数:7,代码来源:WebRequestBuilderTests.cs


示例7: SetUp

 public void SetUp()
 {
     _mockWebClient = MockRepository.GenerateStub<IWebClient>();
     var uri = new Uri("http://valid");
     _uri = uri.ToString();
     _resolver = new HttpProjectXmlResolver(uri) { WebClient = _mockWebClient };
 }
开发者ID:asednev,项目名称:bigvisiblecruise,代码行数:7,代码来源:HttpProjectResolver_Tests.cs


示例8: HtmlForm

        /// <summary>
        /// Initializes a new instance of the <see cref="HtmlForm"/> class.
        /// </summary>
        /// <param name="webClient">Contains the web client to be used to request and submit the form.</param>
        protected HtmlForm( IWebClient webClient )
        {
            WebClient = webClient;

            Attributes = new Dictionary<string, string>( StringComparer.OrdinalIgnoreCase );
            Controls = new List<HtmlFormControl>();
        }
开发者ID:quamotion,项目名称:NScrape,代码行数:11,代码来源:HtmlForm.cs


示例9: CypherClientFactory

 public CypherClientFactory(string baseUri, IWebClient webClient, IWebSerializer serializer, IEntityCache entityCache)
 {
     this._baseUri = baseUri;
     this._webClient = webClient;
     this._serializer = serializer;
     this._entityCache = entityCache;
 }
开发者ID:dgmachado,项目名称:CypherNet,代码行数:7,代码来源:CypherClientFactory.cs


示例10: ApplyConstraint

 public void ApplyConstraint(IWebClient client)
 {
     foreach (var constraint in Constraints)
     {
         constraint.ApplyConstraint(client);
     }
 }
开发者ID:brianhartsock,项目名称:powershell-rackspaceapps,代码行数:7,代码来源:MacroConstraint.cs


示例11: SetUp

        public void SetUp()
        {
            // Query to VK api
            UserInfoUrl = String.Format(
                @"https://api.vk.com/method/users.get?user_id={0}&fields=screen_name,bdate,sex,city,country,photo_max_orig,timezone&v=5.23&access_token={1}",
                UserId,
                AccessToken);

            // Object that we will make Json
            _vkUserData = new VkUserData.VkResponse
            {
                Response = new List<VkUserData>
                {
                    new VkUserData
                    {
                        FirstName = "Beseda",
                        LastName = "Dmitrij",
                        ScreenName = "Beseda Dmitrij",
                        Sex = VkUserData.VkSex.Male,
                        Birthday = "12/1/1992",
                        City = new VkUserData.VkCity {Id = 1, Title = "Donetsk"},
                        Country = new VkUserData.VkCountry {Id = 1, Title = "Ukraine"},
                        Timezone = 2,
                        Photo = "photo.jpg",
                        Email = Email
                    }
                }
            };

            // Make Json
            _userToJson = JsonConvert.SerializeObject(_vkUserData);

            _webRequest = Substitute.For<IWebClient>();
            _webRequest.GetWebData(UserInfoUrl).Returns(Task.FromResult(_userToJson));
        }
开发者ID:IhorSyerkov,项目名称:Azimuth,代码行数:35,代码来源:VKAccountProviderTests.cs


示例12: Setup

        public void Setup()
        {
            client = Substitute.For<IWebClient>();
            client.Headers.Returns(new WebHeaderCollection());

            target = new WebServiceBuilder(client);
        }
开发者ID:ianchute,项目名称:OWiki,代码行数:7,代码来源:WebServiceBuilderTests.cs


示例13: BuildDataFetcher

        public BuildDataFetcher(ViewUrl viewUrl, IConfigSettings configSettings,
								IWebClientFactory webClientFactory)
        {
            _viewUrl = viewUrl;
            _webClientFactory = webClientFactory;
            _webClient = webClientFactory.GetWebClient(configSettings.URL);
            configSettings.AddObserver(this);
        }
开发者ID:PandaWood,项目名称:Cradiator,代码行数:8,代码来源:BuildDataFetcher.cs


示例14: BurritoDayModel

        public BurritoDayModel(IFiber fiber, IWebClient client)
        {
            this.fiber = fiber;
            this.client = client;

            this.fiber.ScheduleOnInterval(this.PollState, 0,
                (long)this.interval.TotalMilliseconds);
        }
开发者ID:ataranto,项目名称:tepeyac,代码行数:8,代码来源:BurritoDayModel.cs


示例15: ServiceBusClient

 public ServiceBusClient(Uri address, IWebTokenProvider tokenManager, IWebClient webClient)
 {
     _address = address;
     _tokenManager = tokenManager;
     _webClient = webClient;
     _webRequestFactory = new WebRequestFactory(tokenManager);
     _serializer = new MessageSerializer();
 }
开发者ID:nordvall,项目名称:letterbox,代码行数:8,代码来源:ServiceBusClient.cs


示例16: EpisodeDownloader

 public EpisodeDownloader(ITvService service, ISearchProvider searchProvider, IWebClient webClient, TorrentSearchSettings settings, IAnalyticsService analyticsService)
 {
     _service = service;
     _searchProvider = searchProvider;
     _webClient = webClient;
     _settings = settings;
     _analyticsService = analyticsService;
 }
开发者ID:wamplerj,项目名称:TVTamer,代码行数:8,代码来源:EpisodeDownloader.cs


示例17: JiraClient

        public JiraClient(IWebClient webClient, Func<IJiraRequestUrlBuilder> builderFactory)
        {
            ArgumentUtility.CheckNotNull ("webClient", webClient);
              ArgumentUtility.CheckNotNull ("builderFactory", builderFactory);

              _webClient = webClient;
              _builderFactory = builderFactory;
        }
开发者ID:re-motion,项目名称:BuildTools,代码行数:8,代码来源:JiraClient.cs


示例18: BuildDataFetcher

        public BuildDataFetcher(CruiseAddress cruiseAddress, IConfigSettings configSettings,
		                        IWebClientFactory webClientFactory)
        {
            _cruiseAddress = cruiseAddress;
            _webClientFactory = webClientFactory;
            _webClient = webClientFactory.GetWebClient(configSettings.URL);
            configSettings.AddObserver(this);
        }
开发者ID:xerxesb,项目名称:cradiator,代码行数:8,代码来源:BuildDataFetcher.cs


示例19: CustomMembershipProvider

        public CustomMembershipProvider()
        {
            _virtualOfficeService = new VirtualOfficeService();
            var resolver = DependencyResolver.Current;

            _webClient = (IWebClient)resolver.GetService(typeof(IWebClient));
            _apiKey = "abc";
            _apiSecret = "asdfasdfadfa";
        }
开发者ID:hansel0691,项目名称:VirtualOffice,代码行数:9,代码来源:CustomMembershipProvider.cs


示例20: KickassSearchProvider

        public KickassSearchProvider(ISearchProvider nextProvider, IWebClient webClient, IAnalyticsService analyticsService)
        {
            if(nextProvider == null)
                throw new ArgumentNullException(nameof(nextProvider), "nextProvider Cannot be null");

            NextSearchProvider = nextProvider;
            _webClient = webClient;
            _analyticsService = analyticsService;
        }
开发者ID:wamplerj,项目名称:TVTamer,代码行数:9,代码来源:KickassSearchProvider.cs



注:本文中的IWebClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IWebContext类代码示例发布时间:2022-05-24
下一篇:
C# IWebBrowser2类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap