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


C# ResponseType.ToString方法代码示例

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


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

示例1: 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

示例2: 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

示例3: GetRequestUrl

      public string GetRequestUrl(string requestUrl,double latitude,double longitude,ResponseType responseType)
      {
          if (_postArgumentList == null)
              _postArgumentList = new List<KeyValuePair<string, object>>();

          _postArgumentList.Add(new KeyValuePair<string,object>("lat",latitude));
          _postArgumentList.Add(new KeyValuePair<string, object>("long", longitude));
          _postArgumentList.Add(new KeyValuePair<string, object>("output", responseType.ToString().ToLower()));

          return requestUrl;
      }
开发者ID:rodmanwu,项目名称:dribbble-for-windows-phone-8,代码行数:11,代码来源:DirectLocationHelper.cs

示例4: GetAuthorizeUrl

        public string GetAuthorizeUrl(ResponseType response = ResponseType.Code)
        {
            Dictionary<string, object> config = new Dictionary<string, object>()
            {
                {"client_id",ClientID},
                {"redirect_uri",CallbackUrl},
                {"response_type",response.ToString().ToLower()},
            };
            UriBuilder builder = new UriBuilder(AuthorizeUrl);
            builder.Query = Utility.BuildQueryString(config);

            return builder.ToString();
        }
开发者ID:philfanzhou,项目名称:PredictFuture,代码行数:13,代码来源:OAuth2Client.cs

示例5: GetWeChatOauthUrl

        public string GetWeChatOauthUrl(string requestUrl, string appId, ResponseType responseType, string redirectUrl, 
            string scope = "post_timeline", string state="")
        {
            requestUrl += "oauth";      

            Dictionary<string,object> mergeArgumentDic=new Dictionary<string,object>();
            mergeArgumentDic.Add("appid", appId);
            mergeArgumentDic.Add("response_type", responseType.ToString().ToLower());
            mergeArgumentDic.Add("redirect_uri", redirectUrl);

            mergeArgumentDic.Add("scope", scope);
            mergeArgumentDic.Add("state", state);
            return  base.MergeRequestArgument(requestUrl,mergeArgumentDic);
        }
开发者ID:rodmanwu,项目名称:dribbble-for-windows-phone-8,代码行数:14,代码来源:ShareToWeChatFriendsHelper.cs

示例6: OnCloseSessionsClicked

        /// <summary>
        /// Ferme la session ouverte dans le menu LoginWindow
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        protected void OnCloseSessionsClicked(object sender, EventArgs e)
        {
            MessageDialog md = new MessageDialog (this, DialogFlags.Modal, MessageType.Question,
                                   ButtonsType.YesNo, "Êtes-vous sûr de vouloir fermer la session");
            ResponseType rt = new ResponseType ();
            rt = (ResponseType)md.Run ();

            if (rt.ToString () == "Yes") {
                md.Destroy ();
                this.Destroy ();
                LoginWindow lw = new LoginWindow ();
                lw.Show ();
            } else {
                md.Destroy ();
            }
        }
开发者ID:JeffLabonte,项目名称:MultiLocation,代码行数:21,代码来源:MainWindow.cs

示例7: GetAuthorizeUrl

        public virtual string GetAuthorizeUrl(ResponseType responseType = ResponseType.Code)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Option.AuthorizeUrl);
            List<RequestOption> authorizeOptions = new List<RequestOption>() { 
				new RequestOption(){ Name= "client_id", Value= this.Option.ClientId},
				new RequestOption(){ Name="redirect_uri", Value = this.Option.CallbackUrl},
                new RequestOption(){ Name="response_type", Value = responseType.ToString().ToLower()}
			};
            if (!String.IsNullOrEmpty(this.Option.Display)) authorizeOptions.Add(new RequestOption() { Name = "display", Value = this.Option.Display });
            if (!String.IsNullOrEmpty(this.Option.State)) authorizeOptions.Add(new RequestOption() { Name = "state", Value = this.Option.State });
            if (!String.IsNullOrEmpty(this.Option.Scope)) authorizeOptions.Add(new RequestOption() { Name = "scope", Value = this.Option.Scope });

            List<String> keyValuePairs = new List<String>();
            foreach (var item in authorizeOptions)
            {
                if (item.IsBinary) continue;
                var value = String.Format("{0}", item.Value);
                if (!String.IsNullOrEmpty(value)) keyValuePairs.Add(String.Format("{0}={1}", Uri.EscapeDataString(item.Name), Uri.EscapeDataString(value)));
            }
            uriBuilder.Query = String.Join("&", keyValuePairs.ToArray());
            return uriBuilder.Uri.ToString();
        }
