[UI.Client]

修正PanelLocker无法自动将焦点设置到秘密输入框的问题。
修正PanelLocker无法重置密码的问题。
PanelLocker解锁后移除Host控件的Blur效果,避免造成UI性能问题。
修正PanelLockerPasswordChanger窗口打开时未将焦点设置到密码输入框的问题。
This commit is contained in:
Liang Su 2023-06-13 10:28:46 +08:00
parent 510a421805
commit 6f013ec600
2 changed files with 39 additions and 23 deletions

View File

@ -20,6 +20,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using Aitex.Core.Util;
@ -72,14 +73,6 @@ namespace MECF.Framework.UI.Client.Ctrlib.Controls
{
txtPass.Focus();
};
IsVisibleChanged += (sender, args) =>
{
if (args.NewValue is bool isVis && isVis)
{
txtPass.Focus();
}
};
}
#region Dps
@ -141,11 +134,26 @@ namespace MECF.Framework.UI.Client.Ctrlib.Controls
set => SetValue(OpPathSetNewPasswordProperty, value);
}
public static readonly DependencyProperty OpPathResetPasswordToDefaultProperty = DependencyProperty.Register(
nameof(OpPathResetPasswordToDefault), typeof(string), typeof(PanelLocker), new PropertyMetadata("System.ResetRecipeEditorPassword"));
public string OpPathResetPasswordToDefault
{
get => (string)GetValue(OpPathResetPasswordToDefaultProperty);
set => SetValue(OpPathResetPasswordToDefaultProperty, value);
}
#endregion
#region Methods
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
txtPass.Focus();
}
public void Lock()
{
txtPass.Password = "";
@ -180,7 +188,7 @@ namespace MECF.Framework.UI.Client.Ctrlib.Controls
if (reqResetPass)
{
// 密码重置为admin
InvokeClient.Instance.Service.DoOperation(OpPathSetNewPassword, DEF_PASSWORD);
InvokeClient.Instance.Service.DoOperation(OpPathResetPasswordToDefault, DEF_PASSWORD);
}
// 读取系统配置中的Password如果读取失败使用默认密码admin
@ -251,7 +259,10 @@ namespace MECF.Framework.UI.Client.Ctrlib.Controls
private void BtnUnlock_OnClick(object sender, RoutedEventArgs e)
{
if (!CheckPassword())
{
txtPass.Focus();
return;
}
if (LockTarget.Effect is BlurEffect eff)
{
@ -259,6 +270,7 @@ namespace MECF.Framework.UI.Client.Ctrlib.Controls
eff.BeginAnimation(BlurEffect.RadiusProperty, aniBlurFadeOut);
}
LockTarget.Effect = null;
this.Visibility = Visibility.Collapsed;

View File

@ -12,10 +12,8 @@
// *
// * *****************************************************************************/
using System;
using System.Security.Cryptography;
using System.Text;
using System.Windows;
using System.Windows.Media;
using MECF.Framework.Common.OperationCenter;
using MECF.Framework.Common.Utilities;
@ -28,6 +26,12 @@ namespace MECF.Framework.UI.Client.Ctrlib.Controls
InitializeComponent();
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
txtOldPass.Focus();
}
private void btnOk_Click(object sender, RoutedEventArgs e)
{
#region Validation