FlatRedBall.Glue.ProjectManager.RemoveCustomVariable C# (CSharp) Method

RemoveCustomVariable() public static method

public static RemoveCustomVariable ( CustomVariable customVariable, List additionalFilesToRemove ) : void
customVariable FlatRedBall.Glue.SaveClasses.CustomVariable
additionalFilesToRemove List
return void
        public static void RemoveCustomVariable(CustomVariable customVariable, List<string> additionalFilesToRemove)
        {
            // additionalFilesToRemove is added to keep this consistent with other remove methods

            IElement iElement = ObjectFinder.Self.GetElementContaining(customVariable);

            if (iElement == null || !iElement.CustomVariables.Contains(customVariable))
            {
                throw new ArgumentException();
            }
            else
            {
                iElement.CustomVariables.Remove(customVariable);
                iElement.RefreshStatesToCustomVariables();

                List<EventResponseSave> eventsReferencedByVariable = iElement.GetEventsOnVariable(customVariable.Name);

                foreach (EventResponseSave ers in eventsReferencedByVariable)
                {
                    iElement.Events.Remove(ers);
                }
            }
            UpdateCurrentTreeNodeAndCodeAndSave(false);

            UpdateAllDerivedElementFromBaseValues(false, true);
        }