Skip to content

Commit d43c6c4

Browse files
committed
Add PCL project for ODataVirtualDataSource
1 parent 28a03d1 commit d43c6c4

6 files changed

Lines changed: 274 additions & 6 deletions

File tree

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
6+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8+
<ProjectGuid>{2D978939-4120-4ABF-B13D-84D63075E61A}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>DataSource.DataProviders.OData.Core</RootNamespace>
12+
<AssemblyName>DataSource.DataProviders.OData.Core</AssemblyName>
13+
<DefaultLanguage>en-US</DefaultLanguage>
14+
<FileAlignment>512</FileAlignment>
15+
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
16+
<TargetFrameworkProfile>Profile111</TargetFrameworkProfile>
17+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
18+
<NuGetPackageImportStamp>
19+
</NuGetPackageImportStamp>
20+
</PropertyGroup>
21+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
22+
<DebugSymbols>true</DebugSymbols>
23+
<DebugType>full</DebugType>
24+
<Optimize>false</Optimize>
25+
<OutputPath>bin\Debug\</OutputPath>
26+
<DefineConstants>TRACE;DEBUG;PCL</DefineConstants>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
</PropertyGroup>
30+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
31+
<DebugType>pdbonly</DebugType>
32+
<Optimize>true</Optimize>
33+
<OutputPath>bin\Release\</OutputPath>
34+
<DefineConstants>TRACE;PCL</DefineConstants>
35+
<ErrorReport>prompt</ErrorReport>
36+
<WarningLevel>4</WarningLevel>
37+
</PropertyGroup>
38+
<ItemGroup>
39+
<Compile Include="Properties\AssemblyInfo.cs" />
40+
</ItemGroup>
41+
<ItemGroup>
42+
<Reference Include="Infragistics.Core">
43+
<HintPath>..\..\..\..\..\..\..\work\NetAdvantage\DEV\Xamarin\2017.1\Source\Build\Infragistics.Core.dll</HintPath>
44+
</Reference>
45+
<Reference Include="Infragistics.Core.DataVisualization">
46+
<HintPath>..\..\..\..\..\..\..\work\NetAdvantage\DEV\Xamarin\2017.1\Source\Build\Infragistics.Core.DataVisualization.dll</HintPath>
47+
</Reference>
48+
<Reference Include="Infragistics.Core.Platform">
49+
<HintPath>..\..\..\..\..\..\..\work\NetAdvantage\DEV\Xamarin\2017.1\Source\Build\Infragistics.Core.Platform.dll</HintPath>
50+
</Reference>
51+
<Reference Include="Microsoft.Data.Edm, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
52+
<HintPath>..\packages\Microsoft.Data.Edm.5.6.4\lib\portable-net45+wp8+win8+wpa\Microsoft.Data.Edm.dll</HintPath>
53+
<Private>True</Private>
54+
</Reference>
55+
<Reference Include="Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
56+
<HintPath>..\packages\Microsoft.Data.OData.5.6.4\lib\portable-net45+wp8+win8+wpa\Microsoft.Data.OData.dll</HintPath>
57+
<Private>True</Private>
58+
</Reference>
59+
<Reference Include="Microsoft.OData.Core, Version=6.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
60+
<HintPath>..\packages\Microsoft.OData.Core.6.11.0\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.OData.Core.dll</HintPath>
61+
<Private>True</Private>
62+
</Reference>
63+
<Reference Include="Microsoft.OData.Edm, Version=6.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
64+
<HintPath>..\packages\Microsoft.OData.Edm.6.11.0\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.OData.Edm.dll</HintPath>
65+
<Private>True</Private>
66+
</Reference>
67+
<Reference Include="Microsoft.Spatial, Version=6.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
68+
<HintPath>..\packages\Microsoft.Spatial.6.11.0\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.Spatial.dll</HintPath>
69+
<Private>True</Private>
70+
</Reference>
71+
<Reference Include="Simple.OData.Client.Core, Version=4.13.0.0, Culture=neutral, processorArchitecture=MSIL">
72+
<HintPath>..\packages\Simple.OData.Client.4.13.0\lib\portable-net45+win8+wp8+wpa81\Simple.OData.Client.Core.dll</HintPath>
73+
<Private>True</Private>
74+
</Reference>
75+
<Reference Include="Simple.OData.Client.Dynamic, Version=4.13.0.0, Culture=neutral, processorArchitecture=MSIL">
76+
<HintPath>..\packages\Simple.OData.Client.4.13.0\lib\portable-net45+win8+wp8+wpa81\Simple.OData.Client.Dynamic.dll</HintPath>
77+
<Private>True</Private>
78+
</Reference>
79+
<Reference Include="Simple.OData.Client.V3.Adapter, Version=4.13.0.0, Culture=neutral, processorArchitecture=MSIL">
80+
<HintPath>..\packages\Simple.OData.Client.4.13.0\lib\portable-net45+win8+wp8+wpa81\Simple.OData.Client.V3.Adapter.dll</HintPath>
81+
<Private>True</Private>
82+
</Reference>
83+
<Reference Include="Simple.OData.Client.V4.Adapter, Version=4.13.0.0, Culture=neutral, processorArchitecture=MSIL">
84+
<HintPath>..\packages\Simple.OData.Client.4.13.0\lib\portable-net45+win8+wp8+wpa81\Simple.OData.Client.V4.Adapter.dll</HintPath>
85+
<Private>True</Private>
86+
</Reference>
87+
<Reference Include="System.Net.Http.Extensions, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
88+
<HintPath>..\packages\Microsoft.Net.Http.2.2.28\lib\portable-net45+win8+wpa81\System.Net.Http.Extensions.dll</HintPath>
89+
<Private>True</Private>
90+
</Reference>
91+
<Reference Include="System.Net.Http.Primitives, Version=4.2.28.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
92+
<HintPath>..\packages\Microsoft.Net.Http.2.2.28\lib\portable-net45+win8+wpa81\System.Net.Http.Primitives.dll</HintPath>
93+
<Private>True</Private>
94+
</Reference>
95+
<Reference Include="System.Spatial, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
96+
<HintPath>..\packages\System.Spatial.5.6.4\lib\portable-net45+wp8+win8+wpa\System.Spatial.dll</HintPath>
97+
<Private>True</Private>
98+
</Reference>
99+
</ItemGroup>
100+
<ItemGroup>
101+
<None Include="packages.config" />
102+
</ItemGroup>
103+
<Import Project="..\..\ODataDataProvider\ODataDataProvider.projitems" Label="Shared" />
104+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
105+
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
106+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
107+
<PropertyGroup>
108+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
109+
</PropertyGroup>
110+
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
111+
</Target>
112+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
113+
Other similar extension points exist, see Microsoft.Common.targets.
114+
<Target Name="BeforeBuild">
115+
</Target>
116+
<Target Name="AfterBuild">
117+
</Target>
118+
-->
119+
</Project>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Resources;
2+
using System.Reflection;
3+
using System.Runtime.CompilerServices;
4+
using System.Runtime.InteropServices;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("DataSource.DataProviders.OData.Core")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("DataSource.DataProviders.OData.Core")]
14+
[assembly: AssemblyCopyright("Copyright © 2016")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: NeutralResourcesLanguage("en")]
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Build Number
24+
// Revision
25+
//
26+
// You can specify all the values or you can default the Build and Revision Numbers
27+
// by using the '*' as shown below:
28+
// [assembly: AssemblyVersion("1.0.*")]
29+
[assembly: AssemblyVersion("1.0.0.0")]
30+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="portable45-net45+win8+wpa81" />
4+
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="portable45-net45+win8+wpa81" />
5+
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="portable45-net45+win8+wpa81" />
6+
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="portable45-net45+win8+wpa81" />
7+
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="portable45-net45+win8+wpa81" />
8+
<package id="Microsoft.OData.Core" version="6.11.0" targetFramework="portable45-net45+win8+wpa81" />
9+
<package id="Microsoft.OData.Edm" version="6.11.0" targetFramework="portable45-net45+win8+wpa81" />
10+
<package id="Microsoft.Spatial" version="6.11.0" targetFramework="portable45-net45+win8+wpa81" />
11+
<package id="Simple.OData.Client" version="4.13.0" targetFramework="portable45-net45+win8+wpa81" />
12+
<package id="System.Spatial" version="5.6.4" targetFramework="portable45-net45+win8+wpa81" />
13+
</packages>

