当前位置: 首页>>代码示例>>C#>>正文


C# RequestData类代码示例

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


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

示例1: AddListen

 public void AddListen(String Request, RequestData rd)
 {
     modelData md = new modelData();
     md.Request = Request;
     md.rd = rd;
     listmode.Add(md);
 }
开发者ID:yang190637133,项目名称:communication,代码行数:7,代码来源:_base_Helper.cs

示例2: Request

        public Task<ResponseData> Request(RequestData request, CancellationToken token)
        {
            this.EnsureIsRunning();

            var requestId = this.NextId();

            var callback = new TaskCompletionSource<ResponseData>();
            this.requestCallbacks[requestId] = callback;

            Task.Run(() =>
            {
                var zmqRequest = new ZmqRequest(requestId, request);
                var zmqRequestBytes = zmqRequest.ToBinary();

                this.requestsQueue.TryAdd(zmqRequestBytes);
            });

            if (token != CancellationToken.None)
            {
                token.Register(() =>
                {
                    TaskCompletionSource<ResponseData> _;
                    this.requestCallbacks.TryRemove(requestId, out _);
                });
            }

            return callback.Task;
        }
开发者ID:yonglehou,项目名称:ServiceProxy,代码行数:28,代码来源:ZmqClient.cs

示例3: GetSitecoreData

        private RequestData GetSitecoreData()
        {
            var data = new RequestData();

            data.Add(DataKey.Request, GetRequest());
            data.Add(DataKey.Diagnostics, GetDiagnostics());
            data.Add(DataKey.PageMode, GetPageMode());
            data.Add(DataKey.Culture, GetCulture());
            data.Add(DataKey.Language, GetLanguage());
            data.Add(DataKey.Domain, GetDomain());
            data.Add(DataKey.Device, GetDevice());
            data.Add(DataKey.User, GetUser());
            data.Add(DataKey.Database, GetDatabase());
            data.Add(DataKey.Site, GetSite());
            data.Add(DataKey.ItemVisualization, GetItemVisualization());
            data.Add(DataKey.ItemTemplate, GetItemTemplate());
            data.Add(DataKey.Item, GetItem());
            data.Add(DataKey.VersionInfo, GetVersionInfo());
            data.Add(DataKey.License, GetLicense());
            data.Add(DataKey.Services, _serviceClients.ToArray());
            data.Add(DataKey.Controllers, _controllers.ToArray());
            data.Add(DataKey.UserList, _users.ToArray());

            return data;
        }
开发者ID:gitter-badger,项目名称:Sitecore.Glimpse,代码行数:25,代码来源:SitecoreRequest.cs

示例4: AddEqualToDataAttr

        public void AddEqualToDataAttr(IEnumerable<PropertyValidatorResult> propertyValidators, HtmlTag htmlTag, RequestData request)
        {
            var result = propertyValidators.FirstOrDefault(x => x.PropertyValidator is EqualValidator);
            if (result != null)
            {
                var equal = result.PropertyValidator.As<EqualValidator>();
                MessageFormatter formatter = new MessageFormatter()
                    .AppendPropertyName(result.DisplayName)
                    .AppendArgument("ComparisonValue", equal.ValueToCompare);

                string message = formatter.BuildMessage(equal.ErrorMessageSource.GetString());

                if (_msUnobtrusive)
                {
                    htmlTag.Data("val", true);
                    htmlTag.Data("val-equalto", message);
                    if (request.Accessor.PropertyNames.Length > 1)
                        htmlTag.Data("val-equalto-other", request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.MemberToCompare.Name);
                    else
                        htmlTag.Data("val-equalto-other", "*." + equal.MemberToCompare.Name);
                }
                else
                {
                    htmlTag.Data("msg-equalto", message);
                    if (request.Accessor.PropertyNames.Length > 1)
                        htmlTag.Data("rule-equalto", "#" + request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.MemberToCompare.Name);
                    else
                        htmlTag.Data("rule-equalto", "#" + equal.MemberToCompare.Name);
                }
            }
        }
开发者ID:eByte23,项目名称:SchoStack,代码行数:31,代码来源:FluentValidationHtmlConventions.cs

