Exemplo n.º 1
0
        private void OnChildMenuClosed(ChildMenu childMenu)
        {
            if (_currentChildMenu != null && _currentChildMenu == childMenu)
            {
                //closed all child menus
                _currentChildMenu = null;
                MainMenu.Instance.SetInteractionsEnabled();
                MainMenu.Instance.EnablePlayButton();
            }

            GameOverMenu.Instance.EnableInteractions();
        }
Exemplo n.º 2
0
        private void OnChildMenuOpened(ChildMenu childMenu)
        {
            if (_currentChildMenu != null && _currentChildMenu != childMenu)
            {
                _currentChildMenu.Hide();
            }

            _currentChildMenu = childMenu;

            MainMenu.Instance.SetInteractionsEnabled();
            MainMenu.Instance.DisablePlayButton();
            GameOverMenu.Instance.DisableInteractions();
        }
Exemplo n.º 3
0
 } // HideSubMenu
 
 public virtual void HideMenu()
 {
     if (ChildMenu != null)
     {
         ((ContextMenu)ChildMenu).HideMenu(true);
         ChildMenu.Dispose();
         ChildMenu = null;
     }
     if (UserInterfaceManager.FocusedControl is MenuBase)
         Focused = true;
     Invalidate();
     ItemIndex = -1;
 } // HideMenu
Exemplo n.º 4
0
    /// <summary>
    /// Load menu con của menu ngang
    /// </summary>
    /// <param name="parentComponent"></param>
    /// <param name="parentMenu"></param>
    private void LoadSubTopMenu(Component parentComponent, MenuInfo parentMenu)
    {
        List <MenuInfo> ChildMenu;

        //  if (CurrentUser.IsSuperUser)
        ChildMenu = MenuController.GetInstance().GetMenus(parentMenu.ID, false, false); //Lấy các tree nằm trong panel
        //  else
        //      ChildMenu = MenuController.GetInstance().GetMenus(parentMenu.ID, false, false, CurrentUser.ID);
        if (ChildMenu == null || ChildMenu.Count() == 0)
        {
            return;
        }
        Ext.Net.Menu menu = new Ext.Net.Menu();
        if (parentComponent.InstanceOf.Contains("Button"))
        {
            Ext.Net.Button btn = parentComponent as Ext.Net.Button;
            btn.Menu.Add(menu);
        }
        else
        {
            Ext.Net.MenuItem menuItem = parentComponent as Ext.Net.MenuItem;
            menuItem.Menu.Add(menu);
        }
        foreach (MenuInfo item in ChildMenu)
        {
            Ext.Net.MenuItem mnu = new Ext.Net.MenuItem(item.MenuName);
            if (string.IsNullOrEmpty(item.Icon))
            {
                mnu.Icon = Icon.BulletBlue;
            }
            else
            {
                mnu.IconCls = item.Icon;
            }
            mnu.ID = item.ID + "mnu";
            if (!string.IsNullOrEmpty(item.LinkUrl))
            {
                if (item.LinkUrl.Contains("?") == false)
                {
                    item.LinkUrl += "?mId=" + item.ID;
                }
                else
                {
                    item.LinkUrl += "&mId=" + item.ID;
                }
                mnu.Listeners.Click.Handler = "addTab(#{pnTabPanel},'dm_file" + item.ID + "','" + item.LinkUrl + "', '" + item.TabName + "')";
            }
            menu.Items.Add(mnu);
            LoadSubTopMenu(mnu, item);
        }
    }
Exemplo n.º 5
0
        ////////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////
        public virtual void HideMenu(bool hideCurrent)
        {
            if (hideCurrent)
            {
                Visible   = false;
                ItemIndex = -1;
            }
            if (ChildMenu != null)
            {
                (ChildMenu as ContextMenu).HideMenu(true);
                ChildMenu.Dispose();
                ChildMenu = null;
            }
        }
