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