Standartization of Core.UWP project file for NET8 WinUI

This commit is contained in:
Burak Kaan Köse
2024-07-11 16:38:43 +02:00
parent dec5d2b2b7
commit 9edb06c1cc
8 changed files with 95 additions and 15 deletions

View File

@@ -1,5 +1,9 @@
using Windows.UI.Xaml;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Enums;
#if NET8_0
using Microsoft.UI.Xaml;
#else
using Windows.UI.Xaml;
#endif
namespace Wino.Core.UWP.Extensions
{

View File

@@ -1,8 +1,15 @@
using Windows.System;
using Windows.System;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Wino.Core.Domain.Interfaces;
#if NET8_0
using Microsoft.UI.Xaml;
#else
using Windows.UI.Xaml;
#endif
namespace Wino.Core.UWP.Services
{
public class KeyPressService : IKeyPressService

View File

@@ -9,11 +9,17 @@ using Windows.Storage;
using Windows.Storage.Streams;
using Windows.System;
using Windows.UI.Shell;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Authorization;
#if NET8_0
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
#else
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
#endif
namespace Wino.Services
{
public class NativeAppService : INativeAppService
@@ -100,7 +106,7 @@ namespace Wino.Services
await Launcher.LaunchFileAsync(file);
}
public Task LaunchUriAsync(Uri uri) => Xamarin.Essentials.Launcher.OpenAsync(uri);
public Task LaunchUriAsync(Uri uri) => Launcher.LaunchUriAsync(uri).AsTask();
public string GetFullAppVersion()
{

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Toolkit.Uwp.Notifications;
using Windows.Data.Xml.Dom;
using Windows.UI.Notifications;
using Wino.Core.Domain;
@@ -12,6 +11,12 @@ using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Services;
#if NET8_0
using CommunityToolkit.WinUI.Notifications;
#else
using Microsoft.Toolkit.Uwp.Notifications;
#endif
namespace Wino.Core.UWP.Services
{
// TODO: Refactor this thing. It's garbage.

View File

@@ -6,15 +6,12 @@ using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Toolkit.Uwp.Helpers;
using Newtonsoft.Json;
using Windows.Storage;
using Windows.UI;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Markup;
using Windows.UI.Xaml.Media;
using Wino.Core.Domain;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Exceptions;
@@ -25,6 +22,22 @@ using Wino.Core.UWP.Extensions;
using Wino.Core.UWP.Models.Personalization;
using Wino.Core.UWP.Services;
#if NET8_0
using Microsoft.UI.Xaml.Controls;
using CommunityToolkit.WinUI.Helpers;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Markup;
using Microsoft.UI;
#else
using Windows.UI;
using Windows.UI.Xaml.Controls;
using Microsoft.Toolkit.Uwp.Helpers;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Markup;
#endif
namespace Wino.Services
{
/// <summary>
@@ -226,7 +239,11 @@ namespace Wino.Services
// Change accent color if specified.
if (!string.IsNullOrEmpty(hex))
{
#if NET8_0
var brush = new SolidColorBrush(CommunityToolkit.WinUI.Helpers.ColorHelper.ToColor(hex));
#else
var brush = new SolidColorBrush(Microsoft.Toolkit.Uwp.Helpers.ColorHelper.ToColor(hex));
#endif
if (_applicationResourceManager.ContainsResourceKey("SystemAccentColor"))
_applicationResourceManager.ReplaceResource("SystemAccentColor", brush);

View File

@@ -1,7 +1,12 @@
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Wino.Core.Domain.Interfaces;
#if NET8_0
using Microsoft.UI.Xaml;
#else
using Windows.UI.Xaml;
#endif
namespace Wino.Core.UWP.Services
{
public class UnderlyingThemeService : IUnderlyingThemeService

View File

@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Wino.Core.WinUI</RootNamespace>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Properties\**" />
<Content Remove="Properties\**" />
<EmbeddedResource Remove="Properties\**" />
<None Remove="Properties\**" />
<Page Remove="Properties\**" />
<PRIResource Remove="Properties\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.WinUI.Helpers" Version="8.0.240109" />
<PackageReference Include="CommunityToolkit.WinUI.Notifications" Version="7.1.2" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240311000" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Wino.Core.Domain\Wino.Core.Domain.NET8.csproj" />
<ProjectReference Include="..\Wino.Core\Wino.Core.NET8.csproj" />
</ItemGroup>
</Project>

View File

@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wino.Mail.ViewModels.NET8",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wino.Core.NET8", "Wino.Core\Wino.Core.NET8.csproj", "{FEC05E9C-4186-4ECF-A522-C8EB5C187F0D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wino.Core.WinUI", "Wino.Core.UWP\Wino.Core.WinUI.csproj", "{FF3C03F7-4E9B-4333-9A9D-2BB1D1241C56}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
{FEC05E9C-4186-4ECF-A522-C8EB5C187F0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FEC05E9C-4186-4ECF-A522-C8EB5C187F0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FEC05E9C-4186-4ECF-A522-C8EB5C187F0D}.Release|Any CPU.Build.0 = Release|Any CPU
{FF3C03F7-4E9B-4333-9A9D-2BB1D1241C56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF3C03F7-4E9B-4333-9A9D-2BB1D1241C56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF3C03F7-4E9B-4333-9A9D-2BB1D1241C56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF3C03F7-4E9B-4333-9A9D-2BB1D1241C56}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE