public void Init() { var items = new PublicWXBLL(_RepoUri).GetItems(null).QueryObjects; _WXSLocker.AcquireWriterLock(int.MaxValue); _WXS.Clear(); if (items != null && items.Count > 0) { items.ForEach(it => _WXS.Add(it.ID, it)); } _WXSLocker.ReleaseWriterLock(); if (_TGetAccessKey == null) { _TGetAccessKey = new Thread(new ThreadStart(GetAccessKey_Thread)); _TGetAccessKey.IsBackground = true; _TGetAccessKey.Start(); } }
protected override List <object> GetDataSource() { List <PublicWX> items = null; PublicWXBLL bll = new PublicWXBLL(AppSettings.Current.ConnStr); if (SearchCondition == null) { items = bll.GetItems(null).QueryObjects.ToList(); } else { items = bll.GetItems(SearchCondition).QueryObjects.ToList(); } if (items != null && items.Count > 0) { return(items.Select(it => (object)it).ToList()); } return(null); }
protected override bool DeletingItem(object item) { PublicWXBLL bll = new PublicWXBLL(AppSettings.Current.ConnStr); PublicWX info = item as PublicWX; CommandResult result = bll.Delete(info); if (result.Result == ResultCode.Successful) { if (WXManager.Current != null) { WXManager.Current.Remove(info); } } else { MessageBox.Show(result.Message, "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(result.Result == ResultCode.Successful); }