Ejemplo n.º 1
0
        public object assemblyPage(string projName, List <Grids> grids, List <DataGrids> datas)
        {
            List <string> vs = new List <string>();

            int[] ids   = new int[10];
            int   count = 0;

            foreach (var ds in grids)
            {
                int     t       = 0;
                int     ts      = 0;
                Strings strings = new Strings();
                string  xaml    = strings.borderLevel(t++, Buttons.CreateButton(ds.strs));//整个界面

                string tmp = "";
                int    j   = 0;
                for (; j < ds.grids.Count; j++)
                {
                    var rs = ds.grids[j];
                    if (rs.CONTROL_NAME == "btn")
                    {
                        var res = Buttons.CreateButton_new(rs.NAME, rs.CODE);
                        tmp += res;
                    }
                    else if (rs.CONTROL_NAME == "NEXT_LINE")
                    {
                        var borders = strings.borderLevel(t++, tmp);
                        tmp   = "";
                        xaml += borders;
                    }
                    else if (rs.CONTROL_NAME == "DATAGRID")
                    {
                        dynamic res = strings.DataGrid(datas[ts].ItemsSource, datas[ts].SelectedItem, datas[ts].PageSize, datas[ts].TotalCount, datas[ts].PageIndex, datas[ts].IsSelectedAll, ds.grids, j);
                        ts++;
                        tmp += res.str;
                        j    = res.count - 1;
                    }
                    else if (rs.CONTROL_NAME == "FOOTER")
                    {
                        dynamic res = MyControls.AddFooter();
                        tmp += res;
                    }
                    else if (rs.CONTROL_NAME == "CustomControl")
                    {
                        var control = NewPage.NewPage.CCDic[rs.NAME];
                        var list    = NewPage.NewPage.PropertiesDic[rs.NAME];
                        tmp += Strings.formatString(control, list);
                    }
                    else
                    {
                        dynamic res = MyControls.CreateContents_new(ds.grids, j);
                        tmp += res.str;
                        j    = res.count - 1;
                    }
                }
                ids[count++] = ts;

                string xamlCode = "";
                if (ds.Identity == "主页")
                {
                    xamlCode = strings.PageXaml(projName, ds.PageCode, xaml);
                }
                else
                {
                    xaml     = xaml.Replace("RelativeSource={RelativeSource AncestorType=common:PagePlugin, Mode=FindAncestor}", "RelativeSource={RelativeSource AncestorType=common:WindowPlugin, Mode=FindAncestor}");//全选替换 否则不能全选
                    xamlCode = strings.WindowXaml(projName, ds.PageCode, xaml);
                }

                vs.Add(xamlCode);
            }
            return(new
            {
                vs,
                ids
            });
        }