FlatRedBall.Glue.GuiDisplay.AvailableStates.GetListOfStates C# (CSharp) Method

GetListOfStates() public method

public GetListOfStates ( List listToFill, string selectedItemName ) : void
listToFill List
selectedItemName string
return void
        public void GetListOfStates(List<string> listToFill, string selectedItemName)
        {
            if (selectedItemName != null && selectedItemName.Contains(" set in "))
            {
                selectedItemName = selectedItemName.Substring(0, selectedItemName.IndexOf(" set in "));
            }
            IElement currentElement = null;

            NamedObjectSave currentNamedObject = CurrentNamedObject;

            if (currentNamedObject != null)
            {
                FillPossibleStatesFor(listToFill, selectedItemName, currentNamedObject);
            }
            else
            {
                currentElement = CurrentElement;


                CustomVariable customVariable = CurrentCustomVariable;

                if (customVariable == null)
                {
                    StateSave stateSave = CurrentStateSave;

                    string variableLookingFor = selectedItemName;

                    for (int i = 0; i < currentElement.CustomVariables.Count; i++)
                    {

                        if (currentElement.CustomVariables[i].Name == variableLookingFor)
                        {
                            customVariable = currentElement.CustomVariables[i];
                            break;
                        }
                    }
                }

                if (customVariable == null)
                {
                    int m = 3;
                }
                customVariable = FillPossibleStatesFor(listToFill, currentElement, customVariable);

            }
        }

Usage Example

Ejemplo n.º 1
0
        public void TestCategories()
        {
            List<string> listToFill = new List<string>();

            AvailableStates availableStates = new AvailableStates(
                null,
                mEntitySave,
                mExposedStateVariable,
                null);


            listToFill.Clear();
            availableStates.GetListOfStates(listToFill, mDerivedEntitySave.CustomVariables[0].Name);

            if (listToFill.Contains("SharedStateSave") == false)
            {
                throw new Exception("GetListOfStates is not returnign states that are categorized but that share variables with others.");
            }


        }
All Usage Examples Of FlatRedBall.Glue.GuiDisplay.AvailableStates::GetListOfStates