本文整理汇总了C#中System.ComponentModel.MaskedTextProvider.VerifyString方法的典型用法代码示例。如果您正苦于以下问题:C# MaskedTextProvider.VerifyString方法的具体用法?C# MaskedTextProvider.VerifyString怎么用?C# MaskedTextProvider.VerifyString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ComponentModel.MaskedTextProvider
的用法示例。
在下文中一共展示了MaskedTextProvider.VerifyString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsValidDateTimeAccordingMask
/// <summary>
/// Check if the received string value matches with the Introduction Mask for DateTime datatype.
/// </summary>
/// <param name="stringValue">String to be checked.</param>
/// <returns>Returns true if the string matches with Introduction Mask.</returns>
private bool IsValidDateTimeAccordingMask(string stringValue)
{
bool result = true;
if (mMask != string.Empty)
{
MaskedTextProvider maskTextProvider = new MaskedTextProvider(ConvertMask2DisplayMask(mMask));
result = maskTextProvider.VerifyString(stringValue);
}
return result;
}
示例2: VerifyString_string_int_MaskedTextResultHintTest00010
public void VerifyString_string_int_MaskedTextResultHintTest00010 ()
{
MaskedTextProvider mtp;
int Int32_out = 0;
MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
mtp = new MaskedTextProvider (@"abc");
mtp.Add (@"a");
mtp.Add ('\x61');
mtp.Add ('\x61', out Int32_out, out MaskedTextResultHint_out);
Assert.AreEqual (false, mtp.VerifyString (@"a longer string value", out Int32_out, out MaskedTextResultHint_out), "#12");
Assert.AreEqual (MaskedTextResultHint.UnavailableEditPosition, MaskedTextResultHint_out, "#13");
Assert.AreEqual (3, Int32_out, "#14");
MaskedTextProviderTest.AssertProperties (mtp, "VerifyString_string_int_MaskedTextResultHintTest", 15, true, false, 1, 0, CultureInfo.GetCultureInfo ("es-ES"), 1, true, false, false, 0, 3, @"abc", true, true, '\x0', '\x5F', true, true, true, @"abc", @"abc", @"abc", @"abc", @"a", @"abc", @"a");
}
示例3: IsValidStringAccordingMask
/// <summary>
/// Check if the received string value matches with the Introduction Mask for String datatype.
/// </summary>
/// <param name="stringValue">String to be checked.</param>
/// <returns>Returns true if the received string matches with Introduction Mask.</returns>
private bool IsValidStringAccordingMask(string stringValue)
{
bool result = true;
if (Mask != string.Empty)
{
MaskedTextProvider maskTextProvider = new MaskedTextProvider(Mask);
maskTextProvider.IncludeLiterals = false;
maskTextProvider.Set(stringValue);
result = maskTextProvider.VerifyString(stringValue) && maskTextProvider.MaskCompleted;
}
return result;
}
示例4: VerifyString_string_int_MaskedTextResultHintTest00007
public void VerifyString_string_int_MaskedTextResultHintTest00007 ()
{
MaskedTextProvider mtp;
int Int32_out = 0;
MaskedTextResultHint MaskedTextResultHint_out = MaskedTextResultHint.Unknown;
mtp = new MaskedTextProvider (@"abc");
mtp.Add (@"a");
mtp.Add ('\x61');
mtp.Add ('\x61', out Int32_out, out MaskedTextResultHint_out);
Assert.AreEqual (true, mtp.VerifyString (@"a", out Int32_out, out MaskedTextResultHint_out), "#0");
Assert.AreEqual (MaskedTextResultHint.NoEffect, MaskedTextResultHint_out, "#1");
Assert.AreEqual (0, Int32_out, "#2");
MaskedTextProviderTest.AssertProperties (mtp, "VerifyString_string_int_MaskedTextResultHintTest", 3, true, false, 1, 0, CultureInfo.GetCultureInfo ("es-ES"), 1, true, false, false, 0, 3, @"abc", true, true, '\x0', '\x5F', true, true, true, @"abc", @"abc", @"abc", @"abc", @"a", @"abc", @"a");
}
示例5: HasValue
/// <summary>
/// Checks if the editor has value or not.
/// </summary>
/// <returns>Return true if the editor has a value.</returns>
private bool HasValue()
{
bool lResult = true;
if (Mask != null && !Mask.Equals(string.Empty))
{
// Only String and Time data types can have masks in this Presentation. Check them separately.
if (mDataType == ModelType.Time)
{
// Get the Time value without Time separators in order to check if the editor control has value.
string lAuxStringValue = mMaskedTextBoxIT.Text.Replace(mMaskedTextBoxIT.Culture.DateTimeFormat.TimeSeparator, "");
lResult = !string.IsNullOrEmpty(lAuxStringValue.Trim());
}
else
{
// String data type.
MaskedTextProvider maskTextProvider = new MaskedTextProvider(Mask);
maskTextProvider.IncludeLiterals = false;
if (!maskTextProvider.VerifyString(mMaskedTextBoxIT.Text))
{
// If the value assigned to the control does not satisfies the mask,
// check if the editor control Text has value.
lResult = (mMaskedTextBoxIT.Text != string.Empty);
}
else
{
// If the value assigned satisfies the mask
// (it is not mandatory that the mask has been completed),
// assign the value to the MaskTextProvider and then check if
// it has value.
maskTextProvider.Set(mMaskedTextBoxIT.Text);
string auxString = maskTextProvider.ToString(false, false);
lResult = !string.IsNullOrEmpty(auxString);
}
}
}
else
{
lResult = !mMaskedTextBoxIT.Text.Equals(string.Empty);
}
return lResult;
}