Prevent Server Loading
The app now stops the user from loading the server if it has already been loaded.
This commit is contained in:
parent
3c0a1cfe62
commit
78c94e17ca
@ -13,17 +13,21 @@ public class ServerIcon<TServer> : UserControl where TServer : Server
|
|||||||
private Rectangle SelectedRect;
|
private Rectangle SelectedRect;
|
||||||
private static ServerIcon<MainServer>? ser1;
|
private static ServerIcon<MainServer>? ser1;
|
||||||
private static ServerIcon<PublicServer>? ser2;
|
private static ServerIcon<PublicServer>? ser2;
|
||||||
|
private bool Selected = false;
|
||||||
|
|
||||||
public async Task LoadServer()
|
public async Task LoadServer()
|
||||||
{
|
{
|
||||||
|
Selected = true;
|
||||||
if (ser1 is not null)
|
if (ser1 is not null)
|
||||||
{
|
{
|
||||||
ser1.SelectedRect.BackgroundColor = new(26, 26, 26, 255);
|
ser1.SelectedRect.BackgroundColor = new(26, 26, 26, 255);
|
||||||
|
ser1.Selected = false;
|
||||||
ser1 = null;
|
ser1 = null;
|
||||||
}
|
}
|
||||||
if (ser2 is not null)
|
if (ser2 is not null)
|
||||||
{
|
{
|
||||||
ser2.SelectedRect.BackgroundColor = new(26, 26, 26, 255);
|
ser2.SelectedRect.BackgroundColor = new(26, 26, 26, 255);
|
||||||
|
ser2.Selected = false;
|
||||||
ser2 = null;
|
ser2 = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +84,7 @@ public class ServerIcon<TServer> : UserControl where TServer : Server
|
|||||||
|
|
||||||
private async Task OnClicked(IRenderObject arg)
|
private async Task OnClicked(IRenderObject arg)
|
||||||
{
|
{
|
||||||
|
if (Selected) return;
|
||||||
await LoadServer();
|
await LoadServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user