Context reader, context-reader-test, and color-coding

This commit is contained in:
2015-08-08 11:09:22 -06:00
parent b4630655b3
commit 4c82388485
9 changed files with 278 additions and 71 deletions

View File

@@ -11,6 +11,7 @@ using System.Xml;
using System.Drawing;
using System.Media;
using System.Reflection;
using System.Text.RegularExpressions;
namespace EduNetworkBuilder
@@ -39,7 +40,7 @@ namespace EduNetworkBuilder
public enum NBSoundType { none, success }
public enum RTFWindowContents { help, about, release_notes }
public enum NetTestType { NeedsLocalIPTo, NeedsDefaultGW, NeedsLinkToDevice, NeedsRouteToNet,
SuccessfullyPings, SuccessfullyArps, SuccessfullyDHCPs, HelpRequest, FailedPing,
SuccessfullyPings, SuccessfullyArps, SuccessfullyDHCPs, HelpRequest, ReadContextHelp, FailedPing,
LockAll, LockIP, LockRoute, LockNic, LockDHCP, LockGateway
}
public enum NetTestVerbosity { none, basic, hints, full }
@@ -293,6 +294,12 @@ namespace EduNetworkBuilder
if (myWin.GameRandomGen == null) return null;
return myWin.myNetwork;
}
public static BuilderWindow GetBuilderWin()
{
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
if (myWin == null) return null;
return myWin;
}
/// <summary>
/// Return a translated string in the current chosen language
@@ -306,13 +313,23 @@ namespace EduNetworkBuilder
{
ResourceManager RM = GetResource();
CultureInfo CI = GetCulture();
string answer;
string answer="";
answer = RM.GetString(key, CI);
if (answer == null) return "";
return answer;
}
return myWin.Translate(key);
}
public static string GetHelpTopicKey(HelpTopics What)
{
return "H_" + What.ToString() + "_Key";
}
public static string GetHelpTopicTitle(HelpTopics What)
{
return "H_" + What.ToString() + "_Title";
}
public static DebugPausePoint GetDebugPauseSetting()
{
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
@@ -483,9 +500,30 @@ namespace EduNetworkBuilder
public static void ReadContextHelp(HelpTopics What)
{
RTFWindow tForm = null;
//make a new window if needed
foreach(Form myfrm in Application.OpenForms)
{
if(myfrm.Name == "Context")
{
//We have a context window
tForm = (RTFWindow)myfrm;
break;
}
}
if(tForm == null)
{
//We do not have one yet. Make a new one
tForm = new RTFWindow(RTFWindowContents.help);
tForm.Name = "Context";
}
//load help
tForm.Show();
//Jump to the correct location
if(tForm != null)
{
tForm.JumpToSelection(What);
}
}
public static string GenerateMACAddress()