Пример #1
0
        public Button CreateButton(JObject buttonObj, Color hover, Color fill, Color border, Color font, IMenuModule menuModule, string parentId)
        {
            Rectangle bounds  = CreateElementBounds(buttonObj);
            string    text    = buttonObj.Value <string>("label");
            string    action  = buttonObj.Value <string>("action");
            string    payload = "";

            try { payload = buttonObj.Value <string>("payload"); } catch { }

            string id   = buttonObj.Value <string>("id");
            string type = buttonObj.Value <string>("type");

            //build command for button
            MenuCommandFactory menuCommandFac = new MenuCommandFactory(menuModule);
            ICommand           command        = menuCommandFac.Create(action, payload, parentId);

            switch (type.ToLower())
            {
            case "nonstick":
                return(new NonStickButton(id, command, bounds, hover, fill, border, font, text));

            default:
                return(new Button(id, command, bounds, hover, fill, border, font, text));
            }
        }