Example #1
0
        static void AddMenuItem(string text, MenuItemType type)
        {
            var menuitem = cmIcon.Items.Add(text);

            menuitem.Tag    = type;
            menuitem.Click += MenuItemClick;
        }
        public void NavigateTo(MenuItemType menuItemType)
        {
            MenuPages.Clear();
            if (!MenuPages.ContainsKey(menuItemType))
            {
                switch (menuItemType)
                {
                case MenuItemType.Home:
                    MenuPages.Add(menuItemType, new NavigationPage(new BooksListPage()));
                    break;

                case MenuItemType.AddNewBook:
                    MenuPages.Add(menuItemType, new NavigationPage(new AddNewBookPage()));
                    break;

                case MenuItemType.About:
                    MenuPages.Add(menuItemType, new NavigationPage(new AboutPage()));
                    break;

                default:
                    break;
                }

                NavigationPage newPage = MenuPages[menuItemType];

                if (newPage != null && Detail != newPage)
                {
                    Detail      = newPage;
                    IsPresented = false;
                }
            }
        }
Example #3
0
        public async Task NavigateFromMenu(MenuItemType id)
        {
            if (!_menuPages.ContainsKey(id))
            {
                switch (id)
                {
                case MenuItemType.Characters:
                    _menuPages.Add(id, new NavigationPage(new CharactersPage()));
                    break;

                case MenuItemType.About:
                    _menuPages.Add(id, new NavigationPage(new AboutPage()));
                    break;
                }
            }

            var newPage = _menuPages[id];

            if (newPage != null && Detail != newPage)
            {
                Detail = newPage;

                if (Device.RuntimePlatform == Device.Android)
                {
                    await Task.Delay(100);
                }

                IsPresented = false;
            }
        }
        //MenuItemType Object Scope Validation check the entire object for validity...
        private byte MenuItemTypeIsValid(MenuItemType item, out string errorMessage)
        {   //validate key
            errorMessage = "";
            if (string.IsNullOrEmpty(item.MenuItemTypeID))
            {
                errorMessage = "ID Is Required.";
                return(1);
            }
            EntityStates entityState = GetMenuItemTypeState(item);

            if (entityState == EntityStates.Added && MenuItemTypeExists(item.MenuItemTypeID, ClientSessionSingleton.Instance.CompanyID))
            {
                errorMessage = "Item All Ready Exists.";
                return(1);
            }
            //check cached list for duplicates...
            int count = MenuItemTypeList.Count(q => q.MenuItemTypeID == item.MenuItemTypeID);

            if (count > 1)
            {
                errorMessage = "Item All Ready Exists.";
                return(1);
            }
            //validate Description
            if (string.IsNullOrEmpty(item.Description))
            {
                errorMessage = "Description Is Required.";
                return(1);
            }
            //a value of 2 is pending changes...
            //On Commit we will give it a value of 0...
            return(2);
        }
Example #5
0
 public NavTarget(string label, string link, ClassDisplayType classType, MenuItemType menuItemType)
 {
     Label        = label;
     Link         = link;
     ClassType    = classType;
     MenuItemType = menuItemType;
 }
Example #6
0
        public AutoFilterViewModel(string name, MenuItemType type)
        {
            Name         = name;
            MenuItemType = type;

            MessengerInstance.Register <UpdateNoteList>(this, ReloadNoteList);
        }
Example #7
0
        public bool EnableMenuItem(MenuItemType menuItem, bool enable, bool select = true)
        {
            MenuItem item = _menuItems.FirstOrDefault(c => c.Item == menuItem);

            if (item == null)
            {
                return(false);
            }

            if (item.Enable == enable)
            {
                return(true);
            }

            item.Enable = enable;

            RecalculateMenuItemsPosition(_menuItems);

            if (select)
            {
                _selectedMenuItem = item;
            }
            else
            {
                _selectedMenuItem = _menuItems.Where(c => c.Enable).OrderBy(c => c.Position).FirstOrDefault();
            }

            return(true);
        }
Example #8
0
        /// <summary>
        /// Constructor for HomeMenuItem; it initializes the properties.
        /// </summary>
        /// <param name="id"></param>
        public HomeMenuItem(MenuItemType id)
        {
            Id = id;
            switch (id)
            {
            case MenuItemType.SevenDayView:
                Title = "7-Day View";
                break;

            case MenuItemType.WeeklyView:
                Title = "Weekly View";
                break;

            case MenuItemType.MonthlyView:
                Title = "Monthy View";
                break;

            case MenuItemType.DishDB:
                Title = "Dish Database";
                break;

            case MenuItemType.DishCategories:
                Title = "Dish Categories";
                break;

            case MenuItemType.About:
                Title = "About";
                break;
            }
        }
Example #9
0
 public ReloadNoteMenuList(MenuItemType type)
 {
     LibraryType  = type;
     Notebook     = null;
     SelectedNote = null;
     Tag          = null;
 }
 public ItemsViewModel(MenuItemType item_type)
 {
     Title            = "Browse";
     cur_item_type    = item_type;
     Items            = new ObservableCollection <Item>();
     LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());
 }
Example #11
0
        public void Show(BaibianType baibianType, MenuItemType type, System.Action closeCallback = null)
        {
            _closeCallback = closeCallback;
            int value = (int)baibianType;

            if (type == MenuItemType.宝宝存钱罐)
            {
                gege.SetActive(false);
                jiejie.SetActive(false);
                jiejieZunqianguan.SetActive(true);
            }
            else
            {
                gege.SetActive(value % 2 != 0);
                jiejie.SetActive(value % 2 == 0);
                jiejieZunqianguan.SetActive(false);
            }
            gameObject.SetActive(true);
            if (menuStrs.ContainsKey(type))
            {
                text.text     = "";
                text.fontSize = 36;
                var str = menuStrs[type];
                _textTweener = text.DOText(str, 3f);
                _textTweener.SetEase(Ease.Linear);
            }
            else
            {
                text.text = "";
            }
        }
