示例#1
0
 public static CheckBox GetCheckbox(MenuType menuType, string uniqueName)
 {
     CheckBox checkbox = getMenu(menuType).Get<CheckBox>(uniqueName);
     if (checkbox == null)
         Console.WriteLine("Checkbox " + uniqueName + " does not exist under this menu type: " + menuType.ToString());
     return checkbox;
 }
示例#2
0
    public Vector2 SetMenu(MenuType menuType)
    {
        string[] temp = (string[])GetType().GetField(menuType.ToString()).GetValue(this);
        //List<Button> buttons = GetComponentsInChildren<Button>(true).ToList();
        Vector2 newSize = new Vector2(m_ButtonBaseSize.x + 20, 20 + temp.Length * m_ButtonBaseSize.y);

        menuBase.rectTransform.sizeDelta = newSize;
        //int Count = 0;
        for (int i = 0; i < m_Buttons.Length; i++)
        {
            m_Buttons[i].gameObject.SetActive(false);
        }
        for (int i = 0; i < temp.Length; i++)
        {
            m_ButtonDic[temp[i]].SetActive(true);
        }
        //for (int i = 0; i < buttons.Count; i++)
        //{
        //    if (temp.Contains(buttons[i].name))
        //    {
        //        buttons[i].image.rectTransform.position = menuBase.rectTransform.position + new Vector3(newSize.x / 2, -(10 + 40 * Count), 0);
        //        Count++;
        //    }
        //    else
        //    {
        //        buttons[i].image.rectTransform.position = menuBase.rectTransform.position + new Vector3(Screen.width + 100, Screen.height + 100, 0);
        //    }
        //}

        return(newSize);
    }
示例#3
0
    public void OpenMenu(MenuType menuType, bool isSingleOnScreen = false)
    {
        _canvas = GameObject.FindGameObjectWithTag("MainCanvas").GetComponent <Canvas>();
        MenuData menuData = _menuDataList.menuDataList.Find(x => x.menuType == menuType);

        if (menuData == null)
        {
            Debug.LogError("MenuManager:OpenMenu The menu " + menuType.ToString() + "you are trying to open doesn`t exist.");
            return;
        }

        if (isSingleOnScreen)
        {
            CloseAllMenus();
        }
        //ifatuTODO - check if this is needed or corect
        //Destroy(_currentMenu);
        //_currentMenu = null;
        _currentMenu = Instantiate(menuData.menuPrefab, transform.position, Quaternion.identity);
        _currentMenu.transform.SetParent(_canvas.transform, false);



        //   _currentMenu.transform.position = new Vector3(0, 0, 0);
        // _currentMenu.transform.localScale = new Vector3(1, 1, 1);
        _menuStack.Add(_currentMenu);
    }