示例5: ServeWebRequest

 public bool ServeWebRequest(RawRequestData aRawRequest, IWebRequestResponder aResponder)
 {
     string browserClass = aRawRequest.Cookies["xappbrowser"].FirstOrDefault();
     if (String.IsNullOrEmpty(browserClass) &&
         aRawRequest.Path.PathSegments.Count == 0)
     {
         //Console.WriteLine("Serving browser discrimination page.");
         Console.WriteLine("Serve {0} with discriminator.", String.Join("/", aRawRequest.Path.PathSegments));
         aResponder.SendPage("200 OK", PageSource.MakeSourceFromString(StringType.Html, IndexPage));
         return true;
     }
     string userName = aRawRequest.Cookies["xappuser"].FirstOrDefault();
     User user = null;
     if (!String.IsNullOrEmpty(userName))
     {
         iUserList.TryGetUserById(userName, out user);
     }
     RequestData requestData = new RequestData(aRawRequest.Path, aRawRequest.Method, user, browserClass);
     if (user == null)
     {
         Console.WriteLine("Serve {0} from login app.", String.Join("/", aRawRequest.Path.PathSegments));
         return iLoginApp.ServeWebRequest(requestData, aResponder);
     }
     Console.WriteLine("Serve {0} from base app.", String.Join("/", aRawRequest.Path.PathSegments));
     return iBaseApp.ServeWebRequest(requestData, aResponder);
 }
开发者ID:weeble,项目名称:ohos,代码行数:26,代码来源:UserAndBrowserFilter.cs

示例6: Request

        public Task<ResponseData> Request(RequestData request, CancellationToken _)
        {
            var cancellation = new CancellationTokenSource(this.timeout);

            var responseTask = this.client.Request(request, cancellation.Token);

            var completion = new TaskCompletionSource<ResponseData>();

            //when the token reaches timeout, tries to set the timeoutResponse as the result
            //if the responseTask already completed, this is ignored
            cancellation.Token.Register(() => completion.TrySetResult(this.timeoutResponse));

            //when the responseTask completes, tries to apply its exception/result properties as long as the timeout isn't reached
            responseTask.ContinueWith(t =>
            {
                if (!cancellation.IsCancellationRequested)
                {
                    if (responseTask.Exception != null)
                    {
                        completion.TrySetException(responseTask.Exception.InnerException);
                    }
                    else
                    {
                        completion.TrySetResult(responseTask.Result);
                    }
                }
            });

            return completion.Task;
        }
开发者ID:yonglehou,项目名称:ServiceProxy,代码行数:30,代码来源:TimeoutClient.cs

示例7: Execute

        // Remote Handler
        // Key information of interest here is the Parameters array, each
        // entry represents an element of the URI, with element zero being
        // the

        public void Execute(RequestData rdata)
        {
            if (!enabled) return;

            // If we can't relate to what's there, leave it for others.

            if (rdata.Parameters.Length == 0 || rdata.Parameters[PARM_TESTID] != "remote")
                return;

            Rest.Log.DebugFormat("{0} REST Remote handler ENTRY", MsgId);

            // Remove the prefix and what's left are the parameters. If we don't have
            // the parameters we need, fail the request. Parameters do NOT include
            // any supplied query values.

            if (rdata.Parameters.Length > 1)
            {
                switch (rdata.Parameters[PARM_COMMAND].ToLower())
                {
                    case "move" :
                        DoMove(rdata);
                        break;
                    default :
                        DoHelp(rdata);
                        break;
                }
            }
            else
            {
                DoHelp(rdata);
            }
        }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:37,代码来源:Remote.cs

示例8: Request

        public Task<ResponseData> Request(RequestData request, CancellationToken token)
        {
            var svc = this.serviceFactory.CreateService(request.Service);
            var responseTask = svc.Process(request);

            return responseTask;
        }
开发者ID:29795113,项目名称:ServiceProxy,代码行数:7,代码来源:SimpleClient.cs

示例9: open

        public void open(JObject options, ICallback callback)
        {
            if (options != null)
            {
                var requestData = new RequestData
                {
                    Title = options.Value<string>("title"),
                    Text = options.Value<string>("share_text"),
                    Url = options.Value<string>("share_URL"),
                };

                if (requestData.Text == null && requestData.Title == null && requestData.Url == null)
                {
                    return;
                }

                RunOnDispatcher(() =>
                {
                    lock (_queue)
                    {
                        _queue.Enqueue(requestData);
                    }

                    try
                    {
                        DataTransferManager.ShowShareUI();
                        callback.Invoke("OK");
                    }
                    catch
                    {
                        callback.Invoke("not_available");
                    }
                });
            }
        }
