Пример #1
0
        /// <summary>
        /// Display demo selection screen
        /// </summary>
        private static void DemoSelect()
        {
            // Create form
            Form frm = new Form("frm", Colors.DarkGray);

            // Create menu
            MenuStrip ms = new MenuStrip("ms", Fonts.Droid9, 0, 0, frm.Width, 24);

            // Add menu items
            MenuItem miView = new MenuItem("miView", "View");

            ms.AddMenuItem(miView);

            // "View" sub items
            MenuItem miBasic = new MenuItem("miBasic", "Basic Controls");

            miBasic.Tap += new OnTap(miBasic_Tap);
            miView.AddMenuItem(miBasic);

            MenuItem miCollection = new MenuItem("miCollection", "Collection Controls");

            miView.AddMenuItem(miCollection);

            MenuItem miInput = new MenuItem("miInput", "Input Controls");

            miView.AddMenuItem(miInput);

            MenuItem miDialogs = new MenuItem("miDialogs", "Dialogs");

            miView.AddMenuItem(miDialogs);

            // "Dialogs" sub items
            MenuItem midPrompt = new MenuItem("midPrompt", "Prompt Dialog");

            miDialogs.AddMenuItem(midPrompt);

            MenuItem midSel = new MenuItem("midSel", "Selection Dialog");

            miDialogs.AddMenuItem(midSel);

            MenuItem midOpen = new MenuItem("midOpen", "Open File Dialog");

            miDialogs.AddMenuItem(midOpen);

            MenuItem midSave = new MenuItem("midSave", "Save File Dialog");

            miDialogs.AddMenuItem(midSave);

            // Add menu to form
            frm.AddChild(ms);

            // Activate form
            Core.ActiveContainer = frm;
        }
Пример #2
0
        public async Task CreateMenuAsyncTest()
        {
            var menu     = WeixinMenu.Create();
            var menuItem = new MenuItem("会员事务");

            menuItem.AddMenuItem(new ViewButton(Client.MakeOAuth("http://weixin.ecard.chihank.com//test", WeiXinOAuthType.Base, "123"), "修改基础资料"));
            menuItem.AddMenuItem(new ViewButton("http://weixin.3ecard.net", "修改交易密码"));
            menuItem.AddMenuItem(new ViewButton("http://weixin.3ecard.net", "加盟商户"));
            menu.AddMenuItem(menuItem);

            menuItem = new MenuItem("会员交易");
            menuItem.AddMenuItem(new ViewButton("http://weixin.3ecard.net", "实时交易"));
            menuItem.AddMenuItem(new ViewButton("http://weixin.3ecard.net", "交易记录"));
            menu.AddMenuItem(menuItem);
            await Client.UpdateMenuAsync(menu);
        }
Пример #3
0
        ////////////////

        public override void Load()
        {
            ServerBrowserMod.Instance = this;

            this.Reporter = new ServerBrowserReporter();

            if (!Main.dedServ)
            {
                var theme = new UITheme();
                theme.UrlColor      = Color.Lerp(theme.UrlColor, Color.White, 0.5f);
                theme.UrlLitColor   = Color.Lerp(theme.UrlLitColor, Color.White, 0.5f);
                theme.UrlVisitColor = Color.Lerp(theme.UrlVisitColor, Color.White, 0.5f);

                this.Dialog = new UIServerBrowserDialog(theme);

                MenuItem.AddMenuItem("Browse Servers", MenuItem.MenuTopPos - 80, 12, () => {
                    Main.OpenPlayerSelect(plr_data => {
                        Main.ServerSideCharacter = false;
                        plr_data.SetAsActive();

                        Main.menuMode = 77777;
                        ServerBrowserMod.Instance.Dialog.Open();
                    });
                });

                MenuItem.AddMenuItem("Back", -78, 77777, delegate() {
                    Main.menuMode = 12;
                    ServerBrowserMod.Instance.Dialog.Close();
                });

                Main.OnPostDraw += ServerBrowserMod._DrawBrowser;
            }
        }
Пример #4
0
        public async Task MenuTest()
        {
            MPClient client = MakeMPClient();

            var menuItem = new MenuItem("text");

            menuItem.AddMenuItem(new MenuButton("test1", "text"));
            menuItem.AddMenuItem(new MenuButton("test1", "text"));
            menuItem.AddMenuItem(new MediaButton("JdW_0g3R89AYK57-MXDpN83i_RngLTz_spquCwFY45E", "media1"));


            var menu = WeixinMenu.Create();

            menu.AddMenuItem(menuItem);
            await client.UpdateMenuAsync(menu);
        }
Пример #5
0
        public InterfaceTest()
        {
            m_MainMenu = new MainMenu("Interface Implementation Test");

            MenuItem firstOptionMenu = new MenuItem("Show Date/Time", k_BackwardsWord);

            firstOptionMenu.AddMenuItem(new Time());
            firstOptionMenu.AddMenuItem(new Date());

            m_MainMenu.AddMenuItem(firstOptionMenu);

            MenuItem secondOptionMenu = new MenuItem("Info", k_BackwardsWord);

            secondOptionMenu.AddMenuItem(new MyVersion());
            secondOptionMenu.AddMenuItem(new WordCount());

            m_MainMenu.AddMenuItem(secondOptionMenu);
        }
Пример #6
0
        static MenuItem LoadMenuItem(Stream fs)
        {
            if (fs.ReadByte() != 9)
            {
                throw new Exception("Invalid item type; expected 9");
            }

            var obj = new MenuItem(ReadString(fs), ReadString(fs))
            {
                Enabled = ReadBool(fs), Visible = ReadBool(fs)
            };

            var len = ReadInt(fs);

            for (var i = 0; i < len; i++)
            {
                obj.AddMenuItem(LoadMenuItem(fs));
            }

            return(obj);
        }
Пример #7
0
        public void AddMenuItemTest()
        {
            var menuItem = new MenuItem("text");

            menuItem.AddMenuItem(new MenuButton("test1", "text"));
            menuItem.AddMenuItem(new MenuButton("test1", "text"));
            menuItem.AddMenuItem(new MenuButton("test1", "text"));
            menuItem.AddMenuItem(new MenuButton("test1", "text"));
            menuItem.AddMenuItem(new MenuButton("test1", "text"));
            try
            {
                menuItem.AddMenuItem(new MenuButton("test1", "text"));
                Assert.Fail("the max items count in root menu is 5");
            }
            catch (Exception)
            {
            }
            Assert.AreEqual(5, menuItem.Items.Count());
        }