zoukankan      html  css  js  c++  java
  • dev的documentManager,多个tab窗体

    控件vs的menuStrip+dev的documentManager

    private void CreateData(List<Funcation> modules)
            {
                modules.Add(new Funcation() { ID = 1, PID = -1, FunctionName = "统计数据", FunctionKey = "" });
                modules.Add(new Funcation() { ID = 2, PID = 1, FunctionName = "未打单统计数据", FunctionKey = "ClientGoodInfo.PlaySingleInfo.frmPlaySingleInfo" });
                modules.Add(new Funcation() { ID = 3, PID = 1, FunctionName = "Rides未打单统计", FunctionKey = "ClientGoodInfo.RedisData.frmPlaySingleInfo" });
            }
    
            private void LoadItemModules()
            {
                List<Funcation> modules = new List<Funcation>();
                CreateData(modules);
                LoadItemModules(modules, -1, menuItem.Items);
            }
    
            public void LoadItemModules(List<Funcation> modules, int parentModuleNO, ToolStripItemCollection items)
            {
                foreach (var module in modules)
                {
                    if (module.PID != parentModuleNO) continue;
                    var item = new ToolStripMenuItem();
                    object runner = null;
                    if (!string.IsNullOrWhiteSpace(module.FunctionKey))
                    {
                        var typeFullNames = module.FunctionKey.Split(',');
                        foreach (var typeFullName in typeFullNames)
                        {
                            runner = ReflectFormType.Reflect(typeFullName);
                            if (runner != null) break;
                        }
                    }
                    if (runner == null && !modules.Any(m => m.PID == module.ID)) continue;
                    item.Text = module.FunctionName;
                    item.Tag = module;
                    items.Add(item);
                    item.Click += item_Click;
                    LoadItemModules(modules, module.ID, item.DropDownItems);
                }
            }
    
            private void item_Click(object sender, EventArgs e)
            {
                var type = ((ToolStripMenuItem)sender).Tag as Funcation;
                if (type != null)
                    AddDocument(type);
            }
    
            private void AddDocument(Funcation CurrentModel)
            {
                if (!string.IsNullOrWhiteSpace(CurrentModel.FunctionKey))
                {
                    var typeFullNames = CurrentModel.FunctionKey.Split(',');
                    foreach (var typeFullName in typeFullNames)
                    {
                        var type = ReflectFormType.GetFrom(typeFullName);//反射窗体类型
                        if (type != null)
                        {
                            foreach (BaseDocument fdocument in tabbedView1.Documents)
                            {
                                if (fdocument.Tag == type)
                                {
                                    tabbedView1.Controller.Activate(fdocument);//是否已经打开窗体
                                    return;
                                }
                            }
                            tabbedView1.BeginUpdate();//开始加载窗体
                            tabbedView1.Manager.MdiParent = this;
                            BaseDocument document = tabbedView1.AddDocument(type);
                            document.Footer = Directory.GetCurrentDirectory();
                            document.Tag = type;
                            tabbedView1.Controller.Activate(document);
                            tabbedView1.EndUpdate();
                            break;
                        }
                    }
                }
            }
  • 相关阅读:
    接口测试之Postman简介
    postman发送get请求
    postman添加权限验证
    接口测试基础
    postman发送post请求
    postman测试上传文件
    1 R语言介绍
    《荣枯鉴》明鉴卷六
    《荣枯鉴》节仪卷五
    《荣枯鉴》交结卷四
  • 原文地址:https://www.cnblogs.com/shuaimeng/p/9716997.html
Copyright © 2011-2022 走看看