开发者ID:EstebanFuentealba,项目名称:react-native-share,代码行数:35,代码来源:RNShareModule.cs

示例10: AddEqualToDataAttr

 public void AddEqualToDataAttr(IEnumerable<ValidationAttribute> propertyValidators, HtmlTag htmlTag, RequestData request)
 {
     var equal = propertyValidators.OfType<CompareAttribute>().FirstOrDefault();
     if (equal != null)
     {
         var formatErrorMessage = equal.FormatErrorMessage(request.Accessor.Name);
         if (_msUnobtrusive)
         {
             htmlTag.Data("val", true);
             htmlTag.Data("val-equalto", formatErrorMessage);
             if (request.Accessor.PropertyNames.Length > 1)
             {
                 htmlTag.Data("val-equalto-other", request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.OtherProperty);
             }
             else
             {
                 htmlTag.Data("val-equalto-other", "*." + equal.OtherProperty);
             }
         }
         else
         {
             htmlTag.Data("msg-equalto", formatErrorMessage);
             if (request.Accessor.PropertyNames.Length > 1)
                 htmlTag.Data("rule-equalto", "#" + request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.OtherProperty);
             else
                 htmlTag.Data("rule-equalto", "#" + equal.OtherProperty);
         }
     }
 }
开发者ID:eByte23,项目名称:SchoStack,代码行数:29,代码来源:DataAnnotationValidationHtmlConventions.cs

示例11: DownloadEventArgs

 public DownloadEventArgs(string fileLocation, Guid taskGuid, RequestData request, string errorDescription = null)
 {
     FileLocation = fileLocation;
     TaskGuid = taskGuid;
     ErrorDescription = errorDescription;
     Request = request;
 }
开发者ID:StorozhenkoDmitry,项目名称:SimpleHttp,代码行数:7,代码来源:DownloadEventArgs.cs

示例12: BuildOAuthHeader

		private string BuildOAuthHeader(RequestData requestData, string fullUrl, IDictionary<string, string> parameters, RequestPayload requestBody)
		{
			var httpMethod = requestData.HttpMethod.ToString().ToUpperInvariant();

			var oauthRequest = new OAuthRequest
				{
					Type = OAuthRequestType.ProtectedResource,
					RequestUrl = fullUrl,
					Method = httpMethod,
					ConsumerKey = _oAuthCredentials.ConsumerKey,
					ConsumerSecret = _oAuthCredentials.ConsumerSecret,
				};

			if (!string.IsNullOrEmpty(requestData.OAuthToken))
			{
				oauthRequest.Token = requestData.OAuthToken;
				oauthRequest.TokenSecret = requestData.OAuthTokenSecret;
			}

			if (ShouldReadParamsFromBody(parameters, requestBody))
			{
				var bodyParams = HttpUtility.ParseQueryString(requestBody.Data);
				var keys = bodyParams.AllKeys.Where(x => !string.IsNullOrEmpty(x));
				foreach (var key in keys)
				{
					parameters.Add(key, bodyParams[key]);
				}
			}

			return oauthRequest.GetAuthorizationHeader(parameters);
		}
开发者ID:AnthonySteele,项目名称:SevenDigital.Api.Wrapper,代码行数:31,代码来源:RequestBuilder.cs

示例13: HandleGetRequest

        public override void HandleGetRequest(HttpProcessor p)
        {
            Log.Debug(@"request: {0}", p.HttpUrl);

            LastRequestData = new RequestData(p.HttpMethod, p.HttpUrl, p.HttpProtocolVersionstring, p.HttpHeaders);

            SendResponse(p);
        }
开发者ID:alexey-kadyrov,项目名称:DocaLabs-Utils,代码行数:8,代码来源:TestHttpServer.cs

示例14: SetUp

        public void SetUp()
        {
            dictionary = new Dictionary<string, object>();
            aggregate = new AggregateDictionary();
            aggregate.AddLocator(RequestDataSource.Route, key => dictionary.ContainsKey(key) ? dictionary[key] : null);

            request = new RequestData(aggregate);
        }
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:8,代码来源:RequestDataTester.cs

示例15: SetUp

        public void SetUp()
        {
            dictionary = new Dictionary<string, object>();
            aggregate = new AggregateDictionary();
            aggregate.AddDictionary(dictionary);

            request = new RequestData(aggregate);
        }
开发者ID:henninga,项目名称:fubumvc,代码行数:8,代码来源:RequestDataTester.cs


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