Example #12
0
        public MenuItemViewModel GetMenuItem(MenuItemType type)
        {
            switch (type)
            {
            case MenuItemType.ShowWindow:
                return(GetViewModel("Menu.ShowWindow", x => _windowsManager.ActivateMainWindow()));

            case MenuItemType.AddDevice:
                return(GetViewModel("Menu.AddDevice", x => throw new NotImplementedException()));

            case MenuItemType.CheckForUpdates:
                return(GetViewModel("Menu.CheckForUpdates", x => throw new NotImplementedException()));

            case MenuItemType.ChangePassword:
                return(GetViewModel("Menu.ChangePassword", x => throw new NotImplementedException()));

            case MenuItemType.UserManual:
                return(GetViewModel("Menu.UserManual", x => OnOpenUrl("Url.UserManual")));

            case MenuItemType.TechnicalSupport:
                return(GetViewModel("Menu.TechnicalSupport", x => Task.Run(() => OnTechSupportAsync("SupportMail"))));

            case MenuItemType.LiveChat:
                return(GetViewModel("Menu.LiveChat", x => OnOpenUrl("Url.LiveChat")));

            case MenuItemType.Legal:
                return(GetViewModel("Menu.Legal", x => OnOpenUrl("Url.Legal")));

            case MenuItemType.RFIDUsage:
                return(GetViewModel("Menu.RFIDUsage", x => OnOpenUrl("Url.RFIDUsage")));

            case MenuItemType.VideoTutorial:
                return(GetViewModel("Menu.VideoTutorial", x => OnOpenUrl("Url.VideoTutorial")));

            case MenuItemType.LogOff:
                return(GetViewModel("Menu.LogOff", x => throw new NotImplementedException()));

            case MenuItemType.Exit:
                return(GetViewModel("Menu.Exit", x => _appHelper.Shutdown()));

            case MenuItemType.Language:
                return(GetLanguages());

            case MenuItemType.LaunchOnStartup:
                return(GetLaunchOnStartup());

            case MenuItemType.GetLogsSubmenu:
                return(GetLogsSubmenu());

            case MenuItemType.Help:
                return(GetViewModel("Menu.Help", x => OnOpenUrl("Url.Help")));

            case MenuItemType.Separator:
                return(null);

            default:
                Debug.Assert(false, $"The type: {type} of menu is not supported.");
                return(null);
            }
        }
Example #13
0
        public MenuItemViewModel GetMenuItem(Device device, MenuItemType type)
        {
            if (device == null)
            {
                Debug.Assert(false, "Vault can not be null.");
            }

            switch (type)
            {
            case MenuItemType.DisconnectDevice:
                return(GetMenuDisconnectDevice(device));

            case MenuItemType.RemoveDevice:
                return(GetMenuRemoveDevice(device));

            case MenuItemType.AuthorizeDeviceAndLoadStorage:
                return(GetMenuAuthorizeAndLoadStorage(device));

            case MenuItemType.AboutDevice:
                return(null);    // TODO: About device menu

            case MenuItemType.SetAsActiveDevice:
                return(GetMenuSetAsActiveDevice(device));

            default:
                Debug.Assert(false, $"The type: {type} of menu is not supported.");
                return(null);
            }
        }
        public MenuItemType GetMenuItemTypeByRestaurantIdTypeName(int restaurantId, string selectedMenuItemType)
        {
            MenuItemType menuItemType = _dbContext.MenuItemTypes
                                        .SingleOrDefault(m => m.Restaurant.Id == restaurantId && m.TypeName == selectedMenuItemType);

            return(menuItemType);
        }
Example #15
0
        public MainPage(MenuItemType type)
        {
            InitializeComponent();

            MasterBehavior = MasterBehavior.Popover;
            _ = NavigateFromMenu((int)type);
        }
Example #16
0
        /// <summary>
        /// Add an item with a specific action to execute. Note that this consumes the UserObject
        /// for the item added. This can be used with AutoAcceptRunAction set to true to make the
        /// menu automatically run the actions it is given.
        /// </summary>
        /// <param name="name">The name of the item, this will appear in the menu.</param>
        /// <param name="type">The type of item to add.</param>
        /// <param name="action">The Action to run when clicked if AutoAcceptRunAction is true. This will consume the UserObject for the menu item.</param>
        /// <returns>A new MenuItem.</returns>
        public MenuItem addItemAction(String name, MenuItemType type, Action action)
        {
            MenuItem item = addItem(name, type);

            item.UserObject = action;
            return(item);
        }
 public void VirtualDeleteItem(long IdItem, MenuItemType itemType)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout(rootObject.EditMenuBar(View.IdMenubar, View.PreviousView));
     }
     else
     {
         dtoItem item    = Service.GetFather(IdItem, itemType);
         Boolean deleted = false;
         if (item != null)
         {
             deleted = Service.VirtualDeleteItem(IdItem, itemType);
         }
         if (!deleted)
         {
             View.DeleteError(itemType);
         }
         else
         {
             View.LoadMenubar(Service.MenubarToTree(View.IdMenubar), item);
             this.SelectItem(item);
         }
     }
 }
 public CoolStuffListItem(MenuItemType topic, string label, Lazy <ContentPage> modalItem)
 {
     this.Icon      = Functions.CreateMenuIcon(topic, Functions.GetThemeColour(topic));
     this.Topic     = topic;
     this.Label     = label;
     this.ModalItem = modalItem;
 }
        public async Task <HttpResponseMessage> AddMenuItemType(int id, int menuItemTypeId)
        {
            try
            {
                MenuItemType res = await _db.MenuItemTypes.Where(d => d.MenuItem_id == id && d.Type_id == menuItemTypeId).FirstOrDefaultAsync();

                if (res != null)
                {
                    if (res.Deleted)
                    {
                        res.Deleted = false;
                        _db.SetModified(res);
                        await _db.SaveChangesAsync();
                    }
                }
                else
                {
                    _db.MenuItemTypes.Add(new MenuItemType
                    {
                        MenuItem_id = id,
                        Type_id     = menuItemTypeId
                    });
                    await _db.SaveChangesAsync();
                }

                return(Request.CreateResponse(HttpStatusCode.OK, "Success"));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Failed"));
            }
        }
