/// <summary>
        /// Generate the MenuButtons collection
        /// </summary>
        private void GenerateMenuButtons()
        {
            // Retrieve the Report group DTO from the service
            ReportGroupListDTOModel dto = _service.GetReportGroups();

            // Check for errors
            if (dto.HasError)
            {
                ErrorMessage = dto.ErrorMessage;
                return;
            }

            MenuGroupButtons = new List <MenuGroupButton>();
            // Add each menu button from the dto to the group
            foreach (ReportGroup grp in dto.Items)
            {
                MenuGroupButton btn = new MenuGroupButton {
                    ButtonText = grp.Name, IsDisabled = IsAuthenticated, ToolTip = grp.Description
                };
                btn.MenuButtons = new List <MenuButton>();
                foreach (ReportDef def in grp.ReportDefs)
                {
                    btn.MenuButtons.Add(new MenuButton {
                        ButtonText = def.Name, IsDisabled = IsAuthenticated, ToolTip = def.Description
                    });
                }
                MenuGroupButtons.Add(btn);
            }
            ;
        }
Example #2
0
        public void TestCreateMenuApiForProduction()
        {
            base.context.AppId     = "wx19f2c832d0adfe65";
            base.context.AppSecret = "9070efa9140c8f1fc32828afddad5ee8";
            ICreateMenuApi api           = new CreateMenuApi(context);
            var            jsonContainer = new CreateMenuApiJsonDataContainer();
            var            menugroup1    = new MenuGroupButton()
            {
                Name = "产品介绍"
            };

            menugroup1.SubButtons.Add(new ClickButton()
            {
                Name = "neuScan", Key = "qrcode_generation"
            });
            menugroup1.SubButtons.Add(new ClickButton()
            {
                Name = "neuPrint", Key = "realtime_print"
            });
            menugroup1.SubButtons.Add(new ClickButton()
            {
                Name = "neuForm", Key = "neuzilla_formassistant"
            });
            menugroup1.SubButtons.Add(new ClickButton()
            {
                Name = "关于Neuzilla", Key = "about_neuzilla"
            });
            jsonContainer.Buttons.Add(menugroup1);
            jsonContainer.Buttons.Add(new ViewUrlButton()
            {
                Name = "历史消息", Url = "http://mp.weixin.qq.com/mp/getmasssendmsg?__biz=MzIzOTM1MDYzNw==#wechat_webview_type=1&wechat_redirect"
            });

            jsonContainer.Buttons.Add(new ScancodePushButton()
            {
                Name = "扫一扫", Key = "scan_menu"
            });
            api.JsonData = jsonContainer;
            var response = api.Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual(0, response.errcode);
        }
Example #3
0
        public void TestCreateMenuApi()
        {
            ICreateMenuApi api           = new CreateMenuApi(context);
            var            jsonContainer = new CreateMenuApiJsonDataContainer();
            var            menugroup1    = new MenuGroupButton()
            {
                Name = "产品介绍"
            };

            menugroup1.SubButtons.Add(new ClickButton()
            {
                Name = "二维码实时生成", Key = "qrcode_generation"
            });
            menugroup1.SubButtons.Add(new ClickButton()
            {
                Name = "公众号实时打印技术", Key = "realtime_print"
            });
            menugroup1.SubButtons.Add(new ClickButton()
            {
                Name = "Neuzilla表单助手", Key = "neuzilla_formassistant"
            });
            menugroup1.SubButtons.Add(new ClickButton()
            {
                Name = "关于Neuzilla", Key = "about_neuzilla"
            });
            jsonContainer.Buttons.Add(menugroup1);
            jsonContainer.Buttons.Add(new ViewUrlButton()
            {
                Name = "历史消息", Url = "http://mp.weixin.qq.com/mp/getmasssendmsg?__biz=MzIzOTM1MDYzNw==#wechat_webview_type=1&wechat_redirect"
            });

            jsonContainer.Buttons.Add(new ScancodePushButton()
            {
                Name = "扫一扫", Key = "scan_menu"
            });
            api.JsonData = jsonContainer;
            var response = api.Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual(0, response.errcode);
        }