Merge pull request #538 from Cyberboss/InstanceRefresh

Fixes being unable to refresh active instances
This commit is contained in:
Jordan Brown
2018-07-11 20:32:15 -04:00
committed by GitHub
3 changed files with 14 additions and 1 deletions
+1
View File
@@ -58,6 +58,7 @@ namespace TGS.ControlPanel
void RefreshInstances()
{
InstanceListBox.Items.Clear();
server.RebuildInstanceList();
foreach(var I in server.Instances)
InstanceListBox.Items.Add(I);
var HasServerAdmin = server.InstanceManager != null;
+5
View File
@@ -35,5 +35,10 @@ namespace TGS.Interface
/// <param name="name">The name of the <see cref="IInstance"/> to get</param>
/// <returns>The <see cref="IInstance"/> named <paramref name="name"/> on success, <see langword="null"/> on failure</returns>
IInstance GetInstance(string name);
/// <summary>
/// Rebuilds the internal cached <see cref="IInstance"/> list
/// </summary>
void RebuildInstanceList();
}
}
+8 -1
View File
@@ -15,7 +15,7 @@ namespace TGS.Interface
{
lock (this)
if (knownInstances == null)
knownInstances = serverInterface.GetComponent<ITGLanding>(null).ListInstances();
RebuildInstanceList();
foreach (var I in knownInstances)
{
IInstance nextInstance;
@@ -92,5 +92,12 @@ namespace TGS.Interface
{
return new Instance(serverInterface, new InstanceMetadata { Name = name, Enabled = false });
}
/// <inheritdoc />
public void RebuildInstanceList()
{
lock (this)
knownInstances = serverInterface.GetComponent<ITGLanding>(null).ListInstances();
}
}
}