Merge pull request #350 from Cyberboss/CPMinorInitImprovement

Speeds up ControlPanel loading some
This commit is contained in:
Jordan Brown
2017-11-12 12:02:24 -05:00
committed by GitHub
2 changed files with 10 additions and 1 deletions
+3 -1
View File
@@ -47,7 +47,6 @@ namespace TGControlPanel
InitRepoPage();
InitBYONDPage();
InitServerPage();
InitStaticPage();
UpdateSelectedPanel();
InstancesInUse.Add(I.InstanceName, this);
}
@@ -97,6 +96,9 @@ namespace TGControlPanel
case 3: //chat
LoadChatPage();
break;
case 4: //static
InitStaticPage();
break;
}
Properties.Settings.Default.LastPageIndex = Panels.SelectedIndex;
}
@@ -12,6 +12,10 @@ namespace TGControlPanel
IDictionary<int, string> IndexesToPaths = new Dictionary<int, string>();
IList<string> EnumeratedPaths = new List<string>() { "" };
bool enumerating = false;
/// <summary>
/// Whether or not the static page has been initialized yet
/// </summary>
bool initializedStaticPage = false;
enum EnumResult
{
@@ -23,9 +27,12 @@ namespace TGControlPanel
void InitStaticPage()
{
if (initializedStaticPage)
return;
if(!Interface.ConnectToInstance().HasFlag(ConnectivityLevel.Administrator))
RecreateStaticButton.Visible = false;
BuildFileList();
initializedStaticPage = true;
}
void BuildFileList()