/// <summary> /// 标记为未下载 /// </summary> public void SetUndownload() { SubItems[2].Image = null; if (ChildItems != null) { ChildItems.OfType <ResourceListViewItem>().ForEach(s => s.SetUndownload()); } }
/// <summary> /// 标记安全状态 /// </summary> public void RefreshIllegalStatus() { if (/*!AppContext.Instance.Options.EnableCloudSaftyCheckOverride || */ Resource.Downloaded) { return; } AppContext.UiInvoke(() => { ListView?.BeginUpdate(); SubItems[2].Image = null; switch (Resource.VerifyState) { case VerifyState.Unknown: break; case VerifyState.None: break; case VerifyState.Verified: SubItems[2].Image = Properties.Resources.tick_shield; break; case VerifyState.Reported: SubItems[2].Image = Properties.Resources.exclamation_shield; break; case VerifyState.Illegal: case VerifyState.Fake: SubItems[2].Image = Properties.Resources.cross_shield; break; case VerifyState.AutoFake: case VerifyState.AutoIllegal: SubItems[2].Image = Properties.Resources.minus_shield; break; default: break; } ChildItems.OfType <ResourceListViewItem>().ForEach(s => { s.Resource.ChangeVerifyState(Resource.VerifyState, Resource.ReportNum); s.RefreshIllegalStatus(); }); ListView?.EndUpdate(); }); }
void LoadSubResources() { Array.ForEach(ChildItems.OfType <PaddingLoadingItem>().ToArray(), s => s.Remove()); //appnd sub items ListView?.BeginUpdate(); foreach (var item in ChildItems.OfType <PaddingLoadingItem>().ToArray()) { item.Remove(); } ChildItems.AddRange(Resource.SubResources.Select(s => new ResourceListViewItem(s, false))); ListView?.EndUpdate(); }
/// <summary> /// 标记为已下载 /// </summary> public void RefreshDownloadStatus(bool initialCall = true) { AppContext.UiInvoke(() => { ListView?.BeginUpdate(); SubItems[2].Image = null; if (Resource.Downloaded) { SubItems[2].Image = Properties.Resources.down_16; } else if (Resource.VerifyState != VerifyState.Unknown && initialCall) { RefreshIllegalStatus(); } ChildItems.OfType <ResourceListViewItem>().ForEach(s => { s.Resource.ChangeDownloadedStatus(Resource.Downloaded); s.RefreshDownloadStatus(false); }); ListView?.EndUpdate(); }); }