void setSymbolState(string valueSelected = "") { // TODO: Figure out a way to set this consistent naming scheme better string symbolSetName = currentSymbol.Id.SymbolSet.ToString().Replace("_", " "); if (string.IsNullOrEmpty(valueSelected)) { // this is a special state (i.e. hack) to simulate a button press, to force // into the next state, when the previous panel is empty } else if (currentPane == PaneSequenceType.AffiliationPane) { string affiliationSelectedString = valueSelected; StandardIdentityAffiliationType affiliationSelection = (StandardIdentityAffiliationType) TypeUtilities.EnumHelper.getEnumFromString( typeof(StandardIdentityAffiliationType), affiliationSelectedString); currentSymbol.Id.Affiliation = affiliationSelection; currentPane = PaneSequenceType.SymbolSetPane; } else if (currentPane == PaneSequenceType.SymbolSetPane) { string symbolSetSelectedString = valueSelected; SymbolSetType symbolSetSelection = (SymbolSetType) TypeUtilities.EnumHelper.getEnumFromString( typeof(SymbolSetType), symbolSetSelectedString); currentSymbol.Id.SymbolSet = symbolSetSelection; currentPane = PaneSequenceType.EntityPane; } else if (currentPane == PaneSequenceType.EntityPane) { if (valueSelected == NOT_SET) { currentPane = PaneSequenceType.Modifier1Pane; } else { currentEntityName = valueSelected; string entityCode = symbolLookup.GetEntityCode(currentSymbol.Id.SymbolSet, currentEntityName); currentSymbol.Id.EntityCode = entityCode; currentPane = PaneSequenceType.EntityTypePane; } } else if (currentPane == PaneSequenceType.EntityTypePane) { if (valueSelected == NOT_SET) { currentPane = PaneSequenceType.Modifier1Pane; } else { currentEntityTypeName = valueSelected; string entityCode = symbolLookup.GetEntityCode(currentSymbol.Id.SymbolSet, currentEntityName, currentEntityTypeName); currentSymbol.Id.EntityCode = entityCode; currentPane = PaneSequenceType.EntitySubTypePane; } } else if (currentPane == PaneSequenceType.EntitySubTypePane) { if (valueSelected == NOT_SET) { currentPane = PaneSequenceType.Modifier1Pane; } else { currentEntitySubTypeName = valueSelected; string entityCode = symbolLookup.GetEntityCode(currentSymbol.Id.SymbolSet, currentEntityName, currentEntityTypeName, currentEntitySubTypeName); currentSymbol.Id.EntityCode = entityCode; currentPane = PaneSequenceType.Modifier1Pane; } } else if (currentPane == PaneSequenceType.Modifier1Pane) { string currentModifier1Name = valueSelected; string modifier1Code = symbolLookup.GetModifierCodeFromName( currentSymbol.Id.SymbolSet, 1, currentModifier1Name); currentSymbol.Id.ModifierOne = modifier1Code; currentPane = PaneSequenceType.Modifier2Pane; } else if (currentPane == PaneSequenceType.Modifier2Pane) { string currentModifier2Name = valueSelected; string modifier2Code = symbolLookup.GetModifierCodeFromName( currentSymbol.Id.SymbolSet, 2, currentModifier2Name); currentSymbol.Id.ModifierTwo = modifier2Code; currentPane = PaneSequenceType.EchelonMobilityPane; } else if (currentPane == PaneSequenceType.EchelonMobilityPane) { string currentEchelonMobilityName = valueSelected; EchelonMobilityType echelonMobilitySelection = (EchelonMobilityType) TypeUtilities.EnumHelper.getEnumFromString( typeof(EchelonMobilityType), currentEchelonMobilityName); currentSymbol.Id.EchelonMobility = echelonMobilitySelection; currentPane = PaneSequenceType.HqTfFdPane; } else if (currentPane == PaneSequenceType.HqTfFdPane) { string currentHqTfFdName = valueSelected; HeadquartersTaskForceDummyType hqTfFdSelection = (HeadquartersTaskForceDummyType) TypeUtilities.EnumHelper.getEnumFromString( typeof(HeadquartersTaskForceDummyType), currentHqTfFdName); currentSymbol.Id.HeadquartersTaskForceDummy = hqTfFdSelection; currentPane = PaneSequenceType.StatusPane; } else if (currentPane == PaneSequenceType.StatusPane) { string currentStatusName = valueSelected; StatusType statusSelection = (StatusType)TypeUtilities.EnumHelper.getEnumFromString( typeof(StatusType), currentStatusName); currentSymbol.Id.Status = statusSelection; currentPane = PaneSequenceType.StartOver; } else if (currentPane == PaneSequenceType.StartOver) { // Reset the other values resetSymbolState(); // Go back when we are done currentPane = PaneSequenceType.SymbolSetPane; } setTagLabel(); updatePictureBox(); // Go To Next Pane SetPaneState(); }
private static void MyAdHocTest() { ///////////////////////////////////////////////////// // TODO: move this test code to a Unit Test Project ///////////////////////////////////////////////////// SymbolIdCode sidcSpecialLandUnit = new SymbolIdCode("10121195"); string wfnSpecialLandUnit = Utilities.GetWellFormedName(sidcSpecialLandUnit); SymbolIdCode sidc = new SymbolIdCode(); System.Diagnostics.Trace.WriteLine("SIDC=" + sidc); sidc.Affiliation = StandardIdentityAffiliationType.Hostile; SymbolIdCode sidc2 = new SymbolIdCode(); sidc2.Affiliation = StandardIdentityAffiliationType.Hostile; if (sidc == sidc2) { System.Diagnostics.Trace.WriteLine("pass"); } sidc.Affiliation = StandardIdentityAffiliationType.Friend; sidc2.SymbolSet = SymbolSetType.Control_Measures; sidc2.EntityCode = "110100"; if (sidc != sidc2) { System.Diagnostics.Trace.WriteLine("pass"); } string wfn = Utilities.GetWellFormedName(sidc2); sidc.SymbolSet = SymbolSetType.Air; sidc.EntityCode = "110131"; sidc.ModifierOne = "01"; sidc.ModifierTwo = "02"; string wfn2 = Utilities.GetWellFormedName(sidc); MilitarySymbol ms1 = new MilitarySymbol(); ms1.Id = SymbolIdCode.DefaultSymbolIdCode; MilitarySymbol ms2 = new MilitarySymbol(); ms2.Id = new SymbolIdCode(); if (ms1 == ms2) { System.Diagnostics.Trace.WriteLine("pass"); } ms2.Id.HeadquartersTaskForceDummy = HeadquartersTaskForceDummyType.Feint_Dummy; if (ms1 != ms2) { System.Diagnostics.Trace.WriteLine("pass"); } SymbolLookup symbolLookup = new SymbolLookup(); symbolLookup.Initialize(); if (!symbolLookup.Initialized) { System.Diagnostics.Trace.WriteLine("Fail"); } MilitarySymbol ms = symbolLookup.CreateSymbolByEntityName("Fighter/Bomber"); MilitarySymbolToGraphicLayersMaker.SetMilitarySymbolGraphicLayers(ref ms); System.Diagnostics.Trace.WriteLine("MilitarySymbol: " + ms); List <MilitarySymbol> matchingSymbols = symbolLookup.GetMilitarySymbols(SymbolSetType.Space); int matchCount = 0; foreach (MilitarySymbol matchSymbol in matchingSymbols) { matchCount++; System.Diagnostics.Trace.WriteLine("Match: " + matchCount + ", MilitarySymbol: " + matchSymbol);; } List <MilitarySymbol> matchingSymbols2 = symbolLookup.GetMilitarySymbols(SymbolSetType.Space, StandardIdentityAffiliationType.Friend, "Military"); matchCount = 0; foreach (MilitarySymbol matchSymbol in matchingSymbols2) { matchCount++; System.Diagnostics.Trace.WriteLine("Match: " + matchCount + ", MilitarySymbol: " + matchSymbol);; } List <string> matchingStrings = symbolLookup.GetDistinctEntries(SymbolSetType.Space); matchCount = 0; foreach (string distinctMatch in matchingStrings) { matchCount++; System.Diagnostics.Trace.WriteLine("Distinct Match: " + distinctMatch); } matchingStrings = symbolLookup.GetDistinctEntries(SymbolSetType.Air, "Military", "Fixed-Wing"); matchCount = 0; foreach (string distinctMatch in matchingStrings) { matchCount++; System.Diagnostics.Trace.WriteLine("Distinct Match: " + distinctMatch); } matchingStrings = symbolLookup.GetDistinctModifierNames(SymbolSetType.Air, 1); matchCount = 0; foreach (string distinctMatch in matchingStrings) { matchCount++; System.Diagnostics.Trace.WriteLine("Modifiers: Distinct Match: " + distinctMatch); } string modifierName = "Government"; string modifierCode = symbolLookup.GetModifierCodeFromName(SymbolSetType.Air, 1, modifierName); }