Skip to content

Commit b735e04

Browse files
committed
adjust to changes in grid/datasource api
1 parent 69e8551 commit b735e04

3 files changed

Lines changed: 44 additions & 38 deletions

File tree

DataSource.DataProviders.OData/ODataSampleApp/MainWindow.xaml.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public MainWindow()
3131
{
3232
BaseUri = "http://services.odata.org/V4/Northwind/Northwind.svc",
3333
EntitySet = "Orders",
34-
DesiredPageSize = 200
34+
PageSizeRequested = 200
3535
};
36-
source.ShouldDeferAutoRefresh = true;
36+
//source.DeferAutoRefresh = true;
3737
source.SchemaChanged += Source_SchemaChanged;
3838

3939
source.SortDescriptions.Add(new SortDescription("ShipName", ListSortDirection.Descending));
@@ -47,13 +47,13 @@ public MainWindow()
4747

4848
grid1.ItemsSource = source;
4949

50-
Task.Delay(10000).ContinueWith((t) =>
51-
{
52-
Dispatcher.BeginInvoke(new Action(() =>
53-
{
54-
source.ShouldDeferAutoRefresh = false;
55-
}));
56-
});
50+
//Task.Delay(10000).ContinueWith((t) =>
51+
//{
52+
// Dispatcher.BeginInvoke(new Action(() =>
53+
// {
54+
// source.DeferAutoRefresh = false;
55+
// }));
56+
//});
5757
}
5858

5959
private void Source_SchemaChanged(object sender, DataSourceSchemaChangedEventArgs args)

ODataDataProvider/ODataVirtualDataSourceDataProvider.cs

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private void SortDescriptions_CollectionChanged(object sender, System.Collection
4444

4545
public void AddPageRequest(int pageIndex, DataSourcePageRequestPriority priority)
4646
{
47-
if (ShouldDeferAutoRefresh)
47+
if (DeferAutoRefresh)
4848
{
4949
return;
5050
}
@@ -103,13 +103,13 @@ private ODataVirtualDataSourceDataProviderWorkerSettings GetWorkerSettings()
103103
{
104104
BaseUri = _baseUri,
105105
EntitySet = _entitySet,
106-
DesiredPageSize = _desiredPageSize,
106+
PageSizeRequested = _pageSizeRequested,
107107
TimeoutMilliseconds = _timeoutMilliseconds,
108108
PageLoaded = _callback,
109109
ExecutionContext = _executionContext,
110110
SortDescriptions = _sortDescriptions,
111111
FilterExpressions = _filterExpressions,
112-
DesiredProperties = _desiredProperties
112+
PropertiesRequested = _propertiesRequested
113113
};
114114
}
115115

@@ -194,16 +194,16 @@ private void KillWorker()
194194
}
195195
}
196196

197-
private int _desiredPageSize = 200;
198-
public int DesiredPageSize
197+
private int _pageSizeRequested = 200;
198+
public int PageSizeRequested
199199
{
200200
get
201201
{
202-
return _desiredPageSize;
202+
return _pageSizeRequested;
203203
}
204204
set
205205
{
206-
_desiredPageSize = value;
206+
_pageSizeRequested = value;
207207
QueueAutoRefresh();
208208
}
209209
}
@@ -222,7 +222,7 @@ public string BaseUri
222222
if (oldValue != _baseUri)
223223
{
224224
QueueAutoRefresh();
225-
if (Valid() && ShouldDeferAutoRefresh)
225+
if (Valid() && DeferAutoRefresh)
226226
{
227227
QueueSchemaFetch();
228228
}
@@ -244,7 +244,7 @@ public string EntitySet
244244
if (oldValue != _entitySet)
245245
{
246246
QueueAutoRefresh();
247-
if (Valid() && ShouldDeferAutoRefresh)
247+
if (Valid() && DeferAutoRefresh)
248248
{
249249
QueueSchemaFetch();
250250
}
@@ -283,14 +283,20 @@ public object GetItemValue(object item, string valueName)
283283
private int _currentFullCount = 0;
284284
private IDataSourceSchema _currentSchema;
285285

286-
public int GetCount()
286+
public int ActualCount
287287
{
288-
return _currentFullCount;
288+
get
289+
{
290+
return _currentFullCount;
291+
}
289292
}
290293

291-
public IDataSourceSchema GetSchema()
294+
public IDataSourceSchema ActualSchema
292295
{
293-
return _currentSchema;
296+
get
297+
{
298+
return _currentSchema;
299+
}
294300
}
295301

296302
private IDataSourceExecutionContext _executionContext;
@@ -320,22 +326,22 @@ public IDataSourceDataProviderUpdateNotifier UpdateNotifier
320326
}
321327
}
322328

