Basic window handling.
This commit is contained in:
@@ -55,6 +55,8 @@ namespace Wino
|
||||
{
|
||||
base.OnWindowCreated(args);
|
||||
|
||||
_appShellService.AppWindow = args.Window;
|
||||
|
||||
LogActivation("Window is created.");
|
||||
|
||||
ConfigureTitleBar();
|
||||
|
||||
@@ -24,6 +24,7 @@ using Wino.MenuFlyouts.Context;
|
||||
using Wino.Views.Abstract;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
|
||||
#if NET8_0
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
@@ -295,7 +296,7 @@ namespace Wino.Views
|
||||
/// </summary>
|
||||
public async void Receive(InfoBarMessageRequested message)
|
||||
{
|
||||
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
|
||||
await ViewModel.ExecuteUIThread(() =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(message.ActionButtonTitle) || message.Action == null)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Windows.Foundation;
|
||||
using Wino.Core.WinUI.Services;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
#if NET8_0
|
||||
using Microsoft.UI.Xaml;
|
||||
@@ -11,6 +13,8 @@ namespace Wino.Controls.Advanced
|
||||
{
|
||||
public sealed partial class WinoAppTitleBar : UserControl
|
||||
{
|
||||
private IAppShellService _appShellService = App.Current.Services.GetService<IAppShellService>();
|
||||
|
||||
public event TypedEventHandler<WinoAppTitleBar, RoutedEventArgs> BackButtonClicked;
|
||||
|
||||
public string CoreWindowText
|
||||
@@ -152,11 +156,8 @@ namespace Wino.Controls.Advanced
|
||||
public WinoAppTitleBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if NET8_0
|
||||
App.MainWindow.SetTitleBar(dragbar);
|
||||
#else
|
||||
Window.Current.SetTitleBar(dragbar);
|
||||
#endif
|
||||
|
||||
_appShellService.AppWindow.SetTitleBar(dragbar);
|
||||
}
|
||||
|
||||
private void BackClicked(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -18,6 +18,8 @@ using Wino.Core.UWP;
|
||||
using Wino.Mail.ViewModels;
|
||||
using Wino.Services;
|
||||
using Wino.Core.Services;
|
||||
using Wino.Core.WinUI.Services;
|
||||
|
||||
|
||||
#if NET8_0
|
||||
using Microsoft.UI.Xaml;
|
||||
@@ -40,6 +42,7 @@ namespace Wino
|
||||
private readonly IAppInitializerService _appInitializerService;
|
||||
private readonly IWinoSynchronizerFactory _synchronizerFactory;
|
||||
private readonly ITranslationService _translationService;
|
||||
private readonly IAppShellService _appShellService;
|
||||
|
||||
public new static App Current => (App)Application.Current;
|
||||
public IServiceProvider Services { get; }
|
||||
|
||||
@@ -11,9 +11,10 @@ using Wino.Mail.ViewModels.Messages;
|
||||
using Wino.Views;
|
||||
using Wino.Views.Account;
|
||||
using Wino.Views.Settings;
|
||||
using Wino.Core.WinUI.Services;
|
||||
|
||||
|
||||
#if NET8_0
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media.Animation;
|
||||
#else
|
||||
@@ -27,6 +28,7 @@ namespace Wino.Services
|
||||
public class WinoNavigationService : IWinoNavigationService
|
||||
{
|
||||
private readonly IStatePersistanceService _statePersistanceService;
|
||||
private readonly IAppShellService _appShellService;
|
||||
|
||||
private WinoPage[] _renderingPageTypes = new WinoPage[]
|
||||
{
|
||||
@@ -34,9 +36,10 @@ namespace Wino.Services
|
||||
WinoPage.ComposePage
|
||||
};
|
||||
|
||||
|
||||
private Frame GetCoreFrame(NavigationReferenceFrame frameType)
|
||||
{
|
||||
if (Window.Current.Content is Frame appFrame && appFrame.Content is AppShell shellPage)
|
||||
if (_appShellService.AppWindow.Content is Frame appFrame && appFrame.Content is AppShell shellPage)
|
||||
return WinoVisualTreeHelper.GetChildObject<Frame>(shellPage, frameType.ToString());
|
||||
|
||||
return null;
|
||||
@@ -52,9 +55,10 @@ namespace Wino.Services
|
||||
}
|
||||
}
|
||||
|
||||
public WinoNavigationService(IStatePersistanceService statePersistanceService)
|
||||
public WinoNavigationService(IStatePersistanceService statePersistanceService, IAppShellService appShellService)
|
||||
{
|
||||
_statePersistanceService = statePersistanceService;
|
||||
_appShellService = appShellService;
|
||||
}
|
||||
|
||||
private Type GetPageType(WinoPage winoPage)
|
||||
|
||||
Reference in New Issue
Block a user