public void SetPaneState()
        {
            bool changedState = (previousPane != currentPane);

            bool goingBackwards = (currentPane < previousPane);

            if (changedState)
            {
                System.Diagnostics.Trace.WriteLine("New Pane State: " + currentPane
                                                   + ", Old State = " + previousPane);

                if (currentPane == PaneSequenceType.AffiliationPane)
                {
                    this.labCol1.Text    = "Affiliation";
                    this.labCol2.Visible = false;
                    this.labCol3.Visible = false;

                    currentColValues = TypeUtilities.EnumHelper.getEnumValuesAsStrings(typeof(StandardIdentityAffiliationType));

                    currentColRowIndex = 0;

                    enableColumnButtons(1, true);
                    setVisibilityColumnButtons(2, false);
                    setVisibilityColumnButtons(3, false);
                    currentColumn = 1;
                    setColumnValues();
                }
                else if (currentPane == PaneSequenceType.SymbolSetPane)
                {
                    this.resetSymbolState();

                    this.labCol2.Text    = "Symbol Set";
                    this.labCol2.Visible = true;
                    this.labCol3.Visible = false;

                    currentColValues = TypeUtilities.EnumHelper.getEnumValuesAsStrings(typeof(SymbolSetType));

                    currentColRowIndex = 0;

                    currentColumn = 2;

                    enableColumnButtons(2, true);
                    setColumnValues();
                    enableColumnButtons(1, false);
                    setVisibilityColumnButtons(3, false);
                }
                else if ((currentPane == PaneSequenceType.EntityPane) ||
                         (currentPane == PaneSequenceType.EntityTypePane) ||
                         (currentPane == PaneSequenceType.EntitySubTypePane))
                {
                    this.labCol3.Text    = currentPane.ToString().Replace("Pane", ""); //  Entity/EntityType/etc.
                    this.labCol3.Visible = true;

                    if (currentPane == PaneSequenceType.EntityPane)
                    {
                        currentColValues = symbolLookup.GetDistinctEntries(this.currentSymbol.Id.SymbolSet);
                    }
                    else
                    if (currentPane == PaneSequenceType.EntityTypePane)
                    {
                        currentColValues = symbolLookup.GetDistinctEntries(
                            this.currentSymbol.Id.SymbolSet,
                            currentEntityName);
                    }
                    else
                    if (currentPane == PaneSequenceType.EntitySubTypePane)
                    {
                        currentColValues = symbolLookup.GetDistinctEntries(
                            this.currentSymbol.Id.SymbolSet,
                            currentEntityName,
                            currentEntityTypeName);
                    }

                    if (currentColValues.Count == 0)
                    {
                        // Advance to the next/previous pane if this is empty
                        if (goingBackwards)
                        {
                            currentPane--;
                        }
                        else
                        {
                            currentPane++;
                        }

                        resetColumn3State();
                    }
                    else
                    {
                        currentColValues.Insert(0, NOT_SET); // add as first element
                    }

                    currentColRowIndex = 0;

                    // if we are navigating backwards, and there were no entities (e.g. SpaceMet)
                    if (currentPane != PaneSequenceType.SymbolSetPane)
                    {
                        currentColumn = 3;
                        enableColumnButtons(3, true);
                        setColumnValues();
                        enableColumnButtons(1, false);
                        enableColumnButtons(2, false);
                    }
                }
                else if ((currentPane == PaneSequenceType.Modifier1Pane) ||
                         (currentPane == PaneSequenceType.Modifier2Pane))
                {
                    this.labCol3.Text    = currentPane.ToString().Replace("Pane", "");
                    this.labCol3.Visible = true;

                    if (currentPane == PaneSequenceType.Modifier1Pane)
                    {
                        currentColValues = symbolLookup.GetDistinctModifierNames(
                            this.currentSymbol.Id.SymbolSet, 1);
                    }
                    else
                    if (currentPane == PaneSequenceType.Modifier2Pane)
                    {
                        currentColValues = symbolLookup.GetDistinctModifierNames(
                            this.currentSymbol.Id.SymbolSet, 2);
                    }

                    if (currentColValues.Count == 0)
                    {
                        // Advance to the next/previous pane if this is empty
                        if (goingBackwards)
                        {
                            currentPane--;
                        }
                        else
                        {
                            currentPane++;
                        }

                        resetColumn3State();
                    }
                    else
                    {
                        currentColValues.Insert(0, NOT_SET); // Add as first element
                    }

                    currentColRowIndex = 0;

                    // if we are navigating backwards, and there were no modifiers (e.g. SpaceMet)
                    if (currentPane != PaneSequenceType.SymbolSetPane)
                    {
                        currentColumn = 3;
                        enableColumnButtons(3, true);
                        setColumnValues();
                        enableColumnButtons(1, false);
                        enableColumnButtons(2, false);
                    }
                }
                ////////////////////////////////////////////////////////////////
                //
                // Don't do these if non-framed
                //
                else if (currentPane == PaneSequenceType.EchelonMobilityPane)
                {
                    // Don't do if Non-framed
                    if (!TypeUtilities.HasFrame(this.currentSymbol.Id.SymbolSet))
                    {
                        if (goingBackwards)
                        {
                            currentPane = PaneSequenceType.EntitySubTypePane;
                        }
                        else
                        {
                            currentPane = PaneSequenceType.StartOver;
                        }

                        resetColumn3State();
                    }
                    else
                    {
                        this.labCol3.Text    = "Echelon/Mobility";
                        this.labCol3.Visible = true;

                        currentColValues = TypeUtilities.EnumHelper.getEnumValuesAsStrings(typeof(EchelonMobilityType));

                        currentColRowIndex = 0;

                        currentColumn = 3;
                        enableColumnButtons(3, true);
                        setColumnValues();
                        enableColumnButtons(1, false);
                        enableColumnButtons(2, false);
                    }
                }
                else if (currentPane == PaneSequenceType.HqTfFdPane)
                {
                    this.labCol3.Text    = "HQ/TF/FD";
                    this.labCol3.Visible = true;

                    currentColValues = TypeUtilities.EnumHelper.getEnumValuesAsStrings(typeof(HeadquartersTaskForceDummyType));

                    currentColRowIndex = 0;

                    currentColumn = 3;
                    enableColumnButtons(3, true);
                    setColumnValues();
                    enableColumnButtons(1, false);
                    enableColumnButtons(2, false);
                }
                else if (currentPane == PaneSequenceType.StatusPane)
                {
                    // Don't do if non-framed
                    if (!TypeUtilities.HasFrame(this.currentSymbol.Id.SymbolSet))
                    {
                        if (goingBackwards)
                        {
                            currentPane = PaneSequenceType.EntitySubTypePane;
                        }
                        else
                        {
                            currentPane = PaneSequenceType.StartOver;
                        }

                        resetColumn3State();
                    }
                    else
                    {
                        this.labCol3.Text    = "Op Condition";
                        this.labCol3.Visible = true;

                        currentColValues = TypeUtilities.EnumHelper.getEnumValuesAsStrings(typeof(StatusType));

                        currentColRowIndex = 0;

                        currentColumn = 3;
                        enableColumnButtons(3, true);
                        setColumnValues();
                        enableColumnButtons(1, false);
                        enableColumnButtons(2, false);
                    }
                }
                //
                // End of don't do if non-framed
                //
                ////////////////////////////////////////////////////////////////
                else if (currentPane == PaneSequenceType.StartOver)
                {
                    this.labCol3.Text    = "Finished";
                    this.labCol3.Visible = true;

                    currentColValues = new List <string>()
                    {
                        "Start Over"
                    };

                    currentColRowIndex = 0;

                    currentColumn = 3;
                    enableColumnButtons(3, true);
                    setColumnValues();
                    enableColumnButtons(1, false);
                    enableColumnButtons(2, false);
                }
            }

            previousPane = currentPane;
        }
Пример #2
0
        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);
        }