Commit 44266b66 authored by 姜春辉's avatar 姜春辉

认证页面增加启动方式

parent 2acf19e8
using GalaSoft.MvvmLight.Threading;
using GS.Terminal.LogicShell.Interface;
using OpenCvSharp;
using OpenCvSharp.Extensions;
using System;
......@@ -12,6 +13,8 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
public class AuthenticationPageHandler : Corebase<ViewModels.Pages.AuthenticationPage.ViewModel>
{
private string _FaceEngineId = string.Empty;
private Action<string> _AuthSuccessCallback;
private IViewModel _ExitView;
public override void Init()
{
VM.OnExitClick += VM_OnExitClick;
......@@ -42,8 +45,26 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
}
/// <summary>
/// 开始进行身份认证
/// </summary>
/// <param name="successAction">认证成功的回调</param>
/// <param name="useFace">是否启用人脸认证</param>
/// <param name="useIdCard">是否启用二代证认证</param>
/// <param name="useQRCode">其否启用二维码认证</param>
public void BeginAuth(Action<string> successAction, IViewModel exitView = null, bool useFace = true, bool useIdCard = true, bool useQRCode = true)
{
_ExitView = exitView;
VM.EnableFace = useFace;
VM.EnableIdCard = useIdCard;
VM.EnableQRCode = useQRCode;
_AuthSuccessCallback = successAction;
ShowView();
}
private void VM_OnNavigateOut()
{
_AuthSuccessCallback = null;
ThirdAddon.FastRecognization.Pause(_FaceEngineId);
ThirdAddon.FaceRecognization.UnRegistOutPutMatEvent(VideoOut);
}
......@@ -65,7 +86,10 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
private void VM_OnExitClick()
{
Handlers.GetHandler<ViewModels.Pages.MenuPage.ViewModel>()?.ShowView();
if (_ExitView == null)
Handlers.GetHandler<MenuPageHandler>()?.ShowView();
else
ThirdAddon.LogicShell.ShowView(_ExitView);
}
}
}
......@@ -18,7 +18,11 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
{
if (menuItem == ViewModels.Pages.MenuPage.MenuItemType.HasAppointment)
{
ThirdAddon.LogicShell.ShowView(vmLocator.AuthenticationPage);
Handlers.GetHandler<AuthenticationPageHandler>()?.BeginAuth(v =>
{
}, useQRCode: false,
exitView: vmLocator.AppointmentDetailPage);
}
else
{
......
......@@ -23,7 +23,7 @@ namespace GS.Terminal.VisitorSelfService.Logic
{
var handler = (Corebase)Activator.CreateInstance(item);
handler.Init();
handlers.Add(item.BaseType.GenericTypeArguments[0], handler);
handlers.Add(item, handler);
});
}
......@@ -32,11 +32,11 @@ namespace GS.Terminal.VisitorSelfService.Logic
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
internal static Corebase<T> GetHandler<T>() where T : IViewModel
internal static T GetHandler<T>() where T : Corebase
{
if (handlers.TryGetValue(typeof(T), out object instance))
return (Corebase<T>)instance;
return null;
return (T)instance;
return default(T);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment