예제 #1
0
        private void LoadData()
        {
            Debug.Assert(this.createdQueryFields != null);

            var app = (App)Application.Current;
            //加载数据
            var offset = 0;    // long.Parse(this.textOffset.Text);
            var limit  = 2000; // long.Parse(this.textLimit.Text);

            //生成条件
            var constraints = new List <object[]>();

            foreach (var p in this.createdQueryFields)
            {
                if (!p.Value.IsEmpty)
                {
                    foreach (var c in p.Value.GetConstraints())
                    {
                        constraints.Add(c.ToConstraint());
                    }
                }
            }

            app.ClientService.SearchModel(this.modelName, constraints.ToArray(), null, offset, limit, (ids, searchError) =>
            {
                app.ClientService.ReadModel(this.modelName, ids, this.fields, (records, readError) =>
                {
                    //我们需要一个唯一的字符串型 ID
                    //this.gridList.ItemsSource = new System.Collections.ObjectModel.ObservableCollection<Dictionary<string, object>>(records);
                    //this.gridList.ItemsSource = DataSourceCreator.ToDataSource(records);
                    var data = new SilverlightTable.SortableCollectionView(
                        records.Select(r => new SilverlightTable.Row(r)));
                    this.gridList.ItemsSource = data;
                });
            });
        }
 internal SortableCollectionDeferRefresh(SortableCollectionView collectionView)
 {
     _collectionView = collectionView;
 }