本文整理汇总了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);
}
示例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());
}
示例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());
}
示例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");
}
示例5: GetInputTypeString
private static string GetInputTypeString(InputType inputType)
{
if (!Enum.IsDefined(typeof(InputType), inputType))
{
inputType = InputType.Text;
}
return inputType.ToString().ToLowerInvariant();
}
示例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");
}
示例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";
}
示例8: InputTypeChange
public InputTypeChange(InputType input)
{
this.parameters.Add(input.ToString().PadLeft(2, '0'));
}
示例9: AcceptInput
public void AcceptInput(InputType it, string input = "")
{
HandleMessage(new Message(this,this,Message.Type.INPUT,it.ToString() + (input.Length > 0 ? ':' + input:"")));
}
示例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());
}
}