コード例 #1
0
        private IUIControl CreateGroup(IDictionary map)
        {
            string         title    = map["title"] as string;
            IList <object> contents = map["contents"] as IList <object>;

            List <object> controls = new List <object>();

            foreach (object obj in contents)
            {
                IUIControl control = null;

                if (obj is IDictionary)
                {
                    control = CreateGroup(obj as IDictionary);
                }
                else if (obj is string)
                {
                    control = CreateControl(obj as string);
                }

                controls.Add(control);
            }

            IDictionary <string, object> newMap = new Dictionary <string, object>(map as IDictionary <string, object>);

            newMap.Remove("title");
            newMap.Remove("contents");
            newMap.Add("id", title);
            newMap.Add("Description", title);
            newMap.Add("controls", controls);

            return(OmegaFactory.CreateControl("Group", newMap));
        }
コード例 #2
0
        /// <summary>
        /// Initializes the ControlList with the value of "controls" parameter in the Input.
        /// </summary>
        /// <param name="input"></param>
        public override void SetInput(IUIInput input)
        {
            base.SetInput(input);

            if (Input.HasParameter("controls"))
            {
                ControlList = new List <object>();

                IList <object> list = Input.GetInput("controls") as IList <object>;

                foreach (object control in list)
                {
                    if (control is IDictionary)
                    {
                        ControlList.Add(OmegaFactory.CreateControl(control as IDictionary <string, object>));
                    }
                    else if (control is IUIControl)
                    {
                        ControlList.Add(control);
                    }
                    else
                    {
                        throw new Exception(control + "is not a control");
                    }
                }
            }
        }
コード例 #3
0
        private IUIControl CreateControl(string id)
        {
            IUIControl control = null;

            if (itemList.Contains(id))
            {
                Dictionary <string, object> item = itemList[id] as Dictionary <string, object>;
                control = OmegaFactory.CreateControl(id, item);
            }
            else
            {
                control = OmegaFactory.CreateControl(id);
            }
            ControlMap.Add(id, control);
            return(control);
        }
コード例 #4
0
        protected Panel CreateContentPane(IList ui)
        {
            List <object> controls = new List <object>();
            IDictionary   map      = null;

            foreach (object obj in ui)
            {
                map = obj as IDictionary;
                map.Add("showBorder", false);
                controls.Add(CreateGroup(map));
            }

            Dictionary <string, object> parameters = new Dictionary <string, object>
            {
                { "id", "properties" },
                { "Description", "Properties" },
                { "controls", controls }
            };

            IUIControl omega = null;

            if (controls.Count == 1)
            {
                parameters["Description"] = map.Contains("title") ? map["title"] : "Properties";
                omega = OmegaFactory.CreateControl("Group", parameters);
            }
            else
            {
                omega = OmegaFactory.CreateControl("Tab", parameters);
            }

            TabbedComponent = omega;
            Grid panel = new Grid();

            panel.Children.Add(omega.GetUIElement());
            return(panel);
        }