示例#4
0
        /// <summary>
        /// Gets the menu.
        /// </summary>
        /// <param name="account">The account.</param>
        /// <param name="menuType">Type of the menu.</param>
        /// <returns>DataTable.</returns>
        public static DataTable GetMenu(String account, MenuType menuType)
        {
            if (string.IsNullOrEmpty(account))
            {
                throw new ArgumentNullException("account", "account cannot be a null reference (Nothing in VB) or empty!");
            }
            BAccounts mBAccount = new BAccounts(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
            DataTable mRetVal   = null;

            if (account.ToUpper(CultureInfo.InvariantCulture) == "ANONYMOUS")
            {
                String mAnonMenu = menuType.ToString() + "Anonymous";
                mRetVal = (DataTable)HttpContext.Current.Cache[mAnonMenu];
                if (mRetVal == null)
                {
                    mRetVal = mBAccount.GetMenu(account, menuType);
                    CacheController.AddToCacheDependency(mAnonMenu, mRetVal);
                }
            }
            else
            {
                String mMenuName = account + "_" + menuType.ToString() + "_MenuData";
                if (HttpContext.Current.Session != null)
                {
                    mRetVal = (DataTable)HttpContext.Current.Session[mMenuName];
                    if (mRetVal == null)
                    {
                        mRetVal = mBAccount.GetMenu(account, menuType);
                        foreach (DataRow item in mRetVal.Rows)
                        {
                            item["URL"] = "?Action=" + item["URL"].ToString();
                        }
                        HttpContext.Current.Session[mMenuName] = mRetVal;
                    }
                }
                else
                {
                    mRetVal = mBAccount.GetMenu(account, menuType);
                    foreach (DataRow item in mRetVal.Rows)
                    {
                        item["URL"] = "?Action=" + item["URL"].ToString();
                    }
                }
            }
            return(mRetVal);
        }
    public static bool ShowMenu(MenuType menuType)
    {
        bool   showMenu   = false;
        string appSetting = ConfigurationManager.AppSettings["YourKey"];

        if (!String.IsNullOrEmpty(appSetting))
        {
            showMenu = appSetting.Contains("/" + (int)menuType.ToString() + "/");
        }
        return(showMenu);
    }
示例#6
0
        /// <summary>
        /// 根据菜单类型查询菜单
        /// </summary>
        /// <param name="MType">菜单类型</param>
        /// <returns></returns>
        public List <IMenu> QueryMenus(MenuType MType)
        {
            IMenu    menu = entityfactory.CreateEntityInstance <IMenu>();
            IDvTable dvt  = entityfactory.CreateDriveTable(menu);

            menu.MENUTYPE = MType.ToString();
            dvt.WhereClause("MENUTYPE", Operator.Deng, LinkOperator.nul);
            DataSet      ds   = dvt.Select();
            List <IMenu> list = this.dh.Convert <IMenu>(menu.GetType(), ds);

            return(list);
        }
示例#7
0
 public XisMenu(EA.Repository repository, EA.Diagram diagram, EA.Package package, string name, MenuType type)
     : base(repository)
 {
     if (type == MenuType.ContextMenu)
     {
         Element = XisWebHelper.CreateXisMenu(package, name, type);
         Items = new List<XisMenuItem>();
     }
     else
     {
         throw new Exception("Unsupported constructor for XisMenu of type: " + type.ToString());
     }
 }
示例#8
0
        /// <summary>
        /// 根据角色名和菜单类型查询菜单
        /// </summary>
        /// <param name="Role">角色</param>
        /// <param name="MType">菜单类型</param>
        /// <returns></returns>
        public List <IMenu> QueryMenus(IRole Role, MenuType MType)
        {
            IMenu menu = entityfactory.CreateEntityInstance <IMenu>();

            menu.MENUTYPE = MType.ToString();
            IAuthControl actrl = entityfactory.CreateEntityInstance <IAuthControl>();

            actrl.RoleCode = Role.RoleCode;
            IDvTable dvt = entityfactory.CreateDriveTable(menu);

            dvt.Join.Entitys.Add(actrl);
            dvt.WhereClause("MENUTYPE", Operator.Deng, LinkOperator.and);
            dvt.WhereClause(actrl, "RoleCode", Operator.Deng, LinkOperator.nul);
            DataSet      ds     = dvt.Select();
            List <IMenu> list   = this.dh.Convert <IMenu>(menu.GetType(), ds);
            List <IMenu> result = RefactoringMenu(list);

            return(result);
        }
示例#9
0
        public static EA.Element CreateXisMenu(EA.Package package, string name, MenuType type)
        {
            EA.Element menu = package.Elements.AddNew(name, "Class");
            menu.Stereotype = "XisMenu";
            menu.Update();

            foreach (EA.TaggedValue tv in menu.TaggedValues)
            {
                switch (tv.Name)
                {
                    case "name":
                        tv.Value = name;
                        break;
                    case "type":
                        tv.Value = type.ToString();
                        break;
                    default:
                        break;
                }
                tv.Update();
            }
            return menu;
        }
示例#10
0
        NavigationPage PageForOption(MenuType option)
        {
            switch (option)
            {
            case MenuType.Historia:
            {
                if (infopage != null)
                {
                    return(infopage);
                }

                infopage = new NavigationPage(new InfoPage());
                return(infopage);
            }

//			case MenuType.Agenda:
//				{
//					if (agenda != null)
//						return agenda;
//
//					agenda= new NavigationPage(new InfoPage());
//					return agenda;
//				}
            case MenuType.Contato:
            {
                if (contato != null)
                {
                    return(contato);
                }

                contato = new NavigationPage(new Contato());

                return(contato);
            }

            case MenuType.Copos:
            {
                if (copos != null)
                {
                    return(copos);
                }

                copos = new NavigationPage(new Copos.Copos());
                return(copos);
            }

            case MenuType.Cervejas:
            {
                if (cervejas != null)
                {
                    return(cervejas);
                }

                cervejas = new NavigationPage(new Catalog.CatalogCarouselView());
                return(cervejas);
            }

            case MenuType.Parceiros:
            {
                if (parceiros != null)
                {
                    return(parceiros);
                }

                parceiros = new NavigationPage(new Parceiros.ParceirosView());
                return(parceiros);
            }
            }

            throw new NotImplementedException("Opção desconhecida de Menu: " + option.ToString());
        }
示例#11
0
 public MenuItemBase(string _name, MenuType _mtype = MenuType.Default, List <IMenuItem> _sub_button = null)
 {
     this.name       = _name;
     _type           = _mtype == MenuType.Default ? null : _mtype.ToString();
     this.sub_button = _sub_button;
 }
示例#12
0
        NavigationPage PageForOption (MenuType option)
        {

          switch (option)
          {
            case MenuType.Dashboard:
              {
                if (dashboard != null)
                  return dashboard;
                  
                var vm = new DashboardViewModel() { Navigation = Navigation };

                dashboard = new NavigationPage(new DashboardView(vm));
                return dashboard;
              }
            case MenuType.Accounts:
              {
                if (accounts != null)
                  return accounts;

                var vm = new AccountsViewModel() { Navigation = Navigation };
                accounts = new NavigationPage(new AccountsView(vm));

                return accounts; 
              }
            case MenuType.Leads:
              {
                if (leads != null)
                  return leads;
                
                leads =  new NavigationPage(new Leads.LeadsView(new ViewModels.Leads.LeadsViewModel() { Navigation = Navigation }));
                return leads;
              }
            case MenuType.Contacts:
              {
                if (contacts != null)
                  return contacts;
                var vm = new ContactsViewModel();
                contacts = new NavigationPage(new Contacts.ContactsView(vm));
                return contacts;
              } 
            case MenuType.Catalog:
              {
                  if (catalog != null)
                      return catalog;

                  catalog = new NavigationPage(new Catalog.CatalogCarouselView());
                  return catalog;
              }

              case MenuType.Settings:
              {
                  if (settings != null)
                      return settings;

                  settings = new NavigationPage(new Settings.UserSettingsView());
                  return settings;
              }

          }
            
          throw new NotImplementedException("Unknown menu option: " + option.ToString());
        }
示例#13
0
        NavigationPage PageForOption(MenuType option)
        {
            switch (option)
            {
            case MenuType.Dashboard:
            {
                if (dashboard != null)
                {
                    return(dashboard);
                }

                var vm = new DashboardViewModel()
                {
                    Navigation = Navigation
                };

                dashboard = new NavigationPage(new DashboardView(vm));
                return(dashboard);
            }

            case MenuType.Accounts:
            {
                if (accounts != null)
                {
                    return(accounts);
                }

                var vm = new AccountsViewModel()
                {
                    Navigation = Navigation
                };
                accounts = new NavigationPage(new AccountsView(vm));

                return(accounts);
            }

            case MenuType.Leads:
            {
                if (leads != null)
                {
                    return(leads);
                }

                leads = new NavigationPage(new Leads.LeadsView(new ViewModels.Leads.LeadsViewModel()
                    {
                        Navigation = Navigation
                    }));
                return(leads);
            }

            case MenuType.Contacts:
            {
                if (contacts != null)
                {
                    return(contacts);
                }
                var vm = new ContactsViewModel();
                contacts = new NavigationPage(new Contacts.ContactsView(vm));
                return(contacts);
            }

            case MenuType.Catalog:
            {
                if (catalog != null)
                {
                    return(catalog);
                }

                catalog = new NavigationPage(new Catalog.CatalogCarouselView());
                return(catalog);
            }

            case MenuType.Settings:
            {
                if (settings != null)
                {
                    return(settings);
                }

                settings = new NavigationPage(new Settings.UserSettingsView());
                return(settings);
            }
            }

            throw new NotImplementedException("Unknown menu option: " + option.ToString());
        }
 public DataTable GetLeftSideMenuData(MenuType MenuType)
 {
     if (SessionObjects.obj.RequestTypeMasterPropertiesObject.LeftNavigationLinks != null)
     {
         return(SessionObjects.obj.RequestTypeMasterPropertiesObject.LeftNavigationLinks.Tables[MenuType.ToString()]);
     }
     else
     {
         return(null);
     }
 }