Example #20
0
        public static Frame CreateMenuIcon(MenuItemType id, Color topicColour)
        {
            string filename = id switch
            {
                MenuItemType.Astrophysics => "astro.png",
                MenuItemType.ClassicalMechanics => "classical.png",
                MenuItemType.Electromagnetism => "electromag.png",
                MenuItemType.FluidDynamics => "fluid.png",
                MenuItemType.Mathematics => "maths.png",
                MenuItemType.ModernPhysics => "circles.png",
                MenuItemType.Thermodynamics => "thermo.png",
                MenuItemType.QuantumPhysics => "quantum.png",
                MenuItemType.CoolStuff => "cool.png",
                _ => throw new ArgumentOutOfRangeException(nameof(id), id, null)
            };
            Frame imageFrame = new Frame()
            {
                Content = new Image
                {
                    Source          = CreateImageSource($"Icons.{filename}"),
                    Style           = (Style)Application.Current.Resources["MenuIcon"],
                    BackgroundColor = topicColour
                },
                BackgroundColor = Color.White,
                BorderColor     = Color.Transparent,
                Padding         = 2,
            };

            return(imageFrame);
        }
 private void ChangeKeyLogic()
 {
     if (!string.IsNullOrEmpty(SelectedMenuItemType.MenuItemTypeID))
     {//check to see if key is part of the current companylist...
         MenuItemType query = MenuItemTypeList.Where(company => company.MenuItemTypeID == SelectedMenuItemType.MenuItemTypeID &&
                                                     company.AutoID != SelectedMenuItemType.AutoID).FirstOrDefault();
         if (query != null)
         {//revert it back...
             SelectedMenuItemType.MenuItemTypeID = SelectedMenuItemTypeMirror.MenuItemTypeID;
             //change to the newly selected company...
             SelectedMenuItemType = query;
             return;
         }
         //it is not part of the existing list try to fetch it from the db...
         MenuItemTypeList = GetMenuItemTypeByID(SelectedMenuItemType.MenuItemTypeID, XERP.Client.ClientSessionSingleton.Instance.CompanyID);
         if (MenuItemTypeList.Count == 0)//it was not found do new record required logic...
         {
             NotifyNewRecordNeeded("Record " + SelectedMenuItemType.MenuItemTypeID + " Does Not Exist.  Create A New Record?");
         }
         else
         {
             SelectedMenuItemType = MenuItemTypeList.FirstOrDefault();
         }
     }
     else
     {
         string errorMessage = "ID Is Required.";
         NotifyMessage(errorMessage);
         //revert back to the value it was before it was changed...
         if (SelectedMenuItemType.MenuItemTypeID != SelectedMenuItemTypeMirror.MenuItemTypeID)
         {
             SelectedMenuItemType.MenuItemTypeID = SelectedMenuItemTypeMirror.MenuItemTypeID;
         }
     }
 }
