修复获取云端收藏数据分组 错误bug

This commit is contained in:
chfei committed 2026-11-16 16:31:19 +08:00
1 parent c8f586d8fc
commit b710e7042e
3 files changed
+14 -16

No files matched your search

@@ -48,7 +48,7 @@ namespace TemuKJD.WXForms.ProductForms
Disposed += (sender, e) => detection?.Cancel();
}
private void AdminCardCodeForm_Load(object sender, EventArgs e)
private async void AdminCardCodeForm_Load(object sender, EventArgs e)
{
pbLoading.Visible = false;
ucSplitPage1.PageChange += UcSplitPage1_PageChange;
@@ -70,12 +70,13 @@ namespace TemuKJD.WXForms.ProductForms
{
txt_title.Text = "连衣裙";
}
InitGroup();
await InitGroup();
}
private void InitGroup()
private async Task InitGroup()
{
await CloudGoodsService.GetGroups();
cm_group.DataSource = new List<UserFavoriteGroup>() { new UserFavoriteGroup { Id = 0, GroupName = "全部" } }.Concat(CloudGoodsService.UserGroups).ToList();
cm_group.ValueMember = "Id";
cm_group.DisplayMember = "GroupName";
@@ -43,9 +43,10 @@ namespace TemuKJD.WXForms.ProductForms
this.VisibleChanged += CloudGoodsForm_VisibleChanged;
}
private void CloudGoodsForm_VisibleChanged(object sender, EventArgs e)
private async void CloudGoodsForm_VisibleChanged(object sender, EventArgs e)
{
if (this.Visible == false) return;
await CloudGoodsService.GetGroups(BaseClass.UserName);
cm_group.DataSource = new List<UserFavoriteGroup>() { new UserFavoriteGroup { Id = 0, GroupName = "全部" } }.Concat(CloudGoodsService.UserGroups).ToList();
cm_group.ValueMember = "Id";
cm_group.DisplayMember = "GroupName";
+8 -12
View File
@@ -21,19 +21,15 @@ namespace Work.Services
public static List<UserFavoriteGroup> UserGroups { get; private set; }
static CloudGoodsService()
{
GetGroups(BaseClass.UserName).ContinueWith(t =>
_ = GetGroups();
}
public static async Task<List<UserFavoriteGroup>> GetGroups()
{
if (UserGroups == null)
{
if (t.IsFaulted)
{
return;
}
if (t.IsCanceled)
{
return;
}
UserGroups = t.Result;
});
UserGroups = await GetGroups(BaseClass.UserName);
}
return UserGroups;
}
public static async Task<PageData<CloudGoods>> GetGoods(GoodsSearchRequest request)
{