开发者ID:summer-breeze,项目名称:ChengGouHui,代码行数:22,代码来源:OAuthClient.cs

示例8: BuildAuthUri

 /// <summary>
 /// Build authentication link.
 /// </summary>
 /// <param name="instagramOAuthUri">The instagram o authentication URI.</param>
 /// <param name="clientId">The client identifier.</param>
 /// <param name="callbackUri">The callback URI.</param>
 /// <param name="scopes">The scopes.</param>
 /// <param name="responseType">Type of the response.</param>
 /// <returns>The authentication uri</returns>
 private static string BuildAuthUri(string instagramOAuthUri, string clientId, string callbackUri, ResponseType responseType, string scopes)
 {
     return string.Format("{0}?client_id={1}&redirect_uri={2}&response_type={3}&scope={4}", new object[] {
         instagramOAuthUri.ToLower(),
         clientId.ToLower(),
         callbackUri,
         responseType.ToString().ToLower(),
         scopes.ToLower()
     });
 }
开发者ID:Halbent,项目名称:InstaSharp,代码行数:19,代码来源:OAuth.cs

示例9: MessageBuilder

 /// <summary>
 /// Creates a new instance of the <see cref="MessageBuilder"/> class
 /// used to build a response message.
 /// </summary>
 /// <param name="messageType">The <see cref="ResponseType"/> of the message</param>
 public MessageBuilder(ResponseType messageType)
     : this("-" + messageType.ToString(), null, false)
 {
 }
开发者ID:jalsco,项目名称:growl-for-windows-branched,代码行数:9,代码来源:MessageBuilder.cs

示例10: GetAuthorizeURL

        /// <summary>
        /// OAuth2的authorize接口
        /// </summary>
        /// <param name="response">返回类型,支持code、token,默认值为code。</param>
        /// <param name="state">用于保持请求和回调的状态,在回调时,会在Query Parameter中回传该参数。 </param>
        /// <param name="display">授权页面的终端类型,取值见下面的说明。 
        /// default 默认的授权页面,适用于web浏览器。 
        /// mobile 移动终端的授权页面,适用于支持html5的手机。 
        /// popup 弹窗类型的授权页,适用于web浏览器小窗口。 
        /// wap1.2 wap1.2的授权页面。 
        /// wap2.0 wap2.0的授权页面。 
        /// js 微博JS-SDK专用授权页面,弹窗类型,返回结果为JSONP回掉函数。
        /// apponweibo 默认的站内应用授权页,授权后不返回access_token,只刷新站内应用父框架。 
        /// </param>
        /// <returns></returns>
        public string GetAuthorizeURL(ResponseType response= ResponseType.Code,string state=null, DisplayType display = DisplayType.Default)
        {
            Dictionary<string, string> config = new Dictionary<string, string>()
            {
                {"client_id",AppKey},
                {"redirect_uri",CallbackUrl},
                {"response_type",response.ToString().ToLower()},
                {"state",state??string.Empty},
                {"display",display.ToString().ToLower()},
            };
            UriBuilder builder = new UriBuilder(AUTHORIZE_URL);
            builder.Query = Utility.BuildQueryString(config);

            return builder.ToString();
        }
开发者ID:vebin,项目名称:WeiboSdk,代码行数:30,代码来源:OAuth.cs

示例11: BuildAuthUri

        /// <summary>
        /// Build authentication link.
        /// </summary>
        /// <param name="instagramOAuthUri">The instagram o authentication URI.</param>
        /// <param name="clientId">The client identifier.</param>
        /// <param name="callbackUri">The callback URI.</param>
        /// <param name="scopes">The scopes.</param>
        /// <param name="responseType">Type of the response.</param>
        /// <param name="state">Optional parameter to "carry through a server-specific state"</param>
        /// <returns>The authentication uri</returns>
        private static string BuildAuthUri(string instagramOAuthUri, string clientId, string callbackUri, ResponseType responseType, string scopes, string state = null)
        {
            var authUri = string.Format("{0}?client_id={1}&redirect_uri={2}&response_type={3}&scope={4}", new object[] {
                instagramOAuthUri.ToLower(),
                clientId.ToLower(),
                callbackUri,
                responseType.ToString().ToLower(),
                scopes.ToLower()
            });

            if (state != null)
            {
                authUri = $"{authUri}&state={state}";
            }

            return authUri;
        }