Example #22
0
        private void MenuItemSelected(object sender, MenuItemType e)
        {
            switch (e)
            {
            case MenuItemType.NewGane:
                _world.WorldState = WorldState.NewGame;
                _gameState        = SpacetrisGameState.Game;
                break;

            case MenuItemType.Continue:
                _world.WorldState = WorldState.Continue;
                _gameState        = SpacetrisGameState.Game;
                break;

            case MenuItemType.Scores:
                break;

            case MenuItemType.Quit:
                Window.Close();
                break;

            case MenuItemType.Sound:
                break;

            case MenuItemType.Music:
                break;
            }
        }
 /// <summary>
 ///   Create AI Selector
 /// </summary>
 /// <param name = "name"></param>
 /// <param name = "selectedAIIndex"></param>
 public MenuItem(String name, int selectedAIIndex)
 {
     MenuItemType = MenuItemType.AISelector;
     Name = name;
     SelectedAIIndex = selectedAIIndex;
     Enabled = true;
 }
 /// <summary>
 ///   Create a Bool MenuItem
 /// </summary>
 /// <param name = "name"></param>
 /// <param name = "value"></param>
 public MenuItem(String name, bool value)
 {
     MenuItemType = MenuItemType.Bool;
     Name = name;
     BoolValue = value;
     Enabled = true;
 }
    private void AddSelectTableData(AtomEntryCollection colectCollection, MenuItemType sheet)
    {
        int counter = 0;

        for (int i = 4; i < colectCollection.Count; i++)
        {
            CellEntry cell = colectCollection[i] as CellEntry;
            switch (counter)
            {
            case 0:
                _runtimeDbSelect[sheet].Add(new BaseDataForSelectWindow()
                {
                    Id = int.Parse(cell.Value)
                }); break;

            case 1: _runtimeDbSelect[sheet].Last().Name = cell.Value; break;

            case 2: _runtimeDbSelect[sheet].Last().Price = cell.Value; break;

            case 3:
                _runtimeDbSelect[sheet].Last().AvatarSprite = cell.Value;
                counter = -1; break;
            }
            counter++;
        }
    }
        public JsonResult getTemplate(MenuItemType type)
        {
            db.Configuration.ProxyCreationEnabled = false;
            List <PageTemplate> listTemp = db.PageTemp.Where(x => x.Type == type).ToList();

            return(Json(listTemp, JsonRequestBehavior.AllowGet));
        }
        public void Bootstrap(string connectionString)
        {
            using (var db = CMSContextFactory.Create(connectionString))
            {
                //init extendsion
                var extension = db.Extensions.SingleOrDefault(ext => ext.Namespace == "Components.CategoryList.CategoryListComponentController");
                if (extension == null)
                {
                    extension = new Extension()
                    {
                        Namespace = "Components.CategoryList.CategoryListComponentController"
                    };
                    db.Add(extension);
                }


                //init 'Single Article' menu type
                var menuItemType = db.MenuItemTypes.SingleOrDefault(type => type.Id == 2);
                if (menuItemType == null)
                {
                    menuItemType = new MenuItemType()
                    {
                        Id          = 2,
                        Name        = "Category List",
                        ExtensionId = 2
                    };
                    db.Add(menuItemType);
                }

                db.SaveChanges();
            }
        }
        public static List <Temp> GetMetaData(this MenuItemType entityObject)
        {
            XERP.Server.DAL.MenuSecurityDAL.DALUtility dalUtility = new DALUtility();
            List <Temp> tempList = new List <Temp>();
            int         id       = 0;

            using (MenuSecurityEntities ctx = new MenuSecurityEntities(dalUtility.EntityConectionString))
            {
                var c            = ctx.MenuItemTypes.FirstOrDefault();
                var queryResults = from meta in ctx.MetadataWorkspace.GetItems(DataSpace.CSpace)
                                   .Where(m => m.BuiltInTypeKind == BuiltInTypeKind.EntityType)
                                   from query in (meta as EntityType).Properties
                                   .Where(p => p.DeclaringType.Name == entityObject.GetType().Name)
                                   select query;

                if (queryResults.Count() > 0)
                {
                    foreach (var queryResult in queryResults.ToList())
                    {
                        Temp temp = new Temp();
                        temp.ID          = id;
                        temp.Name        = queryResult.Name.ToString();
                        temp.ShortChar_1 = queryResult.TypeUsage.EdmType.Name;
                        if (queryResult.TypeUsage.EdmType.Name == "String")
                        {
                            temp.Int_1 = Convert.ToInt32(queryResult.TypeUsage.Facets["MaxLength"].Value);
                        }
                        temp.Bool_1 = false; //we use this as a error trigger false = not an error...
                        tempList.Add(temp);
                        id++;
                    }
                }
            }
            return(tempList);
        }
        public async void NavigateFromMenu(MenuItemType type)
        {
            Page page = null;

            switch (type)
            {
            case MenuItemType.Profile:
                page = new NavigationPage(new ProfilePage());
                break;

            case MenuItemType.Feed:
                page = new NavigationPage(new FeedPage());
                break;

            case MenuItemType.Map:
                page = new NavigationPage(new MapPage());
                break;

            case MenuItemType.Manage:
                page = new NavigationPage(new ManagePage());
                break;

            case MenuItemType.Favorites:
                page = new NavigationPage(new FavoritesPage());
                break;
            }

            if (page != null && Detail != page)
            {
                Detail = page;

                IsPresented = false;
            }
        }
Example #30
0
        public IEnumerable <MenuItemType> GetMenuItemTypes(MenuItemType securityGroupTypeQuerryObject, string companyID)
        {
            _repositoryContext             = new MenuSecurityEntities(_rootUri);
            _repositoryContext.MergeOption = MergeOption.AppendOnly;
            _repositoryContext.IgnoreResourceNotFoundException = true;
            var queryResult = from q in _repositoryContext.MenuItemTypes
                              where q.CompanyID == companyID
                              select q;

            if (!string.IsNullOrEmpty(securityGroupTypeQuerryObject.Type))
            {
                queryResult = queryResult.Where(q => q.Type.StartsWith(securityGroupTypeQuerryObject.Type.ToString()));
            }

            if (!string.IsNullOrEmpty(securityGroupTypeQuerryObject.Description))
            {
                queryResult = queryResult.Where(q => q.Description.StartsWith(securityGroupTypeQuerryObject.Description.ToString()));
            }

            if (!string.IsNullOrEmpty(securityGroupTypeQuerryObject.MenuItemTypeID))
            {
                queryResult = queryResult.Where(q => q.Description.StartsWith(securityGroupTypeQuerryObject.MenuItemTypeID.ToString()));
            }

            return(queryResult);
        }
