Fix UWP build

This commit is contained in:
Morten Nielsen 2024-07-02 09:21:26 -07:00
parent 4a70acc60b
commit ebcdb6ddae
5 changed files with 15 additions and 15 deletions

View file

@ -12,7 +12,7 @@
// * limitations under the License. // * limitations under the License.
// ****************************************************************************** // ******************************************************************************
#if NETFX_CORE #if WINDOWS_UWP
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View file

@ -26,7 +26,7 @@ namespace NmeaParser
/// </summary> /// </summary>
public class NmeaFileDevice : BufferedStreamDevice public class NmeaFileDevice : BufferedStreamDevice
{ {
#if NETFX_CORE #if WINDOWS_UWP
private Windows.Storage.IStorageFile? m_storageFile; private Windows.Storage.IStorageFile? m_storageFile;
#endif #endif
private string m_filename; private string m_filename;
@ -40,7 +40,7 @@ namespace NmeaParser
{ {
} }
#if NETFX_CORE #if WINDOWS_UWP
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="NmeaFileDevice"/> class. /// Initializes a new instance of the <see cref="NmeaFileDevice"/> class.
/// </summary> /// </summary>
@ -59,7 +59,7 @@ namespace NmeaParser
m_filename = fileName; m_filename = fileName;
} }
#if NETFX_CORE #if WINDOWS_UWP
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="NmeaFileDevice"/> class. /// Initializes a new instance of the <see cref="NmeaFileDevice"/> class.
/// </summary> /// </summary>
@ -89,7 +89,7 @@ namespace NmeaParser
protected override Task<Stream> GetStreamAsync() protected override Task<Stream> GetStreamAsync()
{ {
#if NETFX_CORE #if WINDOWS_UWP
if (m_storageFile != null) if (m_storageFile != null)
return m_storageFile.OpenStreamForReadAsync(); return m_storageFile.OpenStreamForReadAsync();
#endif #endif

View file

@ -18,7 +18,7 @@
<PackageProjectUrl>https://dotmorten.github.io/NmeaParser/</PackageProjectUrl> <PackageProjectUrl>https://dotmorten.github.io/NmeaParser/</PackageProjectUrl>
<RepositoryUrl>https://github.com/dotMorten/NmeaParser</RepositoryUrl> <RepositoryUrl>https://github.com/dotMorten/NmeaParser</RepositoryUrl>
<NeutralLanguage>en-US</NeutralLanguage> <NeutralLanguage>en-US</NeutralLanguage>
<Copyright>Copyright © Morten Nielsen 2015-2023</Copyright> <Copyright>Copyright © Morten Nielsen 2015-$([System.DateTime]::Now.ToString('yyyy'))</Copyright>
<OutputPath>$(MSBuildThisFileDirectory)..\..\artifacts\NmeaParser\$(Configuration)</OutputPath> <OutputPath>$(MSBuildThisFileDirectory)..\..\artifacts\NmeaParser\$(Configuration)</OutputPath>
<PackageOutputPath>..\..\artifacts\NuGet\$(Configuration)\</PackageOutputPath> <PackageOutputPath>..\..\artifacts\NuGet\$(Configuration)\</PackageOutputPath>
<PackageReleaseNotes></PackageReleaseNotes> <PackageReleaseNotes></PackageReleaseNotes>
@ -34,7 +34,7 @@
<PackageIconUrl /> <PackageIconUrl />
<CheckEolWorkloads>false</CheckEolWorkloads> <CheckEolWorkloads>false</CheckEolWorkloads>
<CheckEolTargetFramework>false</CheckEolTargetFramework> <CheckEolTargetFramework>false</CheckEolTargetFramework>
<_SdkIgnoreMSBuildCoreWarning>true</_SdkIgnoreMSBuildCoreWarning> <_SdkIgnoreMSBuildCoreWarning>true</_SdkIgnoreMSBuildCoreWarning>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="PackageValidationSettings"> <PropertyGroup Label="PackageValidationSettings">
@ -91,11 +91,11 @@
<NoWarn>$(NoWarn);VSX1000</NoWarn> <NoWarn>$(NoWarn);VSX1000</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.16299'"> <PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.19041'">
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion> <TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'uap10.0.16299'"> <ItemGroup Condition="'$(TargetFramework)' == 'uap10.0.19041'">
<EmbeddedResource Include="**\*.rd.xml" /> <EmbeddedResource Include="**\*.rd.xml" />
</ItemGroup> </ItemGroup>

View file

@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Windows; using System.Windows;
using System.ComponentModel; using System.ComponentModel;
#if NETFX_CORE #if WINDOWS_UWP
using Windows.UI.Xaml; using Windows.UI.Xaml;
#else #else
using System.Windows.Threading; using System.Windows.Threading;
@ -28,7 +28,7 @@ namespace SampleApp.WinDesktop
} }
#if NETFX_CORE #if WINDOWS_UWP
void m_timer_Tick(object sender, object e) void m_timer_Tick(object sender, object e)
#else #else
void m_timer_Tick(object sender, EventArgs e) void m_timer_Tick(object sender, EventArgs e)

View file

@ -31,14 +31,14 @@ namespace NmeaParser.Tests
{ {
[TestMethod] [TestMethod]
public public
#if NETFX_CORE #if WINDOWS_UWP
async Task async Task
#else #else
void void
#endif #endif
ParseNmeaFile() ParseNmeaFile()
{ {
#if NETFX_CORE #if WINDOWS_UWP
var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///NmeaSampleData.txt")); var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///NmeaSampleData.txt"));
System.IO.StreamReader reader = new System.IO.StreamReader(await file.OpenStreamForReadAsync()); System.IO.StreamReader reader = new System.IO.StreamReader(await file.OpenStreamForReadAsync());
#else #else
@ -64,14 +64,14 @@ namespace NmeaParser.Tests
} }
[TestMethod] [TestMethod]
public public
#if NETFX_CORE #if WINDOWS_UWP
async Task async Task
#else #else
void void
#endif #endif
ParseTrimbleR2NmeaFile() ParseTrimbleR2NmeaFile()
{ {
#if NETFX_CORE #if WINDOWS_UWP
var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///TrimbleR2SampleData.txt")); var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///TrimbleR2SampleData.txt"));
System.IO.StreamReader reader = new System.IO.StreamReader(await file.OpenStreamForReadAsync()); System.IO.StreamReader reader = new System.IO.StreamReader(await file.OpenStreamForReadAsync());
#else #else