DataSource.DataProviders.OData/DataSource.DataProviders.OData.sln

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
4-
VisualStudioVersion = 14.0.23107.0
4+
VisualStudioVersion = 14.0.25420.1
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataSource.DataProviders.OData", "DataSource.DataProviders.OData\DataSource.DataProviders.OData.csproj", "{4CB59ADF-F59D-4310-9EB9-0BCDFD4CECE2}"
77
EndProject
88
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ODataDataProvider", "..\ODataDataProvider\ODataDataProvider.shproj", "{15C5CA79-0CDA-4D3D-833D-48EBD0F31915}"
99
EndProject
1010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ODataSampleApp", "ODataSampleApp\ODataSampleApp.csproj", "{16509F04-894A-4ABB-9821-8A1ED93D266C}"
1111
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataSource.DataProviders.OData.Core", "DataSource.DataProviders.OData.Core\DataSource.DataProviders.OData.Core.csproj", "{2D978939-4120-4ABF-B13D-84D63075E61A}"
13+
EndProject
1214
Global
1315
GlobalSection(SharedMSBuildProjectFiles) = preSolution
14-
..\ODataDataProvider\ODataDataProvider.projitems*{4cb59adf-f59d-4310-9eb9-0bcdfd4cece2}*SharedItemsImports = 4
1516
..\ODataDataProvider\ODataDataProvider.projitems*{15c5ca79-0cda-4d3d-833d-48ebd0f31915}*SharedItemsImports = 13
17+
..\ODataDataProvider\ODataDataProvider.projitems*{2d978939-4120-4abf-b13d-84d63075e61a}*SharedItemsImports = 4
18+
..\ODataDataProvider\ODataDataProvider.projitems*{4cb59adf-f59d-4310-9eb9-0bcdfd4cece2}*SharedItemsImports = 4
1619
EndGlobalSection
1720
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1821
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +30,10 @@ Global
2730
{16509F04-894A-4ABB-9821-8A1ED93D266C}.Debug|Any CPU.Build.0 = Debug|Any CPU
2831
{16509F04-894A-4ABB-9821-8A1ED93D266C}.Release|Any CPU.ActiveCfg = Release|Any CPU
2932
{16509F04-894A-4ABB-9821-8A1ED93D266C}.Release|Any CPU.Build.0 = Release|Any CPU
33+
{2D978939-4120-4ABF-B13D-84D63075E61A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34+
{2D978939-4120-4ABF-B13D-84D63075E61A}.Debug|Any CPU.Build.0 = Debug|Any CPU
35+
{2D978939-4120-4ABF-B13D-84D63075E61A}.Release|Any CPU.ActiveCfg = Release|Any CPU
36+
{2D978939-4120-4ABF-B13D-84D63075E61A}.Release|Any CPU.Build.0 = Release|Any CPU
3037
EndGlobalSection
3138
GlobalSection(SolutionProperties) = preSolution
3239
HideSolutionNode = FALSE

ODataDataProvider/ODataVirtualDataSource.cs

Lines changed: 96 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
using System.Diagnostics;
1111
using System.Windows;
1212
using Infragistics.Controls.DataSource;
13+
#if PCL
14+
using Infragistics.Core.Controls.DataSource;
15+
#endif
1316

1417
#if WINDOWS_UWP
1518
using Windows.UI;
@@ -37,7 +40,97 @@ protected override IDataSourceVirtualDataProvider ResolveDataProviderOverride()
3740
return new ODataVirtualDataSourceDataProvider();
3841
}
3942