323-
private bool _shouldDeferAutoRefresh = false;
324-
public bool ShouldDeferAutoRefresh
329+
private bool _deferAutoRefresh = false;
330+
public bool DeferAutoRefresh
325331
{
326332
get
327333
{
328-
return _shouldDeferAutoRefresh;
334+
return _deferAutoRefresh;
329335
}
330336

331337
set
332338
{
333-
_shouldDeferAutoRefresh = value;
334-
if (!_shouldDeferAutoRefresh)
339+
_deferAutoRefresh = value;
340+
if (!_deferAutoRefresh)
335341
{
336342
QueueAutoRefresh();
337343
}
338-
if (_shouldDeferAutoRefresh && Valid() && _currentSchema == null)
344+
if (_deferAutoRefresh && Valid() && _currentSchema == null)
339345
{
340346
QueueSchemaFetch();
341347
}
@@ -367,16 +373,16 @@ public SortDescriptionCollection SortDescriptions
367373
}
368374
}
369375

370-
private string[] _desiredProperties;
371-
public string[] DesiredProperties
376+
private string[] _propertiesRequested;
377+
public string[] PropertiesRequested
372378
{
373379
get
374380
{
375-
return _desiredProperties;
381+
return _propertiesRequested;
376382
}
377383
set
378384
{
379-
_desiredProperties = value;
385+
_propertiesRequested = value;
380386
QueueAutoRefresh();
381387
}
382388
}
@@ -390,7 +396,7 @@ public FilterExpressionCollection FilterExpressions
390396
}
391397
}
392398

393-
public bool AreSortingAndFilteringExternal
399+
public bool NotifyUsingSourceIndexes
394400
{
395401
get
396402
{
@@ -478,7 +484,7 @@ internal void SchemaFetchInternal()
478484

479485
protected virtual void SchemaFetchInternalOverride()
480486
{
481-
if (!ShouldDeferAutoRefresh)
487+
if (!DeferAutoRefresh)
482488
{
483489
return;
484490
}
@@ -500,7 +506,7 @@ private void AddSchemaRequest()
500506
internal bool _autoRefreshQueued = false;
501507
public void QueueAutoRefresh()
502508
{
503-
if (ShouldDeferAutoRefresh)
509+
if (DeferAutoRefresh)
504510
{
505511
return;
506512
}
@@ -518,7 +524,7 @@ public void QueueAutoRefresh()
518524

519525
internal void DoRefreshInternal()
520526
{
521-
if (ShouldDeferAutoRefresh)
527+
if (DeferAutoRefresh)
522528
{
523529
_autoRefreshQueued = false;
524530
return;

ODataDataProvider/ODataVirtualDataSourceDataProviderWorker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal class ODataVirtualDataSourceDataProviderWorkerSettings
2525

2626
public FilterExpressionCollection FilterExpressions { get; set; }
2727

28-
public string[] DesiredProperties { get; set; }
28+
public string[] PropertiesRequested { get; set; }
2929
}
3030

3131

@@ -123,7 +123,7 @@ public ODataVirtualDataSourceDataProviderWorker(ODataVirtualDataSourceDataProvid
123123
_entitySet = settings.EntitySet;
124124
_sortDescriptions = settings.SortDescriptions;
125125
_filterExpressions = settings.FilterExpressions;
126-
_desiredPropeties = settings.DesiredProperties;
126+
_desiredPropeties = settings.PropertiesRequested;
127127
Task.Factory.StartNew(() => DoWork(), TaskCreationOptions.LongRunning);
128128
}
129129

0 commit comments

Comments
 (0)