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


C# ResponseType类代码示例

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


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

示例1: TSResponse

 public TSResponse(XmlElement element)
 {
     type = (ResponseType)Enum.Parse(typeof(ResponseType), element.GetAttribute("type"), false);
     XmlNodeList l = element.GetElementsByTagName("tuple");
     id = element.GetAttribute("id");
     tuples = new Tuple[l.Count];
     for (int i = 0; i < l.Count; i++)
     {
         XmlElement elTuple = (XmlElement)l[i];
         tuples[i] = new Tuple(elTuple);
     }
 }
开发者ID:pepipe,项目名称:ISEL,代码行数:12,代码来源:TSResponse.cs

示例2: OnBtnSendClicked

		protected void OnBtnSendClicked (object sender, EventArgs e)
		{
			Response = ResponseType.Accept;
			this.UserDescription = textview1.Buffer.Text;
			this.HideAll ();
			Send (ex, sv);
		}
开发者ID:squarerootfury,项目名称:ExceptionBase.NET-GTKSharp,代码行数:7,代码来源:UserDetails.cs

示例3: HttpWorker

        public HttpWorker(Uri uri, HttpMethod httpMethod = HttpMethod.Get, Dictionary<string, string> headers = null, byte[] data = null)
        {
            _buffer = new byte[8192];
            _bufferIndex = 0;
            _read = 0;
            _responseType = ResponseType.Unknown;
            _uri = uri;
            IPAddress ip;
            var headersString = string.Empty;
            var contentLength = data != null ? data.Length : 0;

            if (headers != null && headers.Any())
                headersString = string.Concat(headers.Select(h => "\r\n" + h.Key.Trim() + ": " + h.Value.Trim()));

            if (_uri.HostNameType == UriHostNameType.Dns)
            {
                var host = Dns.GetHostEntry(_uri.Host);
                ip = host.AddressList.First(i => i.AddressFamily == AddressFamily.InterNetwork);
            }
            else
            {
                ip = IPAddress.Parse(_uri.Host);
            }

            _endPoint = new IPEndPoint(ip, _uri.Port);
            _request = Encoding.UTF8.GetBytes($"{httpMethod.ToString().ToUpper()} {_uri.PathAndQuery} HTTP/1.1\r\nAccept-Encoding: gzip, deflate, sdch\r\nHost: {_uri.Host}\r\nContent-Length: {contentLength}{headersString}\r\n\r\n");

            if (data == null)
                return;

            var tmpRequest = new byte[_request.Length + data.Length];
            Buffer.BlockCopy(_request, 0, tmpRequest, 0, _request.Length);
            Buffer.BlockCopy(data, 0, tmpRequest, _request.Length, data.Length);
            _request = tmpRequest;
        }
开发者ID:evest,项目名称:Netling,代码行数:35,代码来源:HttpWorker.cs

示例4: ResponseEvent

		/// <summary>
		///   建構子
		/// </summary>
		/// <param name="tradeOrder">訂單資訊</param>
		/// <param name="symbolId">商品代號</param>
		/// <param name="type">回報類型</param>
		/// <param name="openTrades">開倉交易單列表</param>
		/// <param name="closeTrades">已平倉交易單列表</param>
		public ResponseEvent(ITradeOrder tradeOrder, string symbolId, ResponseType type, TradeList<ITrade> openTrades, List<ITrade> closeTrades) {
			__cTradeOrder = tradeOrder;
			__sSymbolId = symbolId;
			__cType = type;
			__cOpenTrades = openTrades;
			__cCloseTrades = closeTrades;
		}
开发者ID:Zeghs,项目名称:ZeroSystem,代码行数:15,代码来源:ResponseEvent.cs

示例5: Service

        public static object Service(this Uri url, RequestType requestType, ResponseType responseType, out int resultCode, string outputFilename, IDictionary<string, string> formData) {
            object result = null;
            resultCode = -1;

            var webRequest = (HttpWebRequest)WebRequest.Create(url);
            webRequest.Proxy = GetProxy();

            webRequest.CookieContainer = Cookies.GetCookieContainer();

            switch (requestType) {
                case RequestType.POST:
                    webRequest.Method = "POST";
                    webRequest.ContentType = "application/x-www-form-urlencoded";

                    var encodedFormData = Encoding.UTF8.GetBytes(GetFormData(formData).ToString());
                    using (var requestStream = webRequest.GetRequestStream()) {
                        requestStream.Write(encodedFormData, 0, encodedFormData.Length);
                    }
                    break;
                case RequestType.GET:
                    webRequest.Method = "GET";
                    if (formData != null) {
                        var ub = new UriBuilder(url) {
                            Query = GetFormData(formData).ToString()
                        };
                        url = ub.Uri;
                    }
                    break;
            }

            try {
                if (credentialCache != null) {
                    webRequest.Credentials = credentialCache;
                    webRequest.PreAuthenticate = true;
                }
                var webResponse = webRequest.GetResponse();

                if (!KeepCookiesClean) {
                    Cookies.AddCookies(webRequest.CookieContainer.GetCookies(webResponse.ResponseUri));
                }

                switch (responseType) {
                    case ResponseType.String:
                        result = GetStringResponse(webResponse);
                        resultCode = 200;
                        break;
                    case ResponseType.Binary:
                        result = GetBinaryResponse(webResponse);
                        resultCode = 200;
                        break;
                    case ResponseType.File:
                        result = GetBinaryFileResponse(webResponse, outputFilename);
                        resultCode = 200;
                        break;
                }
            } catch {
                resultCode = 0;
            }
            return result;
        }
开发者ID:roomaroo,项目名称:coapp.powershell,代码行数:60,代码来源:WebExtensions.cs

示例6: OnResponse

        protected override void OnResponse(ResponseType response_id)
        {
            base.OnResponse (response_id);

            if (response_id == ResponseType.Cancel)
                this.Destroy();
        }
开发者ID:mtanski,项目名称:drapes,代码行数:7,代码来源:About.cs

示例7: ResponseElement

		/// <summary>
		/// Creates a new response object with the given XML representation.
		/// </summary>
		/// <param name="xml">XML representation of this response</param>
		public ResponseElement(XmlNode xml) : base(xml)
		{ 
			switch(xml.Name)
			{
				case "success":
					type = ResponseType.Success;
					break;
				case "failure":
					type = ResponseType.Failure;
					break;
				case "stream:error":
					type = ResponseType.StreamError;
					break;
				case "starttls":
					type = ResponseType.StartTls;
					break;
				case "proceed":
					type = ResponseType.ProceedTls;
					break;
				case "challenge":
					type = ResponseType.SaslChallenge;
					break;
				case "response":
					type = ResponseType.SaslResponse;
					break;
				default:
					throw new OpenXMPPException("An unknown response element was received.");
			}
		}
开发者ID:rahulaga,项目名称:irahul.com,代码行数:33,代码来源:ResponseElement.cs

示例8: OnLoginResponse

 private void OnLoginResponse(ResponseType responseType, JToken responseData, string callee) {
     if (responseType == ResponseType.Success) {
         authenticationToken = responseData.Value<string>("token");
         if (OnLoggedIn != null) {
             OnLoggedIn();
         }
     } else if (responseType == ResponseType.ClientError) {
         if (OnLoginFailed != null) {
             OnLoginFailed("Could not reach the server. Please try again later.");
         }
     } else {
         JToken fieldToken = responseData["non_field_errors"];
         if (fieldToken == null || !fieldToken.HasValues) {
             if (OnLoginFailed != null) {
                 OnLoginFailed("Login failed: unknown error.");
             }
         } else {
             string errors = "";
             JToken[] fieldValidationErrors = fieldToken.Values().ToArray();
             foreach (JToken validationError in fieldValidationErrors) {
                 errors += validationError.Value<string>();
             }
             if (OnLoginFailed != null) {
                 OnLoginFailed("Login failed: " + errors);
             }
         }
     }
 }
开发者ID:chrisdrogaris,项目名称:django-unity3d-example,代码行数:28,代码来源:ExampleBackend.cs

示例9: NetCommand

 //RESPONSE
 public NetCommand(ResponseType response, int session)
 {
     Type = CommandType.RESPONSE;
     Session = session;
     Timestamp = Helper.Now;
     Response = response;
 }
开发者ID:Aaldert,项目名称:IP2,代码行数:8,代码来源:NetCommand.cs

