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.SelectedIndex = 0;
tbcMain.Size = new Size(352, 499); tbcMain.Size = new Size(352, 499);
tbcMain.TabIndex = 0; tbcMain.TabIndex = 0;
tbcMain.SelectedIndexChanged += tbcMain_SelectedIndexChanged;
// //
// tbpContacts // tbpContacts
// //

View File

@ -367,27 +367,24 @@ namespace qtc_net_client_2
donationWindow.Show(); 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 if (lvStoreItems.Items.Count == storeItems.Data.Count) return;
var storeItems = await _apiService.GetStoreItems();
if (storeItems != null && storeItems.Success && storeItems.Data != null) if (!IsHandleCreated || IsDisposed)
return;
if (InvokeRequired)
{ {
if (lvStoreItems.Items.Count == storeItems.Data.Count) return; Invoke(() => ApplyStoreItems(storeItems.Data));
}
if (!IsHandleCreated || IsDisposed) else
return; {
ApplyStoreItems(storeItems.Data);
if (InvokeRequired)
{
Invoke(() => ApplyStoreItems(storeItems.Data));
}
else
{
ApplyStoreItems(storeItems.Data);
}
} }
} }
} }
@ -666,6 +663,8 @@ namespace qtc_net_client_2
llblEditProfile.Visible = true; llblEditProfile.Visible = true;
tbcMain.Enabled = true; tbcMain.Enabled = true;
await RefreshStore();
var pfpRes = await _apiService.GetUserProfilePic(_apiService.CurrentUser.Id); var pfpRes = await _apiService.GetUserProfilePic(_apiService.CurrentUser.Id);
var cosmeticRes = await GetCosmeticImage(_apiService.CurrentUser.ActiveProfileCosmetic); var cosmeticRes = await GetCosmeticImage(_apiService.CurrentUser.ActiveProfileCosmetic);