Beispiel #1
0
 bool HasAnyUnsupportKey(string key)
 {
     if (RawEngines.Any(s => s.Disabled || s.SupportUnicode))
     {
         return(false);
     }
     return(EngineUtility.IsUnicodeKey(key));
 }
Beispiel #2
0
        void InitSearch()
        {
            Engines = RawEngines.Select(s => new EngineSearchContext(s)).ToList();
            lv.AttachEngines(RawEngines);
            pWarning.KeepCenter();

            //加入列表
            using (panStatus.CreateBatchOperationDispatcher())
            {
                for (var i = 0; i < Engines.Count; i++)
                {
                    var ps = new EngineStatus(Engines[i]);
                    panStatus.Controls.Add(ps);
                    ps.Location = new Point(i * 20, 1);

                    tt.SetToolTip(ps, "引擎:" + Engines[i].Provider.Info.Name);
                }
            }

            btnCancelLoad.Click += (s, e) =>
            {
                if (!this.Question("当前正在搜索,需要取消当前搜索吗?", true))
                {
                    return;
                }

                Engines.Where(x => !x.Provider.Disabled).ForEach(x =>
                {
                    if (x.IsBusy)
                    {
                        x.Cancel();
                    }
                });
            };
            btnCancelLoad.Enabled = false;
            Engines.ForEach(s =>
            {
                s.SearchComplete  += S_SearchComplete;
                s.SearchCancelled += S_SearchCancelled;
                s.SearchFailed    += S_SearchFailed;
            });
            lv.LoadComplete += (s, e) => RefreshSearchStatus();
        }