Exemplo n.º 6
0
        ////////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////
        public virtual void HideMenu()
        {
            if (ChildMenu != null)
            {
                (ChildMenu as ContextMenu).HideMenu(true);
                ChildMenu.Dispose();
                ChildMenu = null;
            }
            if (Manager.FocusedControl is MenuBase)
            {
                Focused = true;
            }
            Invalidate();
            ItemIndex = -1;
        }
Exemplo n.º 7
0
        public static void CreateMenu()
        {
            RootMenu  rootmenu = new RootMenu();
            ChildMenu menu1    = new ChildMenu("程财信息");
            ChildMenu menu2    = new ChildMenu("程财服务");
            ChildMenu menu3    = new ChildMenu("程财大厅");

            ChildMenu menu11 = new ChildMenu("项目查询", ChildMenu.MenuTypeEnum.view, "http://cwpt.sues.edu.cn:80/Login/Index?state=SUES!fund");
            ChildMenu menu12 = new ChildMenu("薪资查询", ChildMenu.MenuTypeEnum.view, "http://cwpt.sues.edu.cn:80/Login/Index?state=SUES!salary");
            ChildMenu menu13 = new ChildMenu("来款查询", ChildMenu.MenuTypeEnum.click, "13");
            ChildMenu menu14 = new ChildMenu("报销查询", ChildMenu.MenuTypeEnum.click, "14");
            ChildMenu menu15 = new ChildMenu("学费查询", ChildMenu.MenuTypeEnum.view, "http://cwpt.sues.edu.cn:8080/SFP_slogin");

            menu1.sub_button.Add(menu11);
            menu1.sub_button.Add(menu12);
            menu1.sub_button.Add(menu13);
            menu1.sub_button.Add(menu14);
            menu1.sub_button.Add(menu15);

            ChildMenu menu21 = new ChildMenu("报销事务", ChildMenu.MenuTypeEnum.view, "http://cwpt.sues.edu.cn:80/web/1_bxsw.html");
            ChildMenu menu22 = new ChildMenu("办税服务", ChildMenu.MenuTypeEnum.view, "http://cwpt.sues.edu.cn:80/web/2_bsfw.html");
            ChildMenu menu23 = new ChildMenu("薪资服务", ChildMenu.MenuTypeEnum.view, "http://cwpt.sues.edu.cn:80/web/3_xzfw.html");
            ChildMenu menu24 = new ChildMenu("学生事务", ChildMenu.MenuTypeEnum.view, "http://cwpt.sues.edu.cn:80/web/4_xssw.html");
            ChildMenu menu25 = new ChildMenu("公积金事务", ChildMenu.MenuTypeEnum.view, "http://cwpt.sues.edu.cn:80/web/5_gjjsw.html");

            menu2.sub_button.Add(menu21);
            menu2.sub_button.Add(menu22);
            menu2.sub_button.Add(menu23);
            menu2.sub_button.Add(menu24);
            menu2.sub_button.Add(menu25);

            ChildMenu menu31 = new ChildMenu("解除绑定", ChildMenu.MenuTypeEnum.click, "31");
            ChildMenu menu32 = new ChildMenu("在线咨询", ChildMenu.MenuTypeEnum.click, "32");
            ChildMenu menu33 = new ChildMenu("学生缴费", ChildMenu.MenuTypeEnum.click, "33");
            ChildMenu menu34 = new ChildMenu("政策法规", ChildMenu.MenuTypeEnum.click, "34");

            menu3.sub_button.Add(menu31);
            menu3.sub_button.Add(menu32);
            menu3.sub_button.Add(menu33);
            menu3.sub_button.Add(menu34);

            rootmenu.button.Add(menu1);
            rootmenu.button.Add(menu2);
            rootmenu.button.Add(menu3);
            pubCore.CreateMenu(rootmenu);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Hides the menu and any visible child menus.
        /// </summary>
        public virtual void HideMenu()
        {
// Child menu to hide?
            if (ChildMenu != null)
            {
                (ChildMenu as ContextMenu).HideMenu(true);
                ChildMenu.Dispose();
                ChildMenu = null;
            }
            if (Manager.FocusedControl is MenuBase)
            {
                Focused = true;
            }
// Force redraw and update selected index.
            Invalidate();
            ItemIndex = -1;
        }
Exemplo n.º 9
0
        /// <param name="e"></param>
        /// <summary>
        /// Handles mouse button click events for the main menu.
        /// </summary>
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            var ex = (e is MouseEventArgs) ? (MouseEventArgs)e : new MouseEventArgs();

// Left mouse button clicked?
            if (ex.Button == MouseButton.Left || ex.Button == MouseButton.None)
            {
// Selected item is in menu and usable?
                if (ItemIndex >= 0 && Items[ItemIndex].Enabled)
                {
// Selected menu entry has children?
                    if (ItemIndex >= 0 && Items[ItemIndex].Items != null && Items[ItemIndex].Items.Count > 0)
                    {
// Child menu to hide?
                        if (ChildMenu != null)
                        {
                            ChildMenu.Dispose();
                            ChildMenu = null;
                        }
// Display child menu entries for the selected entry.
                        ChildMenu = new ContextMenu(Manager);
                        (ChildMenu as ContextMenu).RootMenu   = this;
                        (ChildMenu as ContextMenu).ParentMenu = this;
                        (ChildMenu as ContextMenu).Sender     = Root;
                        ChildMenu.Items.AddRange(Items[ItemIndex].Items);

                        var y = Root.AbsoluteTop + rs[ItemIndex].Bottom + 1;
                        (ChildMenu as ContextMenu).Show(Root, Root.AbsoluteLeft + rs[ItemIndex].Left, y);
                        if (ex.Button == MouseButton.None)
                        {
                            (ChildMenu as ContextMenu).ItemIndex = 0;
                        }
                    }
                    else
                    {
// No children. If index is valid, raise the selected entry's click event.
                        if (ItemIndex >= 0)
                        {
                            Items[ItemIndex].ClickInvoke(ex);
                        }
                    }
                }
            }
        }
