Prevent Server Loading

The app now stops the user from loading the server if it has already been loaded.
This commit is contained in:
JacobTech 2024-04-11 20:05:11 -04:00
parent 3c0a1cfe62
commit 78c94e17ca
1 changed files with 6 additions and 1 deletions

View File

@ -13,17 +13,21 @@ public class ServerIcon<TServer> : UserControl where TServer : Server
private Rectangle SelectedRect;
private static ServerIcon<MainServer>? ser1;
private static ServerIcon<PublicServer>? ser2;
private bool Selected = false;
public async Task LoadServer()
{
Selected = true;
if (ser1 is not null)
{
ser1.SelectedRect.BackgroundColor = new(26, 26, 26, 255);
ser1.Selected = false;
ser1 = null;
}
if (ser2 is not null)
{
ser2.SelectedRect.BackgroundColor = new(26, 26, 26, 255);
ser2.Selected = false;
ser2 = null;
}
@ -80,6 +84,7 @@ public class ServerIcon<TServer> : UserControl where TServer : Server
private async Task OnClicked(IRenderObject arg)
{
if (Selected) return;
await LoadServer();
}