Esempio n. 1
0
        /// <summary>
        ///设置PageViewItem 的内容
        /// </summary>
        /// <param name="pageViewItem"></param>
        /// <param name="features"></param>
        private static PagerPage GetPagerPage(ILayer pLayer, IList <IFeature> features)
        {
            IList <MapTabDictoryCustom> datas = new List <MapTabDictoryCustom>();



            IFields             fs           = (pLayer as IFeatureLayer).FeatureClass.Fields;
            IList <FieldCustom> fieldCustoms = new List <FieldCustom>();

            for (int a = 0; a < fs.FieldCount; a++)
            {
                IField field = fs.Field[a];


                if (!field.AliasName.Equals("Shape"))
                {
                    FieldCustom fieldCustom = new FieldCustom {
                        Index = a, Editable = field.Editable, AliasName = field.AliasName, Name = field.Name
                    };

                    fieldCustoms.Add(fieldCustom);
                }
            }
            IList <JToken> jTokens = new List <JToken>();
            Dictionary <string, object> dic;

            foreach (IFeature feature in features)
            {
                dic = new Dictionary <string, object>();
                foreach (FieldCustom fieldCustom in fieldCustoms)
                {
                    dic.Add(fieldCustom.AliasName, feature.Value[fieldCustom.Index]);
                }

                //JToken jToken = JToken.FromObject(dic);
                //jTokens.Add(jToken);

                MapTabDictoryCustom data = new MapTabDictoryCustom {
                    Dic = dic
                };
                datas.Add(data);
            }
            PagerPage mapTablePagerPage = new MapTablePagerPage(features, pLayer);

            mapTablePagerPage.SetPagerPage(datas, fieldCustoms);

            return(mapTablePagerPage);

            //return PagerPage.GetPagerPage<TestGrid>(PagerPage.GetList(110), fieldCustoms);
            // return PagerPage.GetPagerPage<IFeature>(features, fieldCustoms);
        }
Esempio n. 2
0
        /// <summary>
        /// 所有对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list"></param>
        /// <param name="fieldCustoms"></param>
        public void SetPagerPage <T>(IList <T> list, IList <FieldCustom> fieldCustoms, bool isAutoObjectID = true, bool isHiddenSelected = false)
        {
            //添加要使用的index
            int count = fieldCustoms.Count;

            int[] indexs = new int[count];
            select.Visible = isHiddenSelected;

            //添加标题
            for (int a = 0; a < count; a++)
            {
                FieldCustom fieldCustom = fieldCustoms[a];
                GridColumn  column      = new GridColumn
                {
                    Width   = fieldCustom.Width,
                    Header  = fieldCustom.AliasName,
                    Binding = new Binding(fieldCustom.Name)
                    {
                        Mode = BindingMode.TwoWay
                    }
                };
                //EditSettings="{dxe:ComboBoxSettings DisplayMember=UserRole, ValueMember=UserRole,ItemsSource={x:Static local:db_PMSData.Data}}"/>

                if (fieldCustom.Editable)
                {
                    column.AllowEditing = DevExpress.Utils.DefaultBoolean.True;
                }

                indexs[a] = fieldCustom.Index;
                this.tabGrid.Columns.Add(column);
            }
            if (list != null)
            {
                lst = list.OfType <object>().ToList();
            }

            this.Init();
        }