本文整理汇总了C#中Validator.SetRule方法的典型用法代码示例。如果您正苦于以下问题:C# Validator.SetRule方法的具体用法?C# Validator.SetRule怎么用?C# Validator.SetRule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validator
的用法示例。
在下文中一共展示了Validator.SetRule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Summary
//step 2
private void Summary()
{
Client c = this.InnerClient;
c.Name = this.NameEntry.Text;
c.Surname = this.SurnameEntry.Text;
c.Address = this.AddressEntry.Text;
c.PhoneNumber = this.PhoneEntry.Text;
c.Email = this.EmailEntry.Text;
Validator v = new Validator();
v.SetRule(c.Name, "<Nombre>", 2, 50, ValidationRule.Required);
v.SetRule(c.Surname, "<Apellido>", 2, 50, ValidationRule.Required);
v.SetRule(c.Address, "<Dirección>", 0, 100);
v.SetRule(c.PhoneNumber, "<Teléfono>", ValidationRule.Number);
v.SetRule(c.Email, "<E-mail>", ValidationRule.Email);
ValidationResponse r = v.Run();
if(!r.Status)
{
string msg = string.Empty;
for(int i = 0; i < r.Messages.Length; msg += r.Messages[i++] + Environment.NewLine);
GuiHelper.ShowMessage(this, msg);
this.Step -= 1;
return;
}
//if everything is ok let's show the resume
this.ClearContentBox();
this.Description = "Se dará de alta al siguiente cliente:";
this.PackWidgetSingle(new Label(this.InnerClient.ToString()));
this.ContentVBox.ShowAll();
this.NextLabel = "Aceptar";
}