Refresh Store On Load

This commit is contained in:
Alan Moon 2025-11-27 13:01:43 -08:00
parent 66eb9b91e8
commit 4bd2f0028f
2 changed files with 17 additions and 19 deletions

View File

@ -113,7 +113,6 @@
tbcMain.SelectedIndex = 0;
tbcMain.Size = new Size(352, 499);
tbcMain.TabIndex = 0;
tbcMain.SelectedIndexChanged += tbcMain_SelectedIndexChanged;
//
// tbpContacts
//

View File

@ -367,27 +367,24 @@ namespace qtc_net_client_2
donationWindow.Show();
}
private async void tbcMain_SelectedIndexChanged(object sender, EventArgs e)
private async Task RefreshStore()
{
if (tbcMain.SelectedIndex == 4)
// get store items
var storeItems = await _apiService.GetStoreItems();
if (storeItems != null && storeItems.Success && storeItems.Data != null)
{
// get store items
var storeItems = await _apiService.GetStoreItems();
if (storeItems != null && storeItems.Success && storeItems.Data != null)
if (lvStoreItems.Items.Count == storeItems.Data.Count) return;
if (!IsHandleCreated || IsDisposed)
return;
if (InvokeRequired)
{
if (lvStoreItems.Items.Count == storeItems.Data.Count) return;
if (!IsHandleCreated || IsDisposed)
return;
if (InvokeRequired)
{
Invoke(() => ApplyStoreItems(storeItems.Data));
}
else
{
ApplyStoreItems(storeItems.Data);
}
Invoke(() => ApplyStoreItems(storeItems.Data));
}
else
{
ApplyStoreItems(storeItems.Data);
}
}
}
@ -666,6 +663,8 @@ namespace qtc_net_client_2
llblEditProfile.Visible = true;
tbcMain.Enabled = true;
await RefreshStore();
var pfpRes = await _apiService.GetUserProfilePic(_apiService.CurrentUser.Id);
var cosmeticRes = await GetCosmeticImage(_apiService.CurrentUser.ActiveProfileCosmetic);