register network with ActionCollection when loaded

This commit is contained in:
Tim Young 2018-05-03 12:58:54 -05:00
parent 3d335d32c4
commit 2efca90da1
3 changed files with 35 additions and 0 deletions

View File

@ -29,6 +29,23 @@ namespace EduNetworkBuilder
CurrentNetAction.Add(What);
}
/// <summary>
/// Take the current actionlist and save it to the stored actionlists.
/// We use this when we have successfully solved a network and want to store
/// this solution process
/// </summary>
public void PushActionToList()
{
//remove an old one if it exists
if (CurrentNetAction != null)
{
NetworkAction NA = GetActionlistFromName(CurrentNetAction.NetworkName);
if (NA != null) NetActions.Remove(NA);
}
//Add this one
NetActions.Add(CurrentNetAction);
}
/// <summary>
/// Return true if we already have a solved state for this network
/// </summary>

View File

@ -36,6 +36,7 @@ namespace EduNetworkBuilder
public string LastTrans1Lang = "";
public string LastTrans2Lang = "";
public string FormLastTransDir = "";
protected ActionCollection UserActions = new ActionCollection();
public NBSettings()
{
@ -48,6 +49,19 @@ namespace EduNetworkBuilder
Duplicate(fromSettings, this);
}
public void RegisterNetAsStarted(Network newnet)
{
UserActions.RegisterNet(newnet);
}
public void RegisterActionDone(ActionClass What)
{
UserActions.Add(What);
}
public ActionCollection GetUserActionCollection()
{
return UserActions;
}
static void Duplicate(NBSettings FromClass, NBSettings ToClass)
{
if (FromClass == null) return; //Break if we are going to error out.

View File

@ -421,6 +421,10 @@ namespace EduNetworkBuilder
maxUI = nc.GetUniqueIdentifier;
}
if (maxUI <= UniqueIdentifier) UniqueIdentifier = maxUI + 1;
//Register this in the user settings
NBSettings tSettings = NB.GetSettings();
if (tSettings != null) tSettings.RegisterNetAsStarted(this);
}
public void OpenHelpIfNeeded(bool skipOpeningWindows)