40-
public static readonly DependencyProperty BaseUriProperty = DependencyProperty.Register("BaseUri",
43+
#if PCL
44+
private void OnBaseUriChanged(string oldValue, string newValue)
45+
{
46+
if (ActualDataProvider is ODataVirtualDataSourceDataProvider)
47+
{
48+
((ODataVirtualDataSourceDataProvider)ActualDataProvider).BaseUri = BaseUri;
49+
}
50+
QueueAutoRefresh();
51+
}
52+
53+
private string _baseUri = null;
54+
/// <summary>
55+
/// Gets or sets the root uri of the OData API that data should be fetched from.
56+
/// </summary>
57+
public string BaseUri
58+
{
59+
get
60+
{
61+
return _baseUri;
62+
}
63+
set
64+
{
65+
var oldValue = _baseUri;
66+
_baseUri = value;
67+
if (oldValue != _baseUri)
68+
{
69+
OnBaseUriChanged(oldValue, _baseUri);
70+
}
71+
}
72+
}
73+
74+
private void OnEntitySetChanged(string oldValue, string newValue)
75+
{
76+
if (ActualDataProvider is ODataVirtualDataSourceDataProvider)
77+
{
78+
((ODataVirtualDataSourceDataProvider)ActualDataProvider).EntitySet = EntitySet;
79+
}
80+
QueueAutoRefresh();
81+
}
82+
83+
private string _entitySet = null;
84+
/// <summary>
85+
/// Gets or sets the desired entity set within the root OData API from which to retrieve data.
86+
/// </summary>
87+
public string EntitySet
88+
{
89+
get
90+
{
91+
return _entitySet;
92+
}
93+
set
94+
{
95+
var oldValue = _entitySet;
96+
_entitySet = value;
97+
if (_entitySet != oldValue)
98+
{
99+
OnEntitySetChanged(oldValue, _entitySet);
100+
}
101+
}
102+
}
103+
104+
private void OnTimeoutMillisecondsChanged(int oldValue, int newValue)
105+
{
106+
if (ActualDataProvider is ODataVirtualDataSourceDataProvider)
107+
{
108+
((ODataVirtualDataSourceDataProvider)ActualDataProvider).TimeoutMilliseconds = TimeoutMilliseconds;
109+
}
110+
}
111+
112+
private int _timeoutMilliseconds = 10000;
113+
/// <summary>
114+
/// Gets or sets the desired timeout to use for requests of the OData API.
115+
/// </summary>
116+
public int TimeoutMilliseconds
117+
{
118+
get
119+
{
120+
return _timeoutMilliseconds;
121+
}
122+
set
123+
{
124+
var oldValue = _timeoutMilliseconds;
125+
_timeoutMilliseconds = value;
126+
if (oldValue != _timeoutMilliseconds)
127+
{
128+
OnTimeoutMillisecondsChanged(oldValue, _timeoutMilliseconds);
129+
}
130+
}
131+
}
132+
#else
133+
public static readonly DependencyProperty BaseUriProperty = DependencyProperty.Register("BaseUri",
41134
typeof(string), typeof(ODataVirtualDataSource), new PropertyMetadata(default(string), (sender, e) =>
42135
{
43136
((ODataVirtualDataSource)sender).OnBaseUriChanged((string)e.OldValue, (string)e.NewValue);
@@ -125,7 +218,7 @@ public int TimeoutMilliseconds
125218
SetValue(TimeoutMillisecondsProperty, value);
126219
}
127220
}
128-
129-
}
221+
#endif
222+
}
130223

131224
}

ODataDataProvider/ODataVirtualDataSourceDataProviderWorker.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,13 @@ protected override void MakeTaskForRequest(AsyncDataSourcePageRequest request, i
327327
{
328328
foreach (var sort in SortDescriptions)
329329
{
330-
if (sort.Direction == System.ComponentModel.ListSortDirection.Descending)
330+
if (sort.Direction ==
331+
#if PCL
332+
ListSortDirection.Descending
333+
#else
334+
System.ComponentModel.ListSortDirection.Descending
335+
#endif
336+
)
331337
{
332338
client = client.OrderByDescending(sort.PropertyName);
333339
}

0 commit comments

Comments
 (0)