public List <string> GetWorldVarNameList(WorldVarType varType)
        {
            List <string> outList = new List <string>();

            switch (varType)
            {
            case WorldVarType.StateVar:
                if (m_selectedWorld != "")
                {
                    outList.AddRange(m_worldDefinitions[m_selectedWorld].GetStateVarNameList());
                }
                outList.AddRange(m_wiresViewModel.GetWireNames());
                break;

            case WorldVarType.ActionVar:
                if (m_selectedWorld != "")
                {
                    outList.AddRange(m_worldDefinitions[m_selectedWorld].GetActionVarNameList());
                }
                outList.AddRange(m_wiresViewModel.GetWireNames());
                break;

            case WorldVarType.Constant:
                if (m_selectedWorld != "")
                {
                    outList.AddRange(m_worldDefinitions[m_selectedWorld].GetConstantNameList());
                }
                break;
            }
            return(outList);
        }
        public WorldVarRefValueConfigViewModel(AppViewModel appDefinition, WorldVarType varType, ConfigNodeViewModel parent, XmlNode definitionNode, string parentXPath, XmlNode configNode = null)
        {
            commonInit(appDefinition, parent, definitionNode, parentXPath);

            m_varType = varType;//definitionNode.Attributes[XMLConfig.hangingFromAttribute].Value;

            //the possible values taken by this world variable
            m_appViewModel.getWorldVarNameList(m_varType, ref m_varNames);
            NotifyOfPropertyChange(() => varNames);

            if (configNode != null)
            {
                configNode             = configNode[name];
                selectedEnumeratedName = configNode.InnerText;
            }

            if (m_varNames.Count == 0)
            {
                //Either we have loaded the config but the list is of values has not yet been loaded
                //or no config file has been loaded. In Either case, we register for a deferred load step
                m_appViewModel.registerDeferredLoadStep(updateValues);
            }

            m_appViewModel.registerWorldVarRef(updateValues);
        }
        public WorldVarRefValueConfigViewModel(ExperimentViewModel parentExperiment, WorldVarType varType, ConfigNodeViewModel parent, XmlNode definitionNode, string parentXPath, XmlNode configNode = null)
        {
            CommonInitialization(parentExperiment, parent, definitionNode, parentXPath);

            m_varType = varType;

            //if the list is already loaded, get it
            m_variables.Clear();
            foreach (string var in m_parentExperiment.GetWorldVarNameList(m_varType))
            {
                m_variables.Add(var);
            }
            NotifyOfPropertyChange(() => Variables);

            if (configNode != null)
            {
                configNode = configNode[name];
                //is the world variable wired?
                XmlNode wireConfigNode = configNode.FirstChild;
                if (wireConfigNode != null && wireConfigNode.Name == XMLTags.WireTag)
                {
                    content = wireConfigNode.InnerText;

                    if (wireConfigNode.Attributes[XMLTags.minValueAttribute] != null &&
                        wireConfigNode.Attributes[XMLTags.maxValueAttribute] != null)
                    {
                        double min = double.Parse(wireConfigNode.Attributes[XMLTags.minValueAttribute].Value);
                        double max = double.Parse(wireConfigNode.Attributes[XMLTags.maxValueAttribute].Value);
                        m_parentExperiment.AddWire(content, min, max);
                    }
                    else
                    {
                        m_parentExperiment.AddWire(content);
                    }
                }
                else
                {
                    content = configNode.InnerText;
                }
            }

            m_parentExperiment.RegisterWorldVarRef(Update);
            m_parentExperiment.RegisterDeferredLoadStep(Update);
        }
Esempio n. 4
0
        public void getWorldVarNameList(WorldVarType varType, ref List <string> varNameList)
        {
            if (varNameList != null && m_selectedWorld != "")
            {
                switch (varType)
                {
                case WorldVarType.StateVar:
                    m_worldDefinitions[m_selectedWorld].getStateVarNameList(ref varNameList);
                    break;

                case WorldVarType.ActionVar:
                    m_worldDefinitions[m_selectedWorld].getActionVarNameList(ref varNameList);
                    break;

                case WorldVarType.Constant:
                    m_worldDefinitions[m_selectedWorld].getConstantNameList(ref varNameList);
                    break;
                }
            }
        }