public static void Init()
        {
            var cfg = AutoVcConfig.Instance;

            if (!cfg.ActiveVcEngine.IsNullOrEmpty())
            {
                VerifyCodeRecognizeEngine = AppContext.ExtensionManager.VerifyCodeRecogniseService.FirstOrDefault(s => s.Id == cfg.ActiveVcEngine);
            }
            Array.ForEach(AppContext.ExtensionManager.VerifyCodeRecogniseService, s =>
            {
                s.StateChanged += (x, y) =>
                {
                    if (x != VerifyCodeRecognizeEngine)
                    {
                        return;
                    }
                    OnStateChanged();
                };
            });
            cfg.PropertyChanged += (x, y) =>
            {
                if (y.PropertyName == nameof(AutoVcConfig.ActiveVcEngine))
                {
                    VerifyCodeRecognizeEngine = string.IsNullOrEmpty(AutoVcConfig.Instance.ActiveVcEngine) ? null : AppContext.ExtensionManager.VerifyCodeRecogniseService.FirstOrDefault(s => s.Id == AutoVcConfig.Instance.ActiveVcEngine);
                }
            };
        }
コード例 #2
0
 /// <summary>
 /// 当前的引擎是否可用
 /// </summary>
 /// <param name="service"></param>
 /// <returns></returns>
 public static bool IsEngineAvailable(IVerifyCodeRecognizeService service)
 {
     return(service != null && service.Verified && service.IsLoggedIn);
 }