示例10: BuildAuthorizeUrl

        /// <summary>
        /// Constructs an authorize url.
        /// </summary>
        public static string BuildAuthorizeUrl(
            string clientId, 
            string redirectUrl, 
            IEnumerable<string> scopes, 
            ResponseType responseType,
            DisplayType display,
            ThemeType theme,
            string locale,
            string state)
        {
            Debug.Assert(!string.IsNullOrEmpty(clientId));
            Debug.Assert(!string.IsNullOrEmpty(redirectUrl));
            Debug.Assert(!string.IsNullOrEmpty(locale));

            IDictionary<string, string> options = new Dictionary<string, string>();
            options[AuthConstants.ClientId] = clientId;
            options[AuthConstants.Callback] = redirectUrl;
            options[AuthConstants.Scope] = BuildScopeString(scopes);
            options[AuthConstants.ResponseType] = responseType.ToString().ToLowerInvariant();
            options[AuthConstants.Display] = display.ToString().ToLowerInvariant();
            options[AuthConstants.Locale] = locale;
            options[AuthConstants.ClientState] = EncodeAppRequestState(state);

            if (theme != ThemeType.None)
            {
                options[AuthConstants.Theme] = theme.ToString().ToLowerInvariant();
            }

            return BuildAuthUrl(AuthEndpointsInfo.AuthorizePath, options);
        }
开发者ID:d20021,项目名称:LiveSDK-for-Windows,代码行数:33,代码来源:LiveAuthUtility.cs

示例11: OnResponse

        protected override void OnResponse (ResponseType response)
        {
            base.OnResponse (response);

            if (CurrentFolderUri != null) {
                LastFileChooserUri.Set (CurrentFolderUri);
            }
        }
开发者ID:allquixotic,项目名称:banshee-gst-sharp-work,代码行数:8,代码来源:FileChooserDialog.cs

示例12: OnResponse

 protected override void OnResponse(ResponseType response)
 {
     if (response == ResponseType.Ok) {
         int timervalue = sleepHour.ValueAsInt * 60 + sleepMin.ValueAsInt;
         service.SleepTimerDuration = timervalue;
         service.SetSleepTimer (timervalue);
     }
 }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:8,代码来源:SleepTimerConfigDialog.cs

示例13: AssessmentItem

 /// <summary>
 /// Constructor that accepts values for all mandatory fields
 /// </summary>
 ///<param name="refId">A RefId</param>
 ///<param name="assessmentFormRefId">This RefId points to the assessment form of which the item is a part.</param>
 ///<param name="responseType">A value that indicates the response type for the item.</param>
 ///<param name="itemLabel">An item number or other identifier for the item.  It may be used to indicate the order or grouping of items.</param>
 ///
 public AssessmentItem( string refId, string assessmentFormRefId, ResponseType responseType, string itemLabel )
     : base(Adk.SifVersion, AssessmentDTD.ASSESSMENTITEM)
 {
     this.RefId = refId;
     this.AssessmentFormRefId = assessmentFormRefId;
     this.SetResponseType( responseType );
     this.ItemLabel = itemLabel;
 }
开发者ID:pgodwin,项目名称:OpenADK-csharp,代码行数:16,代码来源:AssessmentItem.cs

示例14: OnResponse

        protected override void OnResponse(ResponseType response)
        {
            base.OnResponse (response);

            if (response == ResponseType.Help)
                Help.DisplayUriOnScreen ("ghelp:questar/preferences",
                    base.Dialog.Screen);
        }
开发者ID:manicolosi,项目名称:questar,代码行数:8,代码来源:PreferenceDialog.cs

示例15: BuildAuthenticateUri

 protected Uri BuildAuthenticateUri(AuthenticationPermissions scope, ResponseType responseType)
 {
     var builder = new HttpUriBuilder(AuthenticationUrl);
     builder.AddQueryStringParameter("client_id", this.ClientId);
     builder.AddQueryStringParameter("response_type", responseType.ToString().ToLower());
     builder.AddQueryStringParameter("scope", scope.GetParameterValue());
     builder.AddQueryStringParameter("redirect_uri", RedirectUri);
     return builder.Build();
 }
开发者ID:Cologler,项目名称:Jasily.SDK.OneDrive,代码行数:9,代码来源:Authenticator.cs


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