title bar shell content
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Wino.Messaging.UI;
|
||||
|
||||
namespace Wino.Core.WinUI.Interfaces;
|
||||
|
||||
public interface IWinoShellWindow
|
||||
public interface IWinoShellWindow : IRecipient<TitleBarShellContentUpdated>
|
||||
{
|
||||
void HandleAppActivation(LaunchActivatedEventArgs args);
|
||||
TitleBar GetTitleBar();
|
||||
|
||||
@@ -17,6 +17,7 @@ using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models.Folders;
|
||||
using Wino.Core.Domain.Models.MailItem;
|
||||
using Wino.Core.Domain.Models.Navigation;
|
||||
using Wino.Core.WinUI;
|
||||
using Wino.Core.WinUI.Controls;
|
||||
using Wino.Extensions;
|
||||
using Wino.Mail.ViewModels.Data;
|
||||
@@ -25,6 +26,7 @@ using Wino.MenuFlyouts.Context;
|
||||
using Wino.Messaging.Client.Accounts;
|
||||
using Wino.Messaging.Client.Mails;
|
||||
using Wino.Messaging.Client.Shell;
|
||||
using Wino.Messaging.UI;
|
||||
using Wino.Views.Abstract;
|
||||
|
||||
namespace Wino.Views;
|
||||
@@ -35,10 +37,14 @@ public sealed partial class AppShell : AppShellAbstract,
|
||||
IRecipient<CreateNewMailWithMultipleAccountsRequested>,
|
||||
IRecipient<InfoBarMessageRequested>
|
||||
{
|
||||
[GeneratedDependencyProperty]
|
||||
public partial UIElement TopShellContent { get; set; }
|
||||
|
||||
public AppShell() : base()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public Frame GetShellFrame() => ShellFrame;
|
||||
|
||||
private async void ItemDroppedOnFolder(object sender, DragEventArgs e)
|
||||
{
|
||||
@@ -212,18 +218,9 @@ public sealed partial class AppShell : AppShellAbstract,
|
||||
}
|
||||
}
|
||||
|
||||
private void ShellFrameContentNavigated(object sender, Microsoft.UI.Xaml.Navigation.NavigationEventArgs e)
|
||||
{
|
||||
// => RealAppBar.ShellFrameContent = (e.Content as BasePage).ShellContent;
|
||||
private void ShellFrameContentNavigated(object sender, Microsoft.UI.Xaml.Navigation.NavigationEventArgs e) => TopShellContent = ((BasePage)e.Content).ShellContent;
|
||||
|
||||
// TODO: WinUI3: Update shell content. Just remove it.
|
||||
}
|
||||
|
||||
private void BackButtonClicked(WinoAppTitleBar sender, RoutedEventArgs args)
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send(new ClearMailSelectionsRequested());
|
||||
WeakReferenceMessenger.Default.Send(new DisposeRenderingFrameRequested());
|
||||
}
|
||||
partial void OnTopShellContentChanged(UIElement newValue) => WeakReferenceMessenger.Default.Send(new TitleBarShellContentUpdated());
|
||||
|
||||
private async void MenuItemContextRequested(UIElement sender, ContextRequestedEventArgs args)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<TitleBar
|
||||
x:Name="ShellTitleBar"
|
||||
Title="{x:Bind StatePersistanceService.CoreWindowTitle, Mode=OneWay}"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
BackRequested="BackButtonClicked"
|
||||
IsBackButtonVisible="{x:Bind StatePersistanceService.IsBackButtonVisible, Mode=OneWay}"
|
||||
IsPaneToggleButtonVisible="True"
|
||||
|
||||
@@ -7,6 +7,7 @@ using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.WinUI;
|
||||
using Wino.Core.WinUI.Interfaces;
|
||||
using Wino.Messaging.Client.Mails;
|
||||
using Wino.Messaging.UI;
|
||||
using Wino.Views;
|
||||
using WinUIEx;
|
||||
|
||||
@@ -19,6 +20,8 @@ public sealed partial class ShellWindow : WindowEx, IWinoShellWindow
|
||||
|
||||
public ShellWindow()
|
||||
{
|
||||
WeakReferenceMessenger.Default.Register<TitleBarShellContentUpdated>(this);
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
MinWidth = 420;
|
||||
@@ -56,4 +59,12 @@ public sealed partial class ShellWindow : WindowEx, IWinoShellWindow
|
||||
{
|
||||
PreferencesService.IsNavigationPaneOpened = !PreferencesService.IsNavigationPaneOpened;
|
||||
}
|
||||
|
||||
public void Receive(TitleBarShellContentUpdated message)
|
||||
{
|
||||
if (MainShellFrame.Content is AppShell shellPage)
|
||||
{
|
||||
ShellTitleBar.Content = shellPage.TopShellContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@
|
||||
<KeyboardAccelerator Key="Delete" Invoked="DeleteAllInvoked" />
|
||||
</Page.KeyboardAccelerators>
|
||||
<wino:BasePage.ShellContent>
|
||||
<Grid>
|
||||
<Grid HorizontalAlignment="Stretch" Background="Red">
|
||||
<!-- Hidden focus receiver... -->
|
||||
<TextBox
|
||||
Grid.Column="1"
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace Wino.Messaging.UI;
|
||||
|
||||
public record TitleBarShellContentUpdated;
|
||||
Reference in New Issue
Block a user