コード例 #1
0
        private ComboBox BuildComboBox(object data, BuildContext bc)
        {
            ComboBoxProperties properties =
                DataNodeWrapper.GetNodeAttributes(data).To <ComboBoxProperties>();

            JSObject[] children = DataNodeWrapper.GetNodeChildren(data);

            Menu menu = null;

            MenuLauncherControlProperties launcherProperties =
                DataNodeWrapper.GetNodeAttributes(data).To <MenuLauncherControlProperties>();

            Dictionary <string, string> menuItems = null;

            if (!Utility.IsTrue(launcherProperties.PopulateDynamically))
            {
                // Since PopulateDynamically is not true, we pass in "false" for LazyInit
                menu = BuildMenu(children[0], bc, false);

                // Parse XML subtree to build MenuItem list for auto-complete
                menuItems = new Dictionary <string, string>();
                JSObject[] sections = DataNodeWrapper.GetNodeChildren(children[0]);
                int        l        = sections.Length;
                for (int i = 0; i < l; i++)
                {
                    // Get children of the MenuSection node
                    JSObject[] sectionChildren = DataNodeWrapper.GetNodeChildren(sections[i]);
                    // Get children of the Controls node within the MenuSection
                    // There should only be 1 Controls node within the MenuSection subtree
                    JSObject[] items = DataNodeWrapper.GetNodeChildren(sectionChildren[0]);
                    int        m     = items.Length;
                    for (int j = 0; j < m; j++)
                    {
                        string labeltext  = DataNodeWrapper.GetAttribute(items[j], DataNodeWrapper.LABELTEXT);
                        string menuitemid = DataNodeWrapper.GetAttribute(items[j], DataNodeWrapper.MENUITEMID);
                        menuItems[labeltext] = menuitemid;
                    }
                }
            }

            ComboBox fscb = new ComboBox(Root,
                                         properties.Id,
                                         properties,
                                         menu);

            fscb.MenuItems = menuItems;
            return(fscb);
        }
コード例 #2
0
ファイル: jewelbuilder.cs プロジェクト: tralivali1234/IL2JS
        private JewelMenuLauncher BuildJewelMenuLauncher(object data, JewelBuildContext jbc)
        {
            JewelMenuLauncherProperties properties =
                DataNodeWrapper.GetNodeAttributes(data).To <JewelMenuLauncherProperties>();

            JSObject[] children = DataNodeWrapper.GetNodeChildren(data);

            Menu menu = null;

            MenuLauncherControlProperties launcherProperties =
                DataNodeWrapper.GetNodeAttributes(data).To <MenuLauncherControlProperties>();

            if (!Utility.IsTrue(launcherProperties.PopulateDynamically))
            {
                menu = BuildMenu(children[0], jbc, false);
            }

            JewelMenuLauncher jml = new JewelMenuLauncher(Jewel,
                                                          properties.Id,
                                                          properties,
                                                          menu);

            return(jml);
        }
コード例 #3
0
        private MRUSplitButton BuildMRUSplitButton(object data, BuildContext bc)
        {
            DropDownProperties properties =
                DataNodeWrapper.GetNodeAttributes(data).To <DropDownProperties>();

            JSObject[] children = DataNodeWrapper.GetNodeChildren(data);

            Menu menu = null;

            MenuLauncherControlProperties launcherProperties =
                DataNodeWrapper.GetNodeAttributes(data).To <MenuLauncherControlProperties>();

            if (!Utility.IsTrue(launcherProperties.PopulateDynamically))
            {
                menu = BuildMenu(children[0], bc, false);
            }

            MRUSplitButton fssb = new MRUSplitButton(Root,
                                                     properties.Id,
                                                     properties,
                                                     menu);

            return(fssb);
        }
コード例 #4
0
        private FlyoutAnchor BuildFlyoutAnchor(object data, BuildContext bc)
        {
            FlyoutAnchorProperties properties =
                DataNodeWrapper.GetNodeAttributes(data).To <FlyoutAnchorProperties>();

            JSObject[] children = DataNodeWrapper.GetNodeChildren(data);

            Menu menu = null;

            MenuLauncherControlProperties launcherProperties =
                DataNodeWrapper.GetNodeAttributes(data).To <MenuLauncherControlProperties>();

            if (!Utility.IsTrue(launcherProperties.PopulateDynamically))
            {
                menu = BuildMenu(children[0], bc, true);
            }

            FlyoutAnchor fsfa = new FlyoutAnchor(Root,
                                                 properties.Id,
                                                 properties,
                                                 menu);

            return(fsfa);
        }