Skip to content

Commit

Permalink
Correct embedded sample (#1048)
Browse files Browse the repository at this point in the history
* cleanup
* include asssets
  • Loading branch information
j0shuams authored Nov 17, 2021
1 parent 212b230 commit e4fa105
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PropertyGroup>
<LangVersion>9</LangVersion>
<CsWinRTEmbedded>true</CsWinRTEmbedded>
<CsWinRTWindowsMetadata>10.0.19041.0</CsWinRTWindowsMetadata>
<CsWinRTWindowsMetadata>sdk</CsWinRTWindowsMetadata>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Samples/TestEmbedded/Net5App/Net5App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<!-- CsWinRT reference needed for the target that blocks NETSDK1130 for the C++/WinRT components
(transitive project reference asset) -->
<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="1.4.0-prerelease.211109.3" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="1.4.0-prerelease.211109.3" IncludeAssets="build"/>
</ItemGroup>

<ItemGroup>
Expand Down
20 changes: 4 additions & 16 deletions src/Samples/TestEmbedded/TestEmbeddedLibrary/TestLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,8 @@ class MyGreek : IAlpha, IGamma

public class TestLib
{
Geolocator g;
public TestLib()
{
WinRT.ComWrappersSupport.RegisterProjectionAssembly(typeof(TestLib).Assembly);
g = new();
}

public void SetDesiredAccuracy()
{
g.DesiredAccuracy = PositionAccuracy.Default;
}

public void ShowDesiredAccuracy()
{
Console.WriteLine("Desired accuracy = " + g.DesiredAccuracy);
}

internal int Test1_Helper(IAlpha alpha) { return alpha.Five(); }
Expand All @@ -50,8 +37,6 @@ public int Test1()
return Test1_Helper(a) + Test1_Helper(g);
}

internal IBeta Test2_Helper(IBeta beta) { return beta; }

public int Test2()
{
MyGreek g = new();
Expand All @@ -78,9 +63,12 @@ public int Test4()

async System.Threading.Tasks.Task CallGeoAsyncApi()
{
Console.WriteLine("Making a Microsoft.Devices.Geolocation.Geolocator object...");
Geolocator g = new();
Console.WriteLine("Setting the Desired Accuracy to Default on the Geolocator object...");
g.DesiredAccuracy = PositionAccuracy.Default;
Console.WriteLine("Desired accuracy " + g.DesiredAccuracy);
Console.WriteLine("Accessing the Desired Accuracy, shows: " + g.DesiredAccuracy);
Console.WriteLine("Calling GetGeopositionAsync...");
Geoposition pos = await g.GetGeopositionAsync();
}

Expand Down

0 comments on commit e4fa105

Please sign in to comment.