Control Panel instance manager

This commit is contained in:
Cyberboss
2017-11-01 13:26:13 -04:00
parent 481fca3afe
commit ef9f4adfaa
8 changed files with 2627 additions and 20 deletions
+9 -1
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using TGServiceInterface;
@@ -8,8 +9,13 @@ namespace TGControlPanel
/// <summary>
/// The main <see cref="ControlPanel"/> form
/// </summary>
partial class ControlPanel : Form
partial class ControlPanel : CountedForm
{
/// <summary>
/// List of instances being used by open control panels
/// </summary>
public static IDictionary<string, ControlPanel> InstancesInUse { get; private set; } = new Dictionary<string, ControlPanel>();
/// <summary>
/// The <see cref="TGServiceInterface.Interface"/> instance for this <see cref="ControlPanel"/>
/// </summary>
@@ -35,6 +41,7 @@ namespace TGControlPanel
InitServerPage();
LoadChatPage();
InitStaticPage();
InstancesInUse.Add(I.InstanceName, this);
}
/// <summary>
@@ -42,6 +49,7 @@ namespace TGControlPanel
/// </summary>
void Cleanup()
{
InstancesInUse.Remove(Interface.InstanceName);
Interface.Dispose();
}