optimized performance

This commit is contained in:
NaBian committed 2020-06-28 22:39:27 +08:00
1 parent c407997a3c
commit 3162267795
65 files changed
+168 -168

No files matched your search

@@ -169,7 +169,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool)GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -220,7 +220,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool)GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -339,7 +339,7 @@ namespace HandyControl.Controls
public bool AutoComplete
{
get => (bool)GetValue(AutoCompleteProperty);
set => SetValue(AutoCompleteProperty, value);
set => SetValue(AutoCompleteProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -51,7 +51,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ErrorStrProperty = DependencyProperty.Register(
@@ -78,7 +78,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
public virtual bool VerifyData()
@@ -153,7 +153,7 @@ namespace HandyControl.Controls
public bool IsDropDownOpen
{
get => (bool) GetValue(IsDropDownOpenProperty);
set => SetValue(IsDropDownOpenProperty, value);
set => SetValue(IsDropDownOpenProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty SelectedDateTimeProperty = DependencyProperty.Register(
@@ -238,7 +238,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ErrorStrProperty = DependencyProperty.Register(
@@ -265,7 +265,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
#endregion
@@ -120,7 +120,7 @@ namespace HandyControl.Controls
public bool HasValue
{
get => (bool) GetValue(HasValueProperty);
set => SetValue(HasValueProperty, value);
set => SetValue(HasValueProperty, ValueBoxes.BooleanBox(value));
}
}
}
@@ -321,7 +321,7 @@ namespace HandyControl.Controls
internal bool ShowUpDownButton
{
get => (bool)GetValue(ShowUpDownButtonProperty);
set => SetValue(ShowUpDownButtonProperty, value);
set => SetValue(ShowUpDownButtonProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -333,7 +333,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool)GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -372,7 +372,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool)GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -387,7 +387,7 @@ namespace HandyControl.Controls
public bool IsReadOnly
{
get => (bool)GetValue(IsReadOnlyProperty);
set => SetValue(IsReadOnlyProperty, value);
set => SetValue(IsReadOnlyProperty, ValueBoxes.BooleanBox(value));
}
public Func<string, OperationResult<bool>> VerifyFunc { get; set; }
@@ -20,6 +20,11 @@ namespace HandyControl.Controls
private const string ElementTextBox = "PART_TextBox";
private SecureString _password;
private System.Windows.Controls.TextBox _textBox;
/// <summary>
/// 掩码字符
/// </summary>
@@ -27,46 +32,81 @@ namespace HandyControl.Controls
System.Windows.Controls.PasswordBox.PasswordCharProperty.AddOwner(typeof(PasswordBox),
new FrameworkPropertyMetadata('●'));
public char PasswordChar
{
get => (char)GetValue(PasswordCharProperty);
set => SetValue(PasswordCharProperty, value);
}
/// <summary>
/// 数据是否错误
/// </summary>
public static readonly DependencyProperty IsErrorProperty = DependencyProperty.Register(
"IsError", typeof(bool), typeof(PasswordBox), new PropertyMetadata(ValueBoxes.FalseBox));
public bool IsError
{
get => (bool)GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
/// 错误提示
/// </summary>
public static readonly DependencyProperty ErrorStrProperty = DependencyProperty.Register(
"ErrorStr", typeof(string), typeof(PasswordBox), new PropertyMetadata(default(string)));
public string ErrorStr
{
get => (string)GetValue(ErrorStrProperty);
set => SetValue(ErrorStrProperty, value);
}
/// <summary>
/// 文本类型
/// </summary>
public static readonly DependencyProperty TextTypeProperty = DependencyProperty.Register(
"TextType", typeof(TextType), typeof(PasswordBox), new PropertyMetadata(default(TextType)));
public TextType TextType
{
get => (TextType)GetValue(TextTypeProperty);
set => SetValue(TextTypeProperty, value);
}
/// <summary>
/// 是否显示清除按钮
/// </summary>
public static readonly DependencyProperty ShowClearButtonProperty = DependencyProperty.Register(
"ShowClearButton", typeof(bool), typeof(PasswordBox), new PropertyMetadata(ValueBoxes.FalseBox));
public bool ShowClearButton
{
get => (bool)GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ShowEyeButtonProperty = DependencyProperty.Register(
"ShowEyeButton", typeof(bool), typeof(PasswordBox), new PropertyMetadata(ValueBoxes.FalseBox));
public bool ShowEyeButton
{
get => (bool)GetValue(ShowEyeButtonProperty);
set => SetValue(ShowEyeButtonProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ShowPasswordProperty = DependencyProperty.Register(
"ShowPassword", typeof(bool), typeof(PasswordBox),
new PropertyMetadata(ValueBoxes.FalseBox, OnShowPasswordChanged));
private SecureString _password;
private System.Windows.Controls.TextBox _textBox;
public PasswordBox()
public bool ShowPassword
{
CommandBindings.Add(new CommandBinding(ControlCommands.Clear, (s, e) => Clear()));
get => (bool)GetValue(ShowPasswordProperty);
set => SetValue(ShowPasswordProperty, ValueBoxes.BooleanBox(value));
}
public PasswordBox() => CommandBindings.Add(new CommandBinding(ControlCommands.Clear, (s, e) => Clear()));
public System.Windows.Controls.PasswordBox ActualPasswordBox { get; set; }
[DefaultValue("")]
@@ -101,50 +141,8 @@ namespace HandyControl.Controls
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public SecureString SecurePassword => ActualPasswordBox?.SecurePassword;
public char PasswordChar
{
get => (char) GetValue(PasswordCharProperty);
set => SetValue(PasswordCharProperty, value);
}
public bool ShowEyeButton
{
get => (bool) GetValue(ShowEyeButtonProperty);
set => SetValue(ShowEyeButtonProperty, value);
}
public bool ShowPassword
{
get => (bool) GetValue(ShowPasswordProperty);
set => SetValue(ShowPasswordProperty, value);
}
public Func<string, OperationResult<bool>> VerifyFunc { get; set; }
public bool IsError
{
get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
}
public string ErrorStr
{
get => (string) GetValue(ErrorStrProperty);
set => SetValue(ErrorStrProperty, value);
}
public TextType TextType
{
get => (TextType) GetValue(TextTypeProperty);
set => SetValue(TextTypeProperty, value);
}
public bool ShowClearButton
{
get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
}
public virtual bool VerifyData()
{
OperationResult<bool> result;
@@ -77,7 +77,7 @@ namespace HandyControl.Controls
public bool IsRealTime
{
get => (bool)GetValue(IsRealTimeProperty);
set => SetValue(IsRealTimeProperty, value);
set => SetValue(IsRealTimeProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(
@@ -36,7 +36,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool) GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
/// <summary>
@@ -72,7 +72,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool) GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
public virtual bool VerifyData()
@@ -130,7 +130,7 @@ namespace HandyControl.Controls
public bool IsDropDownOpen
{
get => (bool)GetValue(IsDropDownOpenProperty);
set => SetValue(IsDropDownOpenProperty, value);
set => SetValue(IsDropDownOpenProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty IsDropDownOpenProperty =
@@ -262,7 +262,7 @@ namespace HandyControl.Controls
public bool IsError
{
get => (bool)GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
set => SetValue(IsErrorProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ErrorStrProperty = DependencyProperty.Register(
@@ -289,7 +289,7 @@ namespace HandyControl.Controls
public bool ShowClearButton
{
get => (bool)GetValue(ShowClearButtonProperty);
set => SetValue(ShowClearButtonProperty, value);
set => SetValue(ShowClearButtonProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ClockProperty = DependencyProperty.Register(