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


C# Functions.ToString方法代码示例

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


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

示例1: GetButton

 public Button GetButton(Functions funcName)
 {
     var fields = _element.GetFields(typeof(IButton));
     if (fields.Count == 1)
         return (Button) fields[0].GetValue(_element);
     var buttons = fields.Select(f => (Button) f.GetValue(_element)).ToList();
     var button = buttons.FirstOrDefault(b => b.Function.Equals(funcName));
     if (button != null) return button;
     var name = funcName.ToString();
     button = buttons.FirstOrDefault(b => NamesEqual(ToButton(b.Name), ToButton(name)));
     if (button == null)
         throw Exception($"Can't find button '{name}' for Element '{ToString()}'");
     return button;
 }
开发者ID:epam,项目名称:JDI,代码行数:14,代码来源:GetElementClass.cs

示例2: Method

        public JObject Method(Functions funcName, JObject request, MethodCheckRequestParameters check)
        {
            if (!string.IsNullOrEmpty(Token)) request[FieldKeyword.Token] = Token;
            if (!string.IsNullOrEmpty(Language)) request[FieldKeyword.Language] = Language;
            JObject response = new JObject();
            if (ServerAddr==null|| request == null || (check != null && !check(request)))
            {
                response[FieldKeyword.Success] = false;
                response[FieldKeyword.CommonError] = ErrorNumber.CommonBadParameter.ToString();
                return response;
            }

            var webBinding = new WebHttpBinding();
            webBinding.AllowCookies = true;
            webBinding.MaxReceivedMessageSize = 1000 * 1024 * 1024;
            webBinding.ReaderQuotas.MaxStringContentLength = 1000 * 1024 * 1024;
            webBinding.SendTimeout = new TimeSpan(0, 500, 0);
            webBinding.ReceiveTimeout = new TimeSpan(0, 500, 0);

            using (var factory = new WebChannelFactory<IService>(webBinding, ServerAddr))
            {
                factory.Endpoint.Behaviors.Add(new WebHttpBehavior());
                var session = factory.CreateChannel();
                if (session == null || (session as IContextChannel)==null)
                {
                    response[FieldKeyword.Success] = false;
                    response[FieldKeyword.CommonError] = ErrorNumber.CommonBadContext.ToString();
                }
                else
                    using (OperationContextScope scope = new OperationContextScope(session as IContextChannel))
                    {
                        var temp = request.ToString();
                        Stream stream = new MemoryStream(KORT.Util.Tools.GZipCompress(Encoding.UTF8.GetBytes(temp)));
                        System.Diagnostics.Debug.WriteLine(request.ToString());
                        try
                        {
                            using (var responseStream = session.Method(funcName.ToString(), stream))
                            {
                                using (var decompressStream = new MemoryStream())
                                {
                                    KORT.Util.Tools.GZipDecompress(responseStream, decompressStream);
                                    decompressStream.Position = 0;
                                    StreamReader reader = new StreamReader(decompressStream, Encoding.UTF8);
                                    string text = reader.ReadToEnd();
                                    System.Diagnostics.Debug.WriteLine(text);
                                    response = JObject.Parse(text);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            System.Diagnostics.Debug.WriteLine(e.Message);
                            response[FieldKeyword.Success] = false;
                            response[FieldKeyword.CommonError] = ErrorNumber.Other.ToString();
                            response[FieldKeyword.ErrorDetail] = e.Message;
                        }
                    }
                return response;
            }
        }
开发者ID:jovijovi,项目名称:kort,代码行数:60,代码来源:KORTClient.cs

示例3: GetMessage

 public static string GetMessage(Functions function, string language)
 {
     return GetMessage(function.ToString(), language);
 }
开发者ID:jovijovi,项目名称:kort,代码行数:4,代码来源:ErrorNumber.cs

示例4: Post

        private Response Post(Functions function, String payload)
        {
            HttpWebRequest request = GetHttpWebRequest(webMethod.POST, String.Format(addrTinkerAPICallFunction, this.CoreID, function.ToString()), payload);

            object jsonObj = GetHttpWebResponseAsJSONData(request, typeof(Response));
            Response jsonResponse = jsonObj as Response;

            // check for not connected
            if (jsonResponse.Connected == false)
            {
                throw new ApplicationException("SparkCore not connected.");
            }

            return jsonResponse;
        }
开发者ID:yonglehou,项目名称:SparkIODotNet,代码行数:15,代码来源:TinkerAPI.cs


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