Beispiel #1
0
 private void ArrangeAppControl(AppControl ac, MapControlType mapControlType)
 {
     if (mapControlType == MapControlType.AppGridMenu)
     {
         // 将现appControl整理为新的appControl
         AppGridMenu gridMenu = new AppGridMenu();
         gridMenu.Title     = ac.MenuTitle == null ? string.Empty : ac.MenuTitle.Text;
         gridMenu.ShortCuts = ac.ShortCuts;
         gridMenu.Menutems  = ac.Menutems;
         gridMenu.Html      = ac.Html == null ? string.Empty : ac.Html.Text;
         ac.Control         = gridMenu;
     }
     else if (mapControlType == MapControlType.AppFormMenu)
     {
         AppFormMenu formMenu = new AppFormMenu();
         formMenu.Menus     = ac.Menus;
         formMenu.ShortCuts = ac.ShortCuts;
         ac.Control         = formMenu;
     }
     else if (mapControlType == MapControlType.AppFind)
     {
         AppFind appFind = (ac.Control as AppFind);
         if (appFind != null)
         {
             appFind.View = ac.View;
             ac.Control   = appFind;
         }
     }
     else if (mapControlType == MapControlType.AppViewList)
     {
         AppViewList appViewList = new AppViewList();
         appViewList.View = ac.View;
         ac.Control       = appViewList;
     }
 }
Beispiel #2
0
        /// <summary>
        /// 控件整理,移除不支持的控件,给AppGrid附上标题
        /// 得到MapPage对象后都需要调用
        /// </summary>
        public void Arrange()
        {
            int appGridIndex     = -1;
            int appGridMenuIndex = -1;

            for (int i = this.Controls.Count - 1; i >= 0; i--)
            {
                AppControl ac = this.Controls[i];
                if (ac.MenuTitle != null)
                {
                    appGridMenuIndex = i;
                }
                else if (ac.Control is AppGrid)
                {
                    appGridIndex = i;
                }

                if (this.IsNotSupport(ac))
                {
                    this.Controls.Remove(ac);
                }

                // 将不规范的appgridmenu及appformmenu整理
                if (ac.MenuTitle != null)
                {
                    ArrangeAppControl(ac, MapControlType.AppGridMenu);
                }
                else if (ac.Menus != null && ac.Menus.Count > 0)
                {
                    ArrangeAppControl(ac, MapControlType.AppFormMenu);
                }
                else if (ac.View != null)
                {
                    if (ac.Control != null && ac.Control.ControlType == MapControlType.AppFind)
                    {
                        ArrangeAppControl(ac, MapControlType.AppFind);
                    }
                    else
                    {
                        ArrangeAppControl(ac, MapControlType.AppViewList);
                    }
                }
                else
                {
                    MapControlType jdControlType = getJDControlType(ac);
                    if (jdControlType != MapControlType.Loader)
                    {
                        ArrangeAppControl(ac, jdControlType);
                    }
                }
            }

            //给appGrid加上标题
            if ((appGridIndex > -1) && (appGridMenuIndex > -1))
            {
                this.Controls[appGridIndex].Describe = this.Controls[appGridMenuIndex].MenuTitle.Text;
            }
        }