Esempio n. 1
0
        /// <summary>
        /// Save the info related with one Form
        /// </summary>
        /// <param name="scenarioName">Form name</param>
        /// <param name="posX">Position X</param>
        /// <param name="posY">Position Y</param>
        /// <param name="width">Form width</param>
        /// <param name="height">Form height</param>
        /// <param name="properties">Extra graphical information list</param>
        public void SaveFormInfo(string scenarioName, int posX, int posY, int width, int height, StringDictionary properties)
        {
            // In the scenario is in the cache, update it
            FormPrefs formPrefs = GetScenarioPrefs(scenarioName) as FormPrefs;

            if (formPrefs == null)
            {
                // Population Scenario doesn't exist in the cache. Create a new one
                formPrefs = new FormPrefs(scenarioName);
                mScenarioPreferences.Add(formPrefs);
            }
            formPrefs.PosX       = posX;
            formPrefs.PosY       = posY;
            formPrefs.Width      = width;
            formPrefs.Height     = height;
            formPrefs.Properties = properties;

            // Save in the Preferences Server
            SaveScenario(formPrefs);
        }
Esempio n. 2
0
        private IScenarioPrefs CreatePreference(XmlNode scenarioNode)
        {
            if (scenarioNode.ChildNodes.Count == 0)
            {
                return(null);
            }

            string type    = scenarioNode.Attributes["Type"].Value;
            string version = scenarioNode.Attributes["Version"].Value;
            string name    = scenarioNode.Attributes["Name"].Value;

            IScenarioPrefs pref = null;

            switch (type)
            {
            case "INS":
            {
                pref = new InstancePrefs(name);
                pref.Deserialize(scenarioNode.ChildNodes[0], version);
                break;
            }

            case "POP":
            {
                pref = new PopulationPrefs(name, 0);
                pref.Deserialize(scenarioNode.ChildNodes[0], version);
                break;
            }

            case "FORM":
            {
                pref = new FormPrefs(name);
                pref.Deserialize(scenarioNode.ChildNodes[0], version);
                break;
            }
            }

            return(pref);
        }
Esempio n. 3
0
        /// <summary>
        /// Save the info related with one Form
        /// </summary>
        /// <param name="scenarioName">Form name</param>
        /// <param name="posX">Position X</param>
        /// <param name="posY">Position Y</param>
        /// <param name="width">Form width</param>
        /// <param name="height">Form height</param>
        /// <param name="properties">Extra graphical information list</param>
        public void SaveFormInfo(string scenarioName, int posX, int posY, int width, int height, StringDictionary properties)
        {
            // In the scenario is in the cache, update it
            FormPrefs formPrefs = GetScenarioPrefs(scenarioName) as FormPrefs;
            if (formPrefs == null)
            {
                // Population Scenario doesn't exist in the cache. Create a new one
                formPrefs = new FormPrefs(scenarioName);
                mScenarioPreferences.Add(formPrefs);
            }
            formPrefs.PosX = posX;
            formPrefs.PosY = posY;
            formPrefs.Width = width;
            formPrefs.Height = height;
            formPrefs.Properties = properties;

            // Save in the Preferences Server
            SaveScenario(formPrefs);
        }
Esempio n. 4
0
        private IScenarioPrefs CreatePreference(XmlNode scenarioNode)
        {
            if (scenarioNode.ChildNodes.Count == 0)
                return null;

            string type = scenarioNode.Attributes["Type"].Value;
            string version = scenarioNode.Attributes["Version"].Value;
            string name = scenarioNode.Attributes["Name"].Value;

            IScenarioPrefs pref = null;

            switch (type)
            {
                case "INS":
                    {
                        pref = new InstancePrefs(name);
                        pref.Deserialize(scenarioNode.ChildNodes[0], version);
                        break;
                    }
                case "POP":
                    {
                        pref = new PopulationPrefs(name, 0);
                        pref.Deserialize(scenarioNode.ChildNodes[0], version);
                        break;
                    }
                case "FORM":
                    {
                        pref = new FormPrefs(name);
                        pref.Deserialize(scenarioNode.ChildNodes[0], version);
                        break;
                    }
            }

            return pref;
        }