using HDL_ON.UI.CSS;
|
using Shared;
|
using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace HDL_ON.Stan
|
{
|
/// <summary>
|
/// App手势验证界面
|
/// </summary>
|
public class AppGestureSecurityForm : EditorCommonForm
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// <para>Action事件</para>
|
/// <para>1:密码输入结束,这个时候,第二个参数为输入的密码</para>
|
/// <para>2:点击了底部的消息</para>
|
/// </summary>
|
public Action<int, string> ActionEvent = null;
|
/// <summary>
|
/// 手势控件
|
/// </summary>
|
private GestureLockView gestureLockView = null;
|
/// <summary>
|
/// 消息控件
|
/// </summary>
|
private NormalViewControl btnMsg = null;
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
/// <param name="addTopFrame">是否添加头部Frame</param>
|
/// <param name="i_title">标题信息</param>
|
/// <param name="i_bottomMsg">底部显示的信息行</param>
|
public void ShowForm(bool addTopFrame, string i_title, string i_bottomMsg)
|
{
|
//不允许左滑
|
this.ScrollLeftEnabled = false;
|
|
if (addTopFrame == false)
|
{
|
//清空头部全部控件
|
topFrameLayout.RemoveAll();
|
//然后让背景色一体化
|
topFrameLayout.BackgroundColor = bodyFrameLayout.BackgroundColor;
|
topMenuFrameLayout.BackgroundColor = bodyFrameLayout.BackgroundColor;
|
}
|
else
|
{
|
//验证手势密码
|
base.SetTitleText(Language.StringByID(StringId.VerifyGesturePassword));
|
}
|
|
//初始化中部信息
|
this.InitMiddleFrame(i_title, i_bottomMsg);
|
}
|
|
/// <summary>
|
/// 初始化中部信息
|
/// </summary>
|
/// <param name="i_title">标题信息</param>
|
/// <param name="i_bottomMsg">底部显示的信息行</param>
|
private void InitMiddleFrame(string i_title, string i_bottomMsg)
|
{
|
//清空bodyFrame
|
this.ClearBodyFrame();
|
|
//标题
|
var btnTitle = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(36), false);
|
btnTitle.Y = Application.GetRealHeight(164) - topFrameLayout.Bottom;
|
btnTitle.Gravity = Gravity.CenterHorizontal;
|
btnTitle.TextAlignment = TextAlignment.Center;
|
btnTitle.IsBold = true;
|
btnTitle.TextColor = CSS_Color.FirstLevelTitleColor;
|
btnTitle.TextSize = CSS_FontSize.EmphasisFontSize_Secondary;
|
btnTitle.Text = i_title;
|
bodyFrameLayout.AddChidren(btnTitle);
|
|
//请绘制图案
|
this.btnMsg = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(72), false);
|
btnMsg.Y = btnTitle.Bottom;
|
btnMsg.Gravity = Gravity.CenterHorizontal;
|
btnMsg.TextAlignment = TextAlignment.TopCenter;
|
btnMsg.IsBold = true;
|
btnMsg.IsMoreLines = true;
|
btnMsg.SelectedTextColor = CSS_Color.WarningColor;
|
btnMsg.TextID = StringId.PleaseDrawPattern;
|
bodyFrameLayout.AddChidren(btnMsg);
|
|
//原始它与btnDrawMsg的间隔是14
|
this.gestureLockView = new GestureLockView();
|
gestureLockView.Y = btnMsg.Bottom;
|
gestureLockView.Gravity = Gravity.CenterHorizontal;
|
gestureLockView.Width = Application.GetRealWidth(215);
|
gestureLockView.Height = Application.GetRealWidth(215);
|
gestureLockView.LockViewCorrectColor = CSS_Color.MainColor;//0xFF00FF00,//默认和正确 时显示的颜色
|
gestureLockView.LockViewErrorColor = 0xFFFF0000; //错误时 显示的颜色
|
gestureLockView.BackgroundColor = CSS_Color.BackgroundColor;
|
bodyFrameLayout.AddChidren(gestureLockView);
|
gestureLockView.SetSolidType(true);
|
//滑动结束 回调密码结果和密码长度
|
gestureLockView.OnLockVerifyEvent += (selectNumStr, selectCount) =>
|
{
|
//自行验证密码,提示正确或者错误 false为显示红色错误, 自行选择调用时机
|
this.gestureLockView.showCorrectStatus(false);
|
if (selectCount < 4)
|
{
|
//至少连接4个点,请重新绘制
|
btnMsg.Text = Language.StringByID(StringId.DrawingLengthError);
|
btnMsg.TextColor = CSS_Color.WarningColor;
|
return;
|
}
|
this.ActionEvent?.Invoke(1, selectNumStr);
|
};
|
|
//底部消息
|
if (string.IsNullOrEmpty(i_bottomMsg) == false)
|
{
|
var btnBottomTip = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, 20, false);
|
btnBottomTip.Y = Application.GetRealHeight(517) - topFrameLayout.Bottom;
|
btnBottomTip.Gravity = Gravity.CenterHorizontal;
|
btnBottomTip.TextAlignment = TextAlignment.TopCenter;
|
btnBottomTip.TextColor = CSS_Color.MainColor;
|
btnBottomTip.Text = i_bottomMsg;
|
btnBottomTip.Height = btnBottomTip.GetRealRowCountByText() * Application.GetRealHeight(24);
|
btnBottomTip.IsMoreLines = true;
|
bodyFrameLayout.AddChidren(btnBottomTip);
|
btnBottomTip.ButtonClickEvent += (sender, e) =>
|
{
|
this.ActionEvent?.Invoke(2, null);
|
};
|
}
|
}
|
|
#endregion
|
|
#region ■ 界面关闭___________________________
|
|
/// <summary>
|
/// 界面关闭
|
/// </summary>
|
public override void CloseFormBefore()
|
{
|
base.CloseFormBefore();
|
|
this.ActionEvent = null;
|
|
}
|
|
#endregion
|
|
#region ■ 一般方法___________________________
|
|
/// <summary>
|
/// 显示错误消息
|
/// </summary>
|
/// <param name="i_errorMsg">需要显示的错误消息</param>
|
public void ShowErrorMsg(string i_errorMsg)
|
{
|
btnMsg.Text = i_errorMsg;
|
btnMsg.TextColor = CSS_Color.WarningColor;
|
}
|
|
#endregion
|
}
|
}
|