Exemplo n.º 10
0
        /// <param name="hideCurrent">
        /// Indicates if the context menu should be hidden (true) or if only the child menu should be
        /// hidden.
        /// </param>
        /// </summary>
        /// Hides the context menu or one of its child menus.
        /// </summary>
        public virtual void HideMenu(bool hideCurrent)
        {
// Hide this menu?
            if (hideCurrent)
            {
                Visible   = false;
                ItemIndex = -1;
            }
// Need to clean up child menu?
            if (ChildMenu != null)
            {
// Hide child and destroy it.
                (ChildMenu as ContextMenu).HideMenu(true);
                ChildMenu.Dispose();
                ChildMenu = null;
            }
        }
Exemplo n.º 11
0
        public static void CreateMenu()
        {
            RootMenu  rootmenu = new RootMenu();
            ChildMenu menu1    = new ChildMenu("信息查询");
            ChildMenu menu2    = new ChildMenu("解除绑定", ChildMenu.MenuTypeEnum.click, "2");

            ChildMenu menu11 = new ChildMenu("项目查询", ChildMenu.MenuTypeEnum.view, "http://wxcw.sta.edu.cn:80/Login/Index?state=DSTA!fund");
            ChildMenu menu12 = new ChildMenu("薪资查询", ChildMenu.MenuTypeEnum.view, "http://wxcw.sta.edu.cn:80/Login/Index?state=DSTA!salary");


            menu1.sub_button.Add(menu11);
            menu1.sub_button.Add(menu12);
            rootmenu.button.Add(menu1);
            rootmenu.button.Add(menu2);


            pubCore.CreateMenu(rootmenu);
        }
