예제 #1
0
        public virtual void CreateMenuItems(List <ChartTemplateInfo> templateList)
        {
            if (_ContainerForm != null && _ContainerForm.ClientRuleObject != null)
            {
                string gridName = _ContainerForm.GetType().FullName + "~" + _XtraGrid.Name + "~" + _ContainerForm.GetType().Assembly.GetName().Name;
                string ruleName = _ContainerForm.ClientRuleObject.GetType().FullName + "~" + _ContainerForm.ClientRuleObject.GetType().Assembly.GetName().Name;

                ChartTemplateInfo templateInfo = new ChartTemplateInfo();
                templateInfo.RULE_PATH     = ruleName;
                templateInfo.GRID_NAME     = gridName;
                templateInfo.TEMPLATE_TYPE = "PUBLIC";
                templateInfo.CREATE_USER   = MB.WinBase.AppEnvironmentSetting.Instance.CurrentLoginUserInfo.USER_CODE;

                ChartMenu addMenu = new ChartMenu("默认图表", new EventHandler(menuItemClick), "ChartModule", templateInfo);
                _TemplateMenu.MenuItems.Add(addMenu);
            }

            if (templateList == null || templateList.Count == 0)
            {
                return;
            }
            foreach (var template in templateList)
            {
                ChartMenu menu = new ChartMenu(template.NAME, new EventHandler(menuItemClick), "TemplateChartModule", template);
                _TemplateMenu.MenuItems.Add(menu);
            }
        }
예제 #2
0
        private void menuItemClick(object sender, System.EventArgs e)
        {
            try
            {
                ChartMenu menu = sender as ChartMenu;
                if (menu == null)
                {
                    return;
                }

                ChartTemplateInfo template = menu.Template;
                showChart(_XtraGrid, menu.ItemName, ref template);

                menu.Template = template;
            }
            catch (Exception ex)
            {
                MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
            }
        }