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


C# InputType.ToString方法代码示例

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


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

示例1: HtmlInput

 public HtmlInput(InputType type, string name, string value)
     : base("input")
 {
     SetAttribut("type", type.ToString());
     SetAttribut("name", name);
     SetAttribut("value", value);
 }
开发者ID:PavloRomanov,项目名称:TrainingProjects,代码行数:7,代码来源:HtmlInput.cs

示例2: HoneyPotField

        /// <summary>
        /// Renders out field with honeypot security check enabled
        /// </summary>
        /// <param name="helper">HtmlHelper which will be extended</param>
        /// <param name="name">Name of field. Should match model field of string type</param>
        /// <param name="value">Value of the field</param>
        /// <param name="css">CSS class to be applied to input field</param>
        /// <returns>Returns render out MvcHtmlString for displaying on the View</returns>
        public static MvcHtmlString HoneyPotField(this HtmlHelper helper, string name, object value, string inputCss = null, InputType fieldType=InputType.Text,string honeypotCss = null, InputType honeypotType=InputType.Hidden)
        {
            StringBuilder sbControlHtml = new StringBuilder();
            using (StringWriter stringWriter = new StringWriter())
            {
                using (HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter))
                {
                    HtmlInputText hashedField = new HtmlInputText(fieldType.ToString().ToLower());
                    string hashedName = GetHashedPropertyName(name);
                    hashedField.Value = value != null ? value.ToString() : string.Empty;
                    hashedField.ID = hashedName;
                    hashedField.Name = hashedName;
                    if (!string.IsNullOrWhiteSpace(inputCss))
                    {
                        hashedField.Attributes["class"] = inputCss;
                    }
                    hashedField.RenderControl(htmlWriter);


                    HtmlInputText hiddenField = new HtmlInputText(honeypotType.ToString().ToLower());
                    hiddenField.Value = string.Empty;
                    hiddenField.ID = name;
                    hiddenField.Name = name;
                    if (!string.IsNullOrWhiteSpace(honeypotCss))
                    {
                        hiddenField.Attributes["class"] = honeypotCss;
                    }
                    hiddenField.RenderControl(htmlWriter);
                    sbControlHtml.Append(stringWriter.ToString());
                }
            }
            return new MvcHtmlString(sbControlHtml.ToString());
        }
开发者ID:dejanstojanovic,项目名称:MVC-Honeypot,代码行数:41,代码来源:HtmlHelpers.cs

示例3: Field

        public static MvcHtmlString Field(this HtmlHelper htmlHelper, string name
            , InputType inputType, string css = null)
        {
            TagBuilder input = GetTag(name, css, "input", "ipt");
            input.Attributes.Add("type", inputType.ToString().ToLower());
            input.Attributes.Add("name", SafeName(name));
            input.Attributes.Add("placeholder", name);

            return MvcHtmlString.Create(input.ToString());
        }
开发者ID:Kakyo,项目名称:XYZ,代码行数:10,代码来源:HtmlHelperExtensions.cs

示例4: PromptCommand

 async Task PromptCommand(InputType inputType)
 {
     var msg = $"Enter a {inputType.ToString().ToUpper()} value";
     this.cancelSrc?.CancelAfter(TimeSpan.FromSeconds(3));
     var r = await this.Dialogs.PromptAsync(msg, inputType: inputType, cancelToken: this.cancelSrc?.Token);
     await Task.Delay(500);
     this.Result(r.Ok
         ? "OK " + r.Text
         : "Prompt Cancelled");
 }
开发者ID:philippd,项目名称:userdialogs,代码行数:10,代码来源:StandardViewModel.cs

示例5: GetInputTypeString

 private static string GetInputTypeString(InputType inputType)
 {
     if (!Enum.IsDefined(typeof(InputType), inputType))
     {
         inputType = InputType.Text;
     }
     return inputType.ToString().ToLowerInvariant();
 }
开发者ID:huangw-t,项目名称:aspnetwebstack,代码行数:8,代码来源:HtmlHelper.Input.cs

示例6: PromptCommand

		async void PromptCommand(InputType inputType) {
			var msg = $"Enter a {inputType.ToString().ToUpper()} value";
			var r = await UserDialogs.Instance.PromptAsync(msg, inputType: inputType);
            this.Result(r.Ok
                ? "OK " + r.Text
                : "Prompt Cancelled");
        }
开发者ID:benoitjadinon,项目名称:userdialogs,代码行数:7,代码来源:MainPage.cs

示例7: PromptCommand

		private async void PromptCommand(InputType inputType) {
			var msg = String.Format("Enter a {0} value", inputType.ToString().ToUpper());
			var r = await UserDialogs.Instance.PromptAsync(msg, inputType: inputType);
            this.lblResult.Text = r.Ok
                ? "OK " + r.Text
                : "Prompt Cancelled";
        }
开发者ID:vvolkgang,项目名称:userdialogs,代码行数:7,代码来源:MainPage.cs

示例8: InputTypeChange

 public InputTypeChange(InputType input)
 {
     this.parameters.Add(input.ToString().PadLeft(2, '0'));
 }
开发者ID:zzattack,项目名称:pioneer-avr-lib,代码行数:4,代码来源:Messages.cs

示例9: AcceptInput

 public void AcceptInput(InputType it, string input = "")
 {
     HandleMessage(new Message(this,this,Message.Type.INPUT,it.ToString() + (input.Length > 0 ? ':' + input:"")));
 }
开发者ID:TerraPass,项目名称:ATM,代码行数:4,代码来源:ATM.cs

示例10: SetAdapter

 public void SetAdapter(InputType inputType)
 {
     switch (inputType) {
       case InputType.KeyboardMouse:
     Adapter = new KeyboardMouseAdapter();
     break;
       case InputType.Xbox360Controller:
     Adapter = new Xbox360ControllerAdapter();
     break;
       default:
     throw new ArgumentException("Unexpected InputType value: " + inputType.ToString());
       }
 }
开发者ID:comp380team3,项目名称:PuzzlePathDimension,代码行数:13,代码来源:InputComponent.cs


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