Exemplo n.º 12
0
        public static void CreateMenu()
        {
            ConditionalRootMenu rootmenu = new ConditionalRootMenu();
            ChildMenu           menu1    = new ChildMenu("菜单女一");
            ChildMenu           menu2    = new ChildMenu("菜单二", ChildMenu.MenuTypeEnum.click, "2");

            ChildMenu menu11 = new ChildMenu("子菜单一", ChildMenu.MenuTypeEnum.click, "11");
            ChildMenu menu12 = new ChildMenu("子菜单二", ChildMenu.MenuTypeEnum.view, "http://www.baidu.com");

            menu1.sub_button.Add(menu11);
            menu1.sub_button.Add(menu12);
            rootmenu.button.Add(menu1);
            rootmenu.button.Add(menu2);

            rootmenu.matchrule.sex = "2";

            pubCore.CreateMenu(rootmenu);
        }
        //public override void SetPosition(float x, float y)
        //{
        //    float distX = x - X, distY = y - Y;
        //    foreach (Control childControl in ChildControls)
        //        childControl.SetPosition(childControl.X + distX, childControl.Y + distY);
        //    base.SetPosition(x, y);
        //}
        protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device)
        {
            this.FillRectangle(device,
                               this.Theme.BackColor,
                               this.X,
                               this.Y,
                               this.Width,
                               this.Height);

            if (ChildMenu != null)
            {
                ChildMenu.Draw(device);
            }

            if (!fixedPosition && this.Y + this.Height > Program.GameController.Form.Height)
            {
                this.SetPosition(this.X, Program.GameController.Form.Height - this.Height);
            }
        }
Exemplo n.º 14
0
        public string GetBredCum(string childUrl)
        {
            const string bredcum = "";

            //Menus.Keys.Any(key => key. Contains(childUrl));
            foreach (var item in Menus.Keys)
            {
                MainMenu mm = Menus[item];
                foreach (var subKey in mm.SubMenus.Keys)
                {
                    ChildMenu sm = mm.SubMenus[subKey];
                    //if (sm.NavigationURL.ToLower() == childUrl.ToLower())
                    if (sm.NavigationUrl.ToLower().Contains(childUrl.ToLower()))
                    {
                        return(mm.MenuName + " / " + sm.MenuName);
                    }
                }
            }
            return(bredcum);
        }
Exemplo n.º 15
0
        public static void CreateMenu()
        {
            #region 菜单测试
            RootMenu rootmenu = new RootMenu();

            ChildMenu menu1 = new ChildMenu("信息查询");
            ChildMenu menu2 = new ChildMenu("业务查询");
            ChildMenu menu3 = new ChildMenu("用户信息");

            ChildMenu menu11 = new ChildMenu("薪资查询", ChildMenu.MenuTypeEnum.view, "http://Cwcw.sta.edu.cn:8003/Login/Index?state=STA!salary");
            ChildMenu menu12 = new ChildMenu("项目查询", ChildMenu.MenuTypeEnum.view, "http://Cwcw.sta.edu.cn:8003/Login/Index?state=STA!fund");
            ChildMenu menu13 = new ChildMenu("学费查询", ChildMenu.MenuTypeEnum.view, "http://Cwcw.sta.edu.cn:8003/Login/Index?state=STA!charge");
            ChildMenu menu14 = new ChildMenu("来款查询", ChildMenu.MenuTypeEnum.click, "14");
            ChildMenu menu15 = new ChildMenu("通知公告", ChildMenu.MenuTypeEnum.view, "http://cwcw.sta.edu.cn:8001/Home/Articles?m=0c356049-28f7-475f-98fa-152d51737ed5");


            menu1.sub_button.Add(menu11);
            menu1.sub_button.Add(menu12);
            menu1.sub_button.Add(menu13);
            menu1.sub_button.Add(menu14);
            menu1.sub_button.Add(menu15);

            ChildMenu menu21 = new ChildMenu("报销制度", ChildMenu.MenuTypeEnum.view, "http://cwcw.sta.edu.cn:8003/bxzn.html");
            ChildMenu menu22 = new ChildMenu("报账跟踪", ChildMenu.MenuTypeEnum.click, "22");
            ChildMenu menu23 = new ChildMenu("发票验真", ChildMenu.MenuTypeEnum.view, "https://www.tax.sh.gov.cn/wsbs/WSBSptFpCx_loginsNewl.jsp");


            menu2.sub_button.Add(menu21);
            menu2.sub_button.Add(menu22);
            menu2.sub_button.Add(menu23);

            ChildMenu menu31 = new ChildMenu("解除绑定", ChildMenu.MenuTypeEnum.click, "31");
            menu3.sub_button.Add(menu31);

            rootmenu.button.Add(menu1);
            rootmenu.button.Add(menu2);
            rootmenu.button.Add(menu3);
            pubCore.CreateMenu(rootmenu);
            #endregion
        }