开发者ID:jooooel,项目名称:InstaSharp,代码行数:27,代码来源:OAuth.cs

示例12: _urlRequest

        /* COPY OF _request method START  */
        /**
         * Http Get Request
         *
         * @param List<string> request of URL directories.
         * @return List<object> from JSON response.
         */
        private bool _urlRequest(List<string> url_components, ResponseType type, Action<object> usercallback, bool reconnect)
        {
            List<object> result = new List<object>();
            string channelName = getChannelName(url_components, type);

            StringBuilder url = new StringBuilder();

            // Add Origin To The Request
            url.Append(this.ORIGIN);

            // Generate URL with UTF-8 Encoding
            foreach (string url_bit in url_components)
            {
                url.Append("/");
                url.Append(_encodeURIcomponent(url_bit));
            }

            if (type == ResponseType.Presence || type == ResponseType.Subscribe)
            {
                url.Append("?uuid=");
                url.Append(this.sessionUUID);
            }

            if (type == ResponseType.DetailedHistory)
                url.Append(parameters);

            // Temporary fail if string too long
            if (url.Length > this.LIMIT)
            {
                result.Add(0);
                result.Add("Message Too Long.");
                // return result;
            }

            Uri requestUri = new Uri(url.ToString());

            // Force canonical path and query
            string paq = requestUri.PathAndQuery;
            FieldInfo flagsFieldInfo = typeof(Uri).GetField("m_Flags", BindingFlags.Instance | BindingFlags.NonPublic);
            ulong flags = (ulong)flagsFieldInfo.GetValue(requestUri);
            flags &= ~((ulong)0x30); // Flags.PathNotCanonical|Flags.QueryNotCanonical
            flagsFieldInfo.SetValue(requestUri, flags);

            try
            {
                // Create Request
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUri);
                request.Timeout = PUBNUB_WEBREQUEST_CALLBACK_INTERVAL_IN_SEC * 1000;
                if ((!_channelSubscription.ContainsKey(channelName) && type == ResponseType.Subscribe)
                    || (!_channelPresence.ContainsKey(channelName) && type == ResponseType.Presence))
                {
                    if (appSwitch.TraceInfo)
                    {
                        Trace.WriteLine(string.Format("DateTime {0}, Due to Unsubscribe, request aborted for channel={1}", DateTime.Now.ToString(), channelName));
                    }
                    request.Abort();
                }

                if (appSwitch.TraceInfo)
                {
                    Trace.WriteLine(string.Format("DateTime {0}, Request={1}", DateTime.Now.ToString(), requestUri.ToString()));
                }

                RequestState pubnubRequestState = new RequestState();
                pubnubRequestState.request = request;
                pubnubRequestState.channel = channelName;

                if (type == ResponseType.Subscribe || type == ResponseType.Presence)
                {
                    _channelRequest.AddOrUpdate(channelName, pubnubRequestState, (key, oldState) => pubnubRequestState);
                }

                // Make request with the following inline Asynchronous callback
                IAsyncResult asyncResult = request.BeginGetResponse(new AsyncCallback((asynchronousResult) =>
                {
                    try
                    {
                        RequestState asynchRequestState = (RequestState)asynchronousResult.AsyncState;
                        HttpWebRequest aRequest = (HttpWebRequest)asynchRequestState.request;

                        if (aRequest != null)
                        {
                            using (HttpWebResponse aResponse = (HttpWebResponse)aRequest.EndGetResponse(asynchronousResult))
                            {
                                pubnubRequestState.response = aResponse;

                                using (StreamReader streamReader = new StreamReader(aResponse.GetResponseStream()))
                                {
                                    // Deserialize the result
                                    string jsonString = streamReader.ReadToEnd();
                                    streamReader.Close();

                                    heartBeatTimer.Change(
//.........这里部分代码省略.........
开发者ID:orcuna,项目名称:pubnub-api,代码行数:101,代码来源:Pubnub.cs


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