Example #31
0
        public void DeleteFromRepository(MenuItemType securityGroupType)
        {
            if (_repositoryContext.GetEntityDescriptor(securityGroupType) != null)
            {//if it exists in the db delete it from the db
                MenuSecurityEntities context = new MenuSecurityEntities(_rootUri);
                context.MergeOption = MergeOption.AppendOnly;
                context.IgnoreResourceNotFoundException = true;
                MenuItemType deletedMenuItemType = (from q in context.MenuItemTypes
                                                    where q.MenuItemTypeID == securityGroupType.MenuItemTypeID
                                                    select q).FirstOrDefault();
                if (deletedMenuItemType != null)
                {
                    context.DeleteObject(deletedMenuItemType);
                    context.SaveChanges();
                }
                context = null;

                _repositoryContext.MergeOption = MergeOption.AppendOnly;
                //if it is being tracked remove it...
                if (GetMenuItemTypeEntityState(securityGroupType) != EntityStates.Detached)
                {
                    _repositoryContext.Detach(securityGroupType);
                }
            }
        }
        public void DeleteMenuItemTypeCommand()
        {
            try
            {//company is fk to 100's of tables deleting it can be tricky...
                int i  = 0;
                int ii = 0;
                for (int j = SelectedMenuItemTypeList.Count - 1; j >= 0; j--)
                {
                    MenuItemType item = (MenuItemType)SelectedMenuItemTypeList[j];
                    //get Max Index...
                    i = MenuItemTypeList.IndexOf(item);
                    if (i > ii)
                    {
                        ii = i;
                    }
                    Delete(item);
                    MenuItemTypeList.Remove(item);
                }

                if (MenuItemTypeList != null && MenuItemTypeList.Count > 0)
                {
                    //back off one index from the max index...
                    ii = ii - 1;

                    //if they delete the first row...
                    if (ii < 0)
                    {
                        ii = 0;
                    }

                    //make sure it does not exceed the list count...
                    if (ii >= MenuItemTypeList.Count())
                    {
                        ii = MenuItemTypeList.Count - 1;
                    }

                    SelectedMenuItemType = MenuItemTypeList[ii];
                    //we will only enable committ for dirty validated records...
                    if (Dirty == true)
                    {
                        AllowCommit = CommitIsAllowed();
                    }
                    else
                    {
                        AllowCommit = false;
                    }
                }
                else//only one record, deleting will result in no records...
                {
                    SetAsEmptySelection();
                }
            }//we try catch company delete as it may be used in another table as a key...
            //As well we will force a refresh to sqare up the UI after the botched delete...
            catch
            {
                NotifyMessage("MenuItemType/s Can Not Be Deleted.  Contact XERP Admin For More Details.");
                Refresh();
            }
        }
 /// <summary>
 ///   Create a slider MenuItem. A slider is a menuItem that has an integer value that 
 ///   can be set anywhere within a range. For example, a slider menu item might be used
 ///   to ask the user for Mouse Sensitivity.
 /// </summary>
 /// <param name = "name"></param>
 /// <param name = "value"></param>
 /// <param name = "maxValue">The maximum inclusive value for the slider</param>
 /// <param name = "minValue">The minimum inclusive value for the slider</param>
 /// <param name = "step"></param>
 public MenuItem(String name, int value, int maxValue, int minValue, int step)
 {
     MenuItemType = MenuItemType.Slider;
     Name = name;
     MaxSliderValue = maxValue;
     MinSliderValue = minValue;
     SliderValue = value;
     _sliderStep = step;
     Enabled = true;
 }
Example #34
0
        public MenuItem(string text, MenuItemType type = MenuItemType.Text, MenuItemAction action = MenuItemAction.None)
        {
            if (type == MenuItemType.Checkbox && action == MenuItemAction.Refresh)
            {
                action = MenuItemAction.Refresh;
            }

            Text = text;
            Type = type;
            Action = action;
        }
Example #35
0
 public static MenuItemType NextItemType(MenuItemType t)
 {
     switch (t)
     {
         case MenuItemType.System:
             return MenuItemType.Supply;
         case MenuItemType.Supply:
             return MenuItemType.Quest;
         default:
             return MenuItemType.Invalid;
     }
 }
Example #36
0
 public static MenuItemType PreviousItemType(MenuItemType t)
 {
     switch (t)
     {
         case MenuItemType.Supply:
             return MenuItemType.System;
         case MenuItemType.Quest:
             return MenuItemType.Supply;
         default:
             return MenuItemType.Invalid;
     }
 }
Example #37
0
        public void RegistMenuItem(String itemName, String level, String group, MenuItemType type, EventHandler command)
        {
            ToolStripItemCollection curLvlCol = menuCtrl.MainMenuStrip.Items;

            ToolStripDropDownItem item = (ToolStripDropDownItem)curLvlCol.Find(level, false).ElementAt(0);
            if (item == null)
                menuCtrl.MainMenuStrip.Items.Add(level);

            item.DropDownItems.Add(itemName, null, command);

            // TODO Group处理
        }
Example #38
0
        public ScrollView GetAddNewLayout(MenuItemType type, BaseMenuItem item = null)
        {
            var scrollView = new ScrollView(this);
            var layout = new LinearLayout(this);
            layout.Orientation = Orientation.Vertical;

            var aLabel = new TextView(this);
            aLabel.Text = string.Format("What is the name of the {0}?", type.ToString());
            layout.AddView(aLabel);

            var textField = new EditText(this);
            layout.AddView(textField);

            var saveButton = new Button(this);
            saveButton.Text = "Create";
            saveButton.Click += (sender, e) =>
            {
                switch (type)
                {
                    case MenuItemType.Game:
                        menu.Games.Add(new GameNode(textField.Text));
                        UpdateMenu();
                        SetContentView(GetHomeLayout());
                        break;
                    case MenuItemType.PlayerCharacter:
                        var newCharacter = new PlayerCharacterNode(textField.Text, (GameNode)item);
                        ((GameNode)item).Characters.Add(newCharacter);
                        var gameItem = (GameNode)UpdateMenu(type, newCharacter);
                        SetContentView(GetGameLayout(gameItem));
                        break;
                    case MenuItemType.Opponent:
                        var newOpponent = new OpponentMatchupNode(textField.Text, (PlayerCharacterNode)item);
                        ((PlayerCharacterNode)item).Opponents.Add(newOpponent);
                        var newItem = (PlayerCharacterNode)UpdateMenu(type, newOpponent);
                        SetContentView(GetCharacterLayout(newItem));
                        break;
                    default:
                        break;
                }
            };
            layout.AddView(saveButton);
            scrollView.AddView(layout);

            return scrollView;
        }
 public MenuItem AddItem(
     string _name ,
     MenuItemType _type ,
     string _id ,
     object _data)
 {
     return  ExportMenuControl_AddItem_name_type_id_data( mNative ,
          _name ,
          _type ,
          _id ,
          _data )  ;
 }