Exemplo n.º 16
0
        ////////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            MouseEventArgs ex = (e is MouseEventArgs) ? (MouseEventArgs)e : new MouseEventArgs();

            if (ex.Button == MouseButton.Left || ex.Button == MouseButton.None)
            {
                if (ItemIndex >= 0 && Items[ItemIndex].Enabled)
                {
                    if (ItemIndex >= 0 && Items[ItemIndex].Items != null && Items[ItemIndex].Items.Count > 0)
                    {
                        if (ChildMenu != null)
                        {
                            ChildMenu.Dispose();
                            ChildMenu = null;
                        }
                        ChildMenu = new ContextMenu(Manager);
                        (ChildMenu as ContextMenu).RootMenu   = this;
                        (ChildMenu as ContextMenu).ParentMenu = this;
                        (ChildMenu as ContextMenu).Sender     = this.Root;
                        ChildMenu.Items.AddRange(Items[ItemIndex].Items);

                        int y = Root.AbsoluteTop + rs[ItemIndex].Bottom + 1;
                        (ChildMenu as ContextMenu).Show(this.Root, Root.AbsoluteLeft + rs[ItemIndex].Left, y);
                        if (ex.Button == MouseButton.None)
                        {
                            (ChildMenu as ContextMenu).ItemIndex = 0;
                        }
                    }
                    else
                    {
                        if (ItemIndex >= 0)
                        {
                            Items[ItemIndex].ClickInvoke(ex);
                        }
                    }
                }
            }
        }
Exemplo n.º 17
0
        } // HideMenu

        #endregion

        #region On Click

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            MouseEventArgs ex = (e is MouseEventArgs) ? (MouseEventArgs)e : new MouseEventArgs();

            if (ex.Button == MouseButton.Left || ex.Button == MouseButton.None)
            {
                if (ItemIndex >= 0 && Items[ItemIndex].Enabled)
                {
                    if (ItemIndex >= 0 && Items[ItemIndex].Items != null && Items[ItemIndex].Items.Count > 0)
                    {
                        if (ChildMenu != null)
                        {
                            ChildMenu.Dispose();
                            ChildMenu = null;
                        }
                        ChildMenu = new ContextMenu();
                        (ChildMenu as ContextMenu).RootMenu = this;
                        (ChildMenu as ContextMenu).ParentMenu = this;
                        (ChildMenu as ContextMenu).Sender = Root;
                        ChildMenu.Items.AddRange(Items[ItemIndex].Items);

                        int y = Root.ControlTopAbsoluteCoordinate + rectangle[ItemIndex].Bottom + 1;
                        (ChildMenu as ContextMenu).Show(Root, Root.ControlLeftAbsoluteCoordinate + rectangle[ItemIndex].Left, y);
                        if (ex.Button == MouseButton.None) 
                            (ChildMenu as ContextMenu).ItemIndex = 0;
                    }
                    else
                    {
                        if (ItemIndex >= 0)
                        {
                            Items[ItemIndex].OnClick(ex);
                        }
                    }
                }
            }
        } // OnClick
Exemplo n.º 18
0
 //to notify when a childmenu was closed
 //so UI/HUD can update their status
 public static void OnChildMenuClosed(ChildMenu childMenu)
 {
     ChildMenuClosed?.Invoke(childMenu);
 }