Basic window handling.
This commit is contained in:
19
Wino.Core.UWP/Services/AppShellService.cs
Normal file
19
Wino.Core.UWP/Services/AppShellService.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
#if NET8_0
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
#else
|
||||
using Windows.UI.Xaml;
|
||||
#endif
|
||||
|
||||
namespace Wino.Core.WinUI.Services
|
||||
{
|
||||
public interface IAppShellService
|
||||
{
|
||||
Window AppWindow { get; set; }
|
||||
}
|
||||
|
||||
public class AppShellService : IAppShellService
|
||||
{
|
||||
public Window AppWindow { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.Foundation.Metadata;
|
||||
using Windows.Security.Authentication.Web;
|
||||
using Windows.Security.Cryptography;
|
||||
using Windows.Security.Cryptography.Core;
|
||||
using Windows.Storage;
|
||||
@@ -27,7 +26,16 @@ namespace Wino.Services
|
||||
private string _mimeMessagesFolder;
|
||||
private string _editorBundlePath;
|
||||
|
||||
public string GetWebAuthenticationBrokerUri() => WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri;
|
||||
public string GetWebAuthenticationBrokerUri()
|
||||
{
|
||||
#if NET8_0
|
||||
// WinUI
|
||||
return "wino://winomail.app";
|
||||
#else
|
||||
return WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
public async Task<string> GetMimeMessageStoragePath()
|
||||
{
|
||||
|
||||
@@ -165,8 +165,13 @@ namespace Wino.Services
|
||||
|
||||
// Save reference as this might be null when the user is in another app
|
||||
|
||||
|
||||
#if NET8_0
|
||||
// WinUI
|
||||
#else
|
||||
mainApplicationFrame = Window.Current.Content as Frame;
|
||||
#endif
|
||||
|
||||
|
||||
if (mainApplicationFrame == null) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user