Example #40
0
 public SearchBox SetType(MenuItemType type)
 {
     this.ItemType = type;
     return this;
 }
Example #41
0
 public MenuItem(string label, MenuItemType type)
     : this()
 {
     Label = label;
     Type = type;
 }
 public MenuItem InsertItemAt(
     uint _index ,
     string _name ,
     MenuItemType _type ,
     string _id)
 {
     return  ExportMenuCtrl_InsertItemAt_index_name_type_id( mNative ,
          _index ,
          _name ,
          _type ,
          _id )  ;
 }
Example #43
0
 public Link SetType(MenuItemType type)
 {
     this.ItemType = type;
     return this;
 }
Example #44
0
        public void Frame(float time)
        {
            if(inventory == null || inventory.Count == 0)
            {
                CurrentState = InventoryState.Disabled;
                NextState = InventoryState.Disabled;
                return;
            }

            switch(CurrentState)
            {
                case InventoryState.RLeft:
                    ringTime += time;
                    ringAngle = ringAngleStep * ringTime / ringRotatePeriod;
                    NextState = InventoryState.RLeft;
                    if(ringTime >= ringRotatePeriod)
                    {
                        ringTime = 0.0f;
                        ringAngle = 0.0f;
                        NextState = InventoryState.Idle;
                        CurrentState = InventoryState.Idle;
                        itemsOffset--;
                        if(itemsOffset < 0)
                        {
                            itemsOffset = currentItemsCount - 1;
                        }
                    }
                    restoreItemAngle(time);
                    break;

                case InventoryState.RRight:
                    ringTime += time;
                    ringAngle = -ringAngleStep * ringTime / ringRotatePeriod;
                    NextState = InventoryState.RRight;
                    if (ringTime >= ringRotatePeriod)
                    {
                        ringTime = 0.0f;
                        ringAngle = 0.0f;
                        NextState = InventoryState.Idle;
                        CurrentState = InventoryState.Idle;
                        itemsOffset++;
                        if (itemsOffset >= currentItemsCount)
                        {
                            itemsOffset = 0;
                        }
                    }
                    restoreItemAngle(time);
                    break;

                case InventoryState.Idle:
                    ringTime = 0.0f;
                    switch(NextState)
                    {
                        default:
                        case InventoryState.Idle:
                            itemTime += time;
                            itemAngle = 360.0f * itemTime / itemRotatePeriod;
                            if(itemTime >= itemRotatePeriod)
                            {
                                itemTime = 0.0f;
                                itemAngle = 0.0f;
                            }
                            LabelItemName.Show = true;
                            LabelTitle.Show = true;
                            break;

                        case InventoryState.Closed:
#if !NO_AUDIO
                            Audio.Send((uint) EngineLua.GetGlobalSound((int) TR_AUDIO_SOUND_GLOBALID.MenuClose));
#endif
                            LabelItemName.Show = false;
                            LabelTitle.Show = false;
                            CurrentState = NextState;
                            break;

                        case InventoryState.RLeft:
                        case InventoryState.RRight:
#if !NO_AUDIO
                            Audio.Send((uint) TR_AUDIO_SOUND.MenuRotate);
#endif
                            LabelItemName.Show = false;
                            CurrentState = NextState;
                            itemTime = 0.0f;
                            break;

                        case InventoryState.Up:
                            nextItemsCount = getItemsTypeCount(StaticFuncs.NextItemType(currentItemsType));
                            if(nextItemsCount > 0)
                            {
                                CurrentState = NextState;
                                ringTime = 0.0f;
                            }
                            else
                            {
                                NextState = InventoryState.Idle;
                            }
                            LabelItemName.Show = false;
                            LabelTitle.Show = false;
                            break;

                        case InventoryState.Down:
                            nextItemsCount = getItemsTypeCount(StaticFuncs.PreviousItemType(currentItemsType));
                            if (nextItemsCount > 0)
                            {
                                CurrentState = NextState;
                                ringTime = 0.0f;
                            }
                            else
                            {
                                NextState = InventoryState.Idle;
                            }
                            LabelItemName.Show = false;
                            LabelTitle.Show = false;
                            break;
                    }
                    break;

                case InventoryState.Disabled:
                    if(NextState == InventoryState.Open)
                    {
                        if(SetItemsType(currentItemsType) != MenuItemType.Invalid)
                        {
#if !NO_AUDIO
                            Audio.Send((uint) EngineLua.GetGlobalSound((int) TR_AUDIO_SOUND_GLOBALID.MenuOpen));
#endif
                            CurrentState = InventoryState.Open;
                            ringAngle = 180.0f;
                            ringVerticalAngle = 180.0f;
                        }
                    }
                    break;

                case InventoryState.Up:
                    CurrentState = InventoryState.Up;
                    NextState = InventoryState.Up;
                    ringTime += time;
                    if(ringTime < ringRotatePeriod)
                    {
                        restoreItemAngle(time);
                        ringRadius = baseRingRadius * (ringRotatePeriod - ringTime) / ringRotatePeriod;
                        verticalOffset = -baseRingRadius * ringTime / ringRotatePeriod;
                        ringAngle += 180.0f * time / ringRotatePeriod;
                    }
                    else if(ringTime < 2.0f * ringRotatePeriod)
                    {
                        if(ringTime - time <= ringRotatePeriod)
                        {
                            ringRadius = 0.0f;
                            verticalOffset = baseRingRadius;
                            ringAngleStep = 360.0f / nextItemsCount;
                            ringAngle = 180.0f;
                            currentItemsType = StaticFuncs.NextItemType(currentItemsType);
                            currentItemsCount = nextItemsCount;
                            itemsOffset = 0;
                            SetTitle(currentItemsType);
                        }
                        ringRadius = baseRingRadius * (ringTime - ringRotatePeriod) / ringRotatePeriod;
                        verticalOffset -= baseRingRadius * time / ringRotatePeriod;
                        ringAngle -= 180.0f * time / ringRotatePeriod;
                    }
                    else
                    {
                        NextState = InventoryState.Idle;
                        CurrentState = InventoryState.Idle;
                        ringAngle = 0.0f;
                        verticalOffset = 0.0f;
                    }
                    break;

                case InventoryState.Down:
                    CurrentState = InventoryState.Down;
                    NextState = InventoryState.Down;
                    ringTime += time;
                    if (ringTime < ringRotatePeriod)
                    {
                        restoreItemAngle(time);
                        ringRadius = baseRingRadius * (ringRotatePeriod - ringTime) / ringRotatePeriod;
                        verticalOffset = baseRingRadius * ringTime / ringRotatePeriod;
                        ringAngle += 180.0f * time / ringRotatePeriod;
                    }
                    else if (ringTime < 2.0f * ringRotatePeriod)
                    {
                        if (ringTime - time <= ringRotatePeriod)
                        {
                            ringRadius = 0.0f;
                            verticalOffset = -baseRingRadius;
                            ringAngleStep = 360.0f / nextItemsCount;
                            ringAngle = 180.0f;
                            currentItemsType = StaticFuncs.PreviousItemType(currentItemsType);
                            currentItemsCount = nextItemsCount;
                            itemsOffset = 0;
                            SetTitle(currentItemsType);
                        }
                        ringRadius = baseRingRadius * (ringTime - ringRotatePeriod) / ringRotatePeriod;
                        verticalOffset += baseRingRadius * time / ringRotatePeriod;
                        ringAngle -= 180.0f * time / ringRotatePeriod;
                    }
                    else
                    {
                        NextState = InventoryState.Idle;
                        CurrentState = InventoryState.Idle;
                        ringAngle = 0.0f;
                        verticalOffset = 0.0f;
                    }
                    break;

                case InventoryState.Open:
                    ringTime += time;
                    ringRadius = baseRingRadius * ringTime / ringRotatePeriod;
                    ringAngle -= 180.0f * time / ringRotatePeriod;
                    ringVerticalAngle -= 180.0f * time / ringRotatePeriod;
                    if(ringTime >= ringRotatePeriod)
                    {
                        CurrentState = InventoryState.Idle;
                        CurrentState = InventoryState.Idle;
                        ringVerticalAngle = 0.0f;

                        ringRadius = baseRingRadius;
                        ringTime = 0.0f;
                        ringAngle = 0.0f;
                        verticalOffset = 0.0f;
                        SetTitle(MenuItemType.Supply);
                    }
                    break;

                case InventoryState.Closed:
                    ringTime += time;
                    ringRadius = baseRingRadius * (ringRotatePeriod - ringTime) / ringRotatePeriod;
                    ringAngle += 180.0f * time / ringRotatePeriod;
                    ringVerticalAngle += 180.0f * time / ringRotatePeriod;
                    if (ringTime >= ringRotatePeriod)
                    {
                        CurrentState = InventoryState.Disabled;
                        CurrentState = InventoryState.Disabled;
                        ringVerticalAngle = 0.0f;
                        ringTime = 0.0f;
                        LabelTitle.Show = false;
                        ringRadius = baseRingRadius;
                        currentItemsType = MenuItemType.Supply;
                    }
                    break;
            }
        }
 public MenuItem AddItem(
     string _name ,
     MenuItemType _type ,
     string _id)
 {
     return  ExportMenuCtrl_AddItem_name_type_id( mNative ,
          _name ,
          _type ,
          _id )  ;
 }
 public MenuItem InsertItemAt(
     uint _index ,
     string _name ,
     MenuItemType _type ,
     string _id ,
     object _data)
 {
     return  ExportMenuControl_InsertItemAt_index_name_type_id_data( mNative ,
          _index ,
          _name ,
          _type ,
          _id ,
          _data )  ;
 }
 public void SetItemType(
     MenuItem _item ,
     MenuItemType _type)
 {
     ExportMenuControl_SetItemType_item_type( mNative ,
          _item ,
          _type );
 }
Example #48
0
 public void SetType(MenuItemType type)
 {
     throw new NotImplementedException ();
 }
Example #49
0
        public bool CreateItem(uint itemID, uint modelID, uint worldModelID, MenuItemType type, ushort count,
            string name)
        {
            var model = GetModelByID(modelID);
            if (model == null)
            {
                return false;
            }

            var bf = new SSBoneFrame();
            bf.FromModel(model);

            var item = new BaseItem
            {
                ID = itemID,
                WorldModelId = worldModelID,
                Type = type,
                Count = count,
                Name = (char) 0 + name, // TODO: Is it useful?
                BoneFrame = bf
            };

            ItemsTree[item.ID] = item;

            return true;
        }
 /// <summary>
 ///   Create a transition MenuItem
 /// </summary>
 /// <param name = "name"></param>
 public MenuItem(String name)
 {
     MenuItemType = MenuItemType.Transition;
     Name = name;
     Enabled = true;
 }
Example #51
0
        public InventoryManager()
        {
            CurrentState = InventoryState.Disabled;
            NextState = InventoryState.Disabled;
            currentItemsType = MenuItemType.System;
            currentItemsCount = 0;
            itemsOffset = 0;
            nextItemsCount = 0;

            ringRotatePeriod = 0.5f;
            ringTime = 0.0f;
            ringAngle = 0.0f;
            ringVerticalAngle = 0.0f;
            ringAngleStep = 0.0f;
            baseRingRadius = 600.0f;
            ringRadius = 600.0f;
            verticalOffset = 0.0f;

            itemRotatePeriod = 4.0f;
            itemTime = 0.0f;
            itemAngle = 0.0f;

            inventory = new List<InventoryNode>();

            LabelTitle = new TextLine();
            LabelTitle.X = 0.0f;
            LabelTitle.Y = 30.0f;
            LabelTitle.Xanchor = HorizontalAnchor.Center;
            LabelTitle.Yanchor = VerticalAnchor.Top;

            LabelTitle.FontID = FontType.Primary;
            LabelTitle.StyleID = FontStyle.MenuTitle;
            LabelTitle.Show = false;

            LabelItemName = new TextLine();
            LabelItemName.X = 0.0f;
            LabelItemName.Y = 50.0f;
            LabelItemName.Xanchor = HorizontalAnchor.Center;
            LabelItemName.Yanchor = VerticalAnchor.Bottom;
                 
            LabelItemName.FontID = FontType.Primary;
            LabelItemName.StyleID = FontStyle.MenuContent;
            LabelItemName.Show = false;

            Gui.AddLine(LabelItemName);
            Gui.AddLine(LabelTitle);
        }
Example #52
0
        public void SetTitle(MenuItemType itemsType)
        {
            var stringIndex = 0;

            switch (itemsType)
            {
                case MenuItemType.System:
                    stringIndex = STR_GEN_OPTIONS_TITLE;
                    break;

                case MenuItemType.Quest:
                    stringIndex = STR_GEN_ITEMS;
                    break;

                case MenuItemType.Supply:
                default:
                    stringIndex = STR_GEN_INVENTORY;
                    break;
            }

            LabelTitle.Text = EngineLua.GetString(stringIndex);
        }
 public MenuItem AddItem(
     string _name ,
     MenuItemType _type)
 {
     return  ExportMenuControl_AddItem_name_type( mNative ,
          _name ,
          _type )  ;
 }
Example #54
0
 private int getItemsTypeCount(MenuItemType type)
 {
     return inventory.Count(i => EngineWorld.GetBaseItemByID(i.ID)?.Type == type);
 }
 public MenuItem InsertItem(
     MenuItem _to ,
     string _name ,
     MenuItemType _type ,
     string _id ,
     object _data)
 {
     return  ExportMenuControl_InsertItem_to_name_type_id_data( mNative ,
          _to ,
          _name ,
          _type ,
          _id ,
          _data )  ;
 }
Example #56
0
        public MenuItemType SetItemsType(MenuItemType type)
        {
            if(inventory == null || inventory.Count == 0)
            {
                currentItemsType = type;
                return type;
            }

            var count = getItemsTypeCount(type);
            if(count == 0)
            {
                foreach (var i in inventory)
                {
                    var bi = EngineWorld.GetBaseItemByID(i.ID);
                    if(bi != null)
                    {
                        type = bi.Type;
                        count = getItemsTypeCount(currentItemsType);
                        break;
                    }
                }
            }

            if(count > 0)
            {
                currentItemsCount = count;
                currentItemsType = type;
                ringAngleStep = 360.0f / currentItemsCount;
                itemsOffset %= count;
                ringTime = 0.0f;
                ringAngle = 0.0f;
                return type;
            }

            return MenuItemType.Invalid;
        }
 public MenuItem InsertItemAt(
     uint _index ,
     string _name ,
     MenuItemType _type)
 {
     return  ExportMenuControl_InsertItemAt_index_name_type( mNative ,
          _index ,
          _name ,
          _type )  ;
 }
Example #58
0
        public void SetType(MenuItemType type)
        {
            switch (type) {
                case MenuItemType.RadioButton:
                case MenuItemType.CheckBox:
                    this.menuItem.IsCheckable = true;
                    break;
                case MenuItemType.Normal:
                    this.menuItem.IsCheckable = false;
                    break;
            }

            this.type = type;
        }
 public void SetItemTypeAt(
     uint _index ,
     MenuItemType _type)
 {
     ExportMenuControl_SetItemTypeAt_index_type( mNative ,
          _index ,
          _type );
 }
Example #60
0
        public BaseMenuItem UpdateMenu(MenuItemType? type = null, BaseMenuItem item = null)
        {
            foreach(var game in menu.Games)
            {
                foreach(var character in game.Characters)
                {
                    character.Opponents = character.Opponents.OrderBy(x => x.Title).ToList();
                }
                game.Characters = game.Characters.OrderBy(x => x.Title).ToList();
            }
            menu.Games = menu.Games.OrderBy(x => x.Title).ToList();
            XmlSerializer serializer = new XmlSerializer(typeof(MenuNode));
            string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            string filename = Path.Combine(path, "Data.xml");
            using (var streamWriter = new StreamWriter(filename))
            {
                serializer.Serialize(streamWriter, menu);
            }

            string content;

            using (var streamReader = new StreamReader(filename))
            {
                content = streamReader.ReadToEnd();
            }

            menu = menuFactory.GetMenu(content);
            if(type.HasValue && item != null)
            {
                switch(type.Value)
                {
                    case MenuItemType.PlayerCharacter:
                        PlayerCharacterNode pCharacter = (PlayerCharacterNode)item;
                        return menu.Games.Where(x => x.Title == pCharacter.Parent.Title).First();
                    case MenuItemType.Opponent:
                        OpponentMatchupNode oMatchup = (OpponentMatchupNode)item;
                        return menu.Games.Where(x => x.Title == oMatchup.Parent.Parent.Title).First()
                            .Characters.Where(y => y.Title == oMatchup.Parent.Title).First();
                }
            }
            return null;
        }