Improved shell experience.

This commit is contained in:
Burak Kaan Köse
2026-03-11 19:26:37 +01:00
parent 2b523d64e8
commit 9dd68fd62e
34 changed files with 717 additions and 217 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ public partial class App : WinoApplication,
services.AddTransient(typeof(SignatureAndEncryptionPageViewModel));
services.AddTransient(typeof(EmailTemplatesPageViewModel));
services.AddTransient(typeof(CreateEmailTemplatePageViewModel));
services.AddTransient(typeof(CalendarPageViewModel));
services.AddSingleton(typeof(CalendarPageViewModel));
services.AddTransient(typeof(CalendarSettingsPageViewModel));
services.AddTransient(typeof(CalendarAccountSettingsPageViewModel));
services.AddTransient(typeof(EventDetailsPageViewModel));
@@ -2,6 +2,7 @@
x:Class="Wino.Mail.WinUI.Controls.AppModeFooterSwitcherControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:domain="using:Wino.Core.Domain"
Loaded="ControlLoaded"
@@ -27,6 +28,11 @@
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE716;" />
</controls:SegmentedItem.Icon>
</controls:SegmentedItem>
<controls:SegmentedItem ToolTipService.ToolTip="{x:Bind domain:Translator.MenuSettings, Mode=OneWay}">
<controls:SegmentedItem.Icon>
<SymbolIcon Symbol="Setting" />
</controls:SegmentedItem.Icon>
</controls:SegmentedItem>
</controls:Segmented>
</Grid>
</UserControl>
@@ -4,6 +4,7 @@ using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain;
namespace Wino.Mail.WinUI.Controls;
@@ -44,6 +45,13 @@ public sealed partial class AppModeFooterSwitcherControl : UserControl
if (_isUpdatingSelection)
return;
if (ModeSegmentedControl.SelectedIndex == 3)
{
_navigationService.Navigate(WinoPage.SettingsPage);
UpdateSelection(_statePersistenceService.ApplicationMode);
return;
}
var selectedMode = ModeSegmentedControl.SelectedIndex switch
{
1 => WinoApplicationMode.Calendar,
@@ -49,6 +49,7 @@ public partial class CustomCalendarFlipView : FlipView
HideButton(PreviousButtonVertical);
HideButton(NextButtonVertical);
SelectionChanged -= FlipViewSelectionChanged;
SelectionChanged += FlipViewSelectionChanged;
}
@@ -13,7 +13,7 @@ using Wino.Helpers;
namespace Wino.Calendar.Controls;
public partial class WinoCalendarControl : Control
public partial class WinoCalendarControl : Control, IDisposable
{
private const string PART_WinoFlipView = nameof(PART_WinoFlipView);
private const string PART_IdleGrid = nameof(PART_IdleGrid);
@@ -93,6 +93,12 @@ public partial class WinoCalendarControl : Control
partial void OnIsFlipIdleChanged(bool newValue)
=> UpdateIdleState();
partial void OnDayRangesChanged(ObservableCollection<DayRangeRenderModel>? newValue)
=> EnsureStableSelection();
partial void OnSelectedFlipViewDayRangeChanged(DayRangeRenderModel? newValue)
=> EnsureStableSelection();
partial void OnActiveScrollViewerPropertyChanged(DependencyPropertyChangedEventArgs e)
{
var newValue = e.NewValue as ScrollViewer;
@@ -200,6 +206,23 @@ public partial class WinoCalendarControl : Control
if (InternalFlipView != null)
{
InternalFlipView.ProgrammaticNavigationCompleted -= InternalFlipViewProgrammaticNavigationCompleted;
if (InternalFlipView is IDisposable disposableFlipView)
{
disposableFlipView.Dispose();
}
}
if (_previousScrollViewer != null)
{
DeregisterScrollChanges(_previousScrollViewer);
_previousScrollViewer = null;
}
if (_previousCanvas != null)
{
DeregisterCanvas(_previousCanvas);
_previousCanvas = null;
}
InternalFlipView = GetTemplateChild(PART_WinoFlipView) as WinoCalendarFlipView;
@@ -213,6 +236,7 @@ public partial class WinoCalendarControl : Control
UpdateIdleState();
ManageCalendarOrientation();
ManageDisplayType();
EnsureStableSelection();
}
private void InternalFlipViewProgrammaticNavigationCompleted(object? sender, ProgrammaticNavigationCompletedEventArgs e)
@@ -233,6 +257,33 @@ public partial class WinoCalendarControl : Control
}
}
private void EnsureStableSelection()
{
if (InternalFlipView == null || DayRanges == null || DayRanges.Count == 0)
return;
var targetIndex = SelectedFlipViewIndex;
if (SelectedFlipViewDayRange != null)
{
var selectedRangeIndex = DayRanges.IndexOf(SelectedFlipViewDayRange);
if (selectedRangeIndex >= 0)
{
targetIndex = selectedRangeIndex;
}
}
if (targetIndex < 0 || targetIndex >= DayRanges.Count)
{
targetIndex = 0;
}
if (InternalFlipView.SelectedIndex != targetIndex)
{
InternalFlipView.SelectedIndex = targetIndex;
}
}
private void ActiveTimelineCellUnselected(object? sender, TimelineCellUnselectedArgs e)
=> TimelineCellUnselected?.Invoke(this, e);
@@ -291,4 +342,40 @@ public partial class WinoCalendarControl : Control
{
return this.FindDescendants<CalendarItemControl>().FirstOrDefault(a => a.CalendarItem == calendarItemViewModel)!;
}
public void Dispose()
{
SizeChanged -= CalendarSizeChanged;
if (_previousScrollViewer != null)
{
DeregisterScrollChanges(_previousScrollViewer);
_previousScrollViewer = null;
}
if (_previousCanvas != null)
{
DeregisterCanvas(_previousCanvas);
_previousCanvas = null;
}
if (InternalFlipView != null)
{
InternalFlipView.ProgrammaticNavigationCompleted -= InternalFlipViewProgrammaticNavigationCompleted;
if (InternalFlipView is IDisposable disposableFlipView)
{
disposableFlipView.Dispose();
}
InternalFlipView = null;
}
IdleGrid = null;
ActiveCanvas = null;
ActiveScrollViewer = null;
TimelineCellSelected = null;
TimelineCellUnselected = null;
ScrollPositionChanging = null;
}
}
@@ -10,7 +10,7 @@ using Wino.Core.Domain.Models.Calendar;
namespace Wino.Calendar.Controls;
public partial class WinoCalendarFlipView : CustomCalendarFlipView
public partial class WinoCalendarFlipView : CustomCalendarFlipView, IDisposable
{
public static readonly DependencyProperty IsIdleProperty = DependencyProperty.Register(nameof(IsIdle), typeof(bool), typeof(WinoCalendarFlipView), new PropertyMetadata(true));
public static readonly DependencyProperty ActiveCanvasProperty = DependencyProperty.Register(nameof(ActiveCanvas), typeof(WinoDayTimelineCanvas), typeof(WinoCalendarFlipView), new PropertyMetadata(null));
@@ -50,10 +50,11 @@ public partial class WinoCalendarFlipView : CustomCalendarFlipView
internal event EventHandler<ProgrammaticNavigationCompletedEventArgs>? ProgrammaticNavigationCompleted;
private INotifyCollectionChanged? _trackedItemsSource;
private readonly long _itemsSourceCallbackToken;
public WinoCalendarFlipView()
{
RegisterPropertyChangedCallback(ItemsSourceProperty, new DependencyPropertyChangedCallback(OnItemsSourceChanged));
_itemsSourceCallbackToken = RegisterPropertyChangedCallback(ItemsSourceProperty, new DependencyPropertyChangedCallback(OnItemsSourceChanged));
}
private static void OnItemsSourceChanged(DependencyObject d, DependencyProperty e)
@@ -207,6 +208,18 @@ public partial class WinoCalendarFlipView : CustomCalendarFlipView
private ObservableRangeCollection<DayRangeRenderModel>? GetItemsSource()
=> ItemsSource as ObservableRangeCollection<DayRangeRenderModel>;
public void Dispose()
{
if (_trackedItemsSource != null)
{
_trackedItemsSource.CollectionChanged -= ItemsSourceUpdated;
_trackedItemsSource = null;
}
UnregisterPropertyChangedCallback(ItemsSourceProperty, _itemsSourceCallbackToken);
ProgrammaticNavigationCompleted = null;
}
}
internal sealed class ProgrammaticNavigationCompletedEventArgs : EventArgs
@@ -10,7 +10,7 @@ using Wino.Helpers;
namespace Wino.Calendar.Controls;
public partial class WinoCalendarView : Control
public partial class WinoCalendarView : Control, IDisposable
{
private const string PART_DayViewItemBorder = nameof(PART_DayViewItemBorder);
private const string PART_CalendarView = nameof(PART_CalendarView);
@@ -54,6 +54,7 @@ public partial class WinoCalendarView : Control
private CalendarView? CalendarView;
private long _displayModeCallbackToken = -1;
public WinoCalendarView()
{
@@ -64,6 +65,17 @@ public partial class WinoCalendarView : Control
{
base.OnApplyTemplate();
if (CalendarView != null)
{
CalendarView.SelectedDatesChanged -= InternalCalendarViewSelectionChanged;
if (_displayModeCallbackToken != -1)
{
CalendarView.UnregisterPropertyChangedCallback(CalendarView.DisplayModeProperty, _displayModeCallbackToken);
_displayModeCallbackToken = -1;
}
}
CalendarView = GetTemplateChild(PART_CalendarView) as CalendarView;
Guard.IsNotNull(CalendarView, nameof(CalendarView));
@@ -78,7 +90,7 @@ public partial class WinoCalendarView : Control
// Everytime display mode changes, update the visible date range backgrounds.
// If users go back from year -> month -> day, we need to update the visible date range backgrounds.
CalendarView.RegisterPropertyChangedCallback(CalendarView.DisplayModeProperty, (s, e) => UpdateVisibleDateRangeBackgrounds());
_displayModeCallbackToken = CalendarView.RegisterPropertyChangedCallback(CalendarView.DisplayModeProperty, (s, e) => UpdateVisibleDateRangeBackgrounds());
}
private void InternalCalendarViewSelectionChanged(CalendarView sender, CalendarViewSelectedDatesChangedEventArgs args)
@@ -147,4 +159,20 @@ public partial class WinoCalendarView : Control
}
}
}
public void Dispose()
{
if (CalendarView == null)
return;
CalendarView.SelectedDatesChanged -= InternalCalendarViewSelectionChanged;
if (_displayModeCallbackToken != -1)
{
CalendarView.UnregisterPropertyChangedCallback(CalendarView.DisplayModeProperty, _displayModeCallbackToken);
_displayModeCallbackToken = -1;
}
CalendarView = null;
}
}
@@ -3,7 +3,7 @@
"Wino.Mail.WinUI (Package)": {
"commandName": "MsixPackage",
"doNotLaunchApp": false,
"nativeDebugging": true
"nativeDebugging": false
},
"Wino.Mail.WinUI (Unpackaged)": {
"commandName": "Project"
@@ -215,7 +215,10 @@ public class NavigationService : NavigationServiceBase, INavigationService
if (coreFrame.Content is IShellHost shell)
{
shell.ActivateMode(mode, isInitialShellNavigation);
shell.ActivateMode(mode, new ShellModeActivationContext
{
IsInitialActivation = isInitialShellNavigation
});
return true;
}
+1 -1
View File
@@ -93,7 +93,7 @@
<Frame
x:Name="MainShellFrame"
Grid.Row="1"
CacheSize="2"
CacheSize="0"
Navigated="MainFrameNavigated" />
<coreControls:WinoInfoBar
@@ -4,8 +4,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
xmlns:local="using:Wino.Mail.WinUI.Styles"
xmlns:winoControls="using:Wino.Mail.WinUI.Controls"
xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives">
xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives"
xmlns:winoControls="using:Wino.Mail.WinUI.Controls">
<Style x:Key="CalendarShellNavigationViewStyle" TargetType="controls:NavigationView">
<Setter Property="PaneToggleButtonStyle" Value="{StaticResource PaneToggleButtonStyle}" />
@@ -78,18 +78,6 @@ public sealed class WinoAppShellViewModel : CoreBaseViewModel, IShellViewModel
}
}
protected override void OnDispatcherAssigned()
{
base.OnDispatcherAssigned();
foreach (var client in _shellClients.Values)
{
client.Dispatcher = Dispatcher;
}
OnPropertyChanged(nameof(CurrentMenuItems));
}
public override void OnNavigatedTo(Core.Domain.Models.Navigation.NavigationMode mode, object parameters)
{
base.OnNavigatedTo(mode, parameters);
@@ -7,6 +7,6 @@ public abstract class CalendarAppShellAbstract : BasePage<CalendarAppShellViewMo
{
protected CalendarAppShellAbstract()
{
NavigationCacheMode = Microsoft.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
NavigationCacheMode = Microsoft.UI.Xaml.Navigation.NavigationCacheMode.Disabled;
}
}
@@ -7,6 +7,6 @@ public abstract class CalendarPageAbstract : BasePage<CalendarPageViewModel>
{
protected CalendarPageAbstract()
{
NavigationCacheMode = Microsoft.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
NavigationCacheMode = Microsoft.UI.Xaml.Navigation.NavigationCacheMode.Disabled;
}
}
@@ -4,6 +4,6 @@ public abstract class ContactsAppShellAbstract : BasePage
{
protected ContactsAppShellAbstract()
{
NavigationCacheMode = Microsoft.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
NavigationCacheMode = Microsoft.UI.Xaml.Navigation.NavigationCacheMode.Disabled;
}
}
@@ -1,6 +1,13 @@
using Microsoft.UI.Xaml.Navigation;
using Wino.Mail.WinUI;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class ContactsPageAbstract : BasePage<ContactsPageViewModel> { }
public abstract class ContactsPageAbstract : BasePage<ContactsPageViewModel>
{
protected ContactsPageAbstract()
{
NavigationCacheMode = NavigationCacheMode.Disabled;
}
}
@@ -7,6 +7,6 @@ public abstract class MailAppShellAbstract : BasePage<MailAppShellViewModel>
{
protected MailAppShellAbstract()
{
NavigationCacheMode = Microsoft.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
NavigationCacheMode = Microsoft.UI.Xaml.Navigation.NavigationCacheMode.Disabled;
}
}
@@ -1,6 +1,13 @@
using Microsoft.UI.Xaml.Navigation;
using Wino.Mail.WinUI;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public partial class MailListPageAbstract : BasePage<MailListPageViewModel>;
public partial class MailListPageAbstract : BasePage<MailListPageViewModel>
{
protected MailListPageAbstract()
{
NavigationCacheMode = NavigationCacheMode.Disabled;
}
}
@@ -1,6 +1,13 @@
using Microsoft.UI.Xaml.Navigation;
using Wino.Mail.WinUI;
using Wino.Core.ViewModels;
namespace Wino.Views.Abstract;
public abstract class SettingsPageAbstract : BasePage<SettingsPageViewModel> { }
public abstract class SettingsPageAbstract : BasePage<SettingsPageViewModel>
{
protected SettingsPageAbstract()
{
NavigationCacheMode = NavigationCacheMode.Disabled;
}
}
@@ -6,6 +6,6 @@ public abstract class WinoAppShellAbstract : BasePage<WinoAppShellViewModel>
{
protected WinoAppShellAbstract()
{
NavigationCacheMode = Microsoft.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
NavigationCacheMode = Microsoft.UI.Xaml.Navigation.NavigationCacheMode.Disabled;
}
}
@@ -17,6 +17,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:menu="using:Wino.Core.Domain.MenuItems"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
Loaded="OnLoaded"
PreviewKeyDown="OnPreviewKeyDown"
mc:Ignorable="d">
<Page.Resources>
@@ -312,7 +314,7 @@
<Frame
x:Name="InnerShellFrame"
Padding="0,0,7,7"
CacheSize="2"
CacheSize="0"
IsNavigationStackEnabled="True">
<Frame.ContentTransitions>
<TransitionCollection>
@@ -25,8 +25,6 @@ public sealed partial class CalendarAppShell : CalendarAppShellAbstract,
public CalendarAppShell()
{
InitializeComponent();
PreviewKeyDown += OnPreviewKeyDown;
Loaded += OnLoaded;
ManageCalendarDisplayType(ViewModel.StatePersistenceService.CalendarDisplayType);
}
@@ -83,6 +81,14 @@ public sealed partial class CalendarAppShell : CalendarAppShellAbstract,
{
base.OnNavigatedFrom(e);
InnerShellFrame.BackStack.Clear();
InnerShellFrame.ForwardStack.Clear();
if (InnerShellFrame.Content is IDisposable disposableContent)
{
disposableContent.Dispose();
}
Bindings.StopTracking();
}
@@ -26,6 +26,24 @@ public sealed partial class CalendarPage : CalendarPageAbstract,
ViewModel.DetailsShowCalendarItemChanged += CalendarItemDetailContextChanged;
}
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
{
base.OnNavigatingFrom(e);
ViewModel.DetailsShowCalendarItemChanged -= CalendarItemDetailContextChanged;
QuickEventPopupDialog.IsOpen = false;
EventDetailsPopup.IsOpen = false;
EventDetailsPopup.PlacementTarget = null;
CalendarControl.ResetTimelineSelection();
if (CalendarControl is IDisposable disposableCalendarControl)
{
disposableCalendarControl.Dispose();
}
Bindings.StopTracking();
}
private void CalendarItemDetailContextChanged(object? sender, EventArgs e)
{
if (ViewModel.DisplayDetailsCalendarItemViewModel != null)
@@ -59,16 +77,29 @@ public sealed partial class CalendarPage : CalendarPageAbstract,
WeakReferenceMessenger.Default.Unregister<GoPreviousDateRequestedMessage>(this);
}
public void Receive(ScrollToHourMessage message) => CalendarControl.NavigateToHour(message.TimeSpan);
public void Receive(ScrollToDateMessage message) => CalendarControl.NavigateToDay(message.Date);
public void Receive(GoNextDateRequestedMessage message) => CalendarControl.GoNextRange();
public void Receive(GoPreviousDateRequestedMessage message) => CalendarControl.GoPreviousRange();
public void Receive(ScrollToHourMessage message) => DispatcherQueue.TryEnqueue(() => CalendarControl.NavigateToHour(message.TimeSpan));
public void Receive(ScrollToDateMessage message) => DispatcherQueue.TryEnqueue(() => CalendarControl.NavigateToDay(message.Date));
public void Receive(GoNextDateRequestedMessage message) => DispatcherQueue.TryEnqueue(() => CalendarControl.GoNextRange());
public void Receive(GoPreviousDateRequestedMessage message) => DispatcherQueue.TryEnqueue(() => CalendarControl.GoPreviousRange());
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.Back) return;
if (e.NavigationMode == NavigationMode.Back)
{
if (ViewModel.RestoreVisibleState())
{
var restoreDate = ViewModel.GetRestoreDate();
DispatcherQueue.TryEnqueue(() => CalendarControl.NavigateToDay(restoreDate));
}
else
{
WeakReferenceMessenger.Default.Send(new LoadCalendarMessage(DateTime.Now.Date, CalendarInitInitiative.App));
}
return;
}
if (e.Parameter is CalendarPageNavigationArgs args)
{
@@ -108,12 +108,11 @@
Grid.Column="2"
Command="{x:Bind ViewModel.NavigateExternalCommand}"
CommandParameter="Store"
Style="{StaticResource AccentButtonStyle}"
ToolTipService.ToolTip="{x:Bind domain:Translator.SettingsStore_Title}">
<Viewbox Width="18" Height="18">
<Path
Data="F1 M 19.003906 3.251953 L 19.003906 15.947266 C 19.003906 16.357422 18.920898 16.748047 18.754883 17.119141 C 18.588867 17.490234 18.367512 17.814127 18.09082 18.09082 C 17.814127 18.367514 17.490234 18.588867 17.119141 18.754883 C 16.748047 18.920898 16.357422 19.003906 15.947266 19.003906 L 3.056641 19.003906 C 2.646484 19.003906 2.255859 18.920898 1.884766 18.754883 C 1.513672 18.588867 1.189779 18.367514 0.913086 18.09082 C 0.636393 17.814127 0.415039 17.490234 0.249023 17.119141 C 0.083008 16.748047 0 16.357422 0 15.947266 L 0 3.251953 C 0 3.076172 0.032552 2.913412 0.097656 2.763672 C 0.16276 2.613934 0.252279 2.482098 0.366211 2.368164 C 0.480143 2.254232 0.611979 2.164715 0.761719 2.099609 C 0.911458 2.034506 1.074219 2.001953 1.25 2.001953 L 4.003906 2.001953 L 4.003906 0.996094 C 4.003906 0.859375 4.029948 0.730795 4.082031 0.610352 C 4.134114 0.48991 4.205729 0.384115 4.296875 0.292969 C 4.388021 0.201824 4.493815 0.130209 4.614258 0.078125 C 4.7347 0.026043 4.863281 0 5 0 L 14.003906 0 C 14.140624 0 14.269205 0.026043 14.389648 0.078125 C 14.510091 0.130209 14.615885 0.201824 14.707031 0.292969 C 14.798177 0.384115 14.869791 0.48991 14.921875 0.610352 C 14.973957 0.730795 14.999999 0.859375 15 0.996094 L 15 2.001953 L 17.753906 2.001953 C 17.923176 2.001953 18.084309 2.034506 18.237305 2.099609 C 18.390299 2.164715 18.523762 2.254232 18.637695 2.368164 C 18.751627 2.482098 18.841145 2.615561 18.90625 2.768555 C 18.971354 2.921551 19.003906 3.082684 19.003906 3.251953 Z M 14.003906 0.996094 L 5 0.996094 L 5 2.001953 L 14.003906 2.001953 Z M 5 10 L 9.003906 10 L 9.003906 5.996094 L 5 5.996094 Z M 10 10 L 14.003906 10 L 14.003906 5.996094 L 10 5.996094 Z M 5 15 L 9.003906 15 L 9.003906 10.996094 L 5 10.996094 Z M 10 15 L 14.003906 15 L 14.003906 10.996094 L 10 10.996094 Z "
Fill="{ThemeResource AccentTextFillColorPrimaryBrush}"
Fill="{ThemeResource TextFillColorPrimaryBrush}"
Stretch="Uniform" />
</Viewbox>
</Button>
@@ -128,14 +127,14 @@
Description="{x:Bind ViewModel.AccountSummaryText, Mode=OneWay}"
Header="{x:Bind domain:Translator.SettingsManageAccountSettings_Title}"
IsClickEnabled="True"
Tag="{x:Bind enums:WinoPage.AccountManagementPage}">
Tag="{x:Bind enums:WinoPage.ManageAccountsPage}">
<controls:SettingsCard.HeaderIcon>
<FontIcon Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}" Glyph="&#xE77B;" />
</controls:SettingsCard.HeaderIcon>
<Button
Click="SettingOptionClicked"
Style="{StaticResource AccentButtonStyle}"
Tag="{x:Bind enums:WinoPage.AccountManagementPage}">
Tag="{x:Bind enums:WinoPage.ManageAccountsPage}">
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock Text="{x:Bind domain:Translator.Buttons_Manage}" />
<FontIcon FontSize="12" Glyph="&#xE76C;" />
@@ -31,6 +31,9 @@ public sealed partial class SettingsPage : SettingsPageAbstract,
// Register for frame navigation events to track back button visibility
SettingsFrame.Navigated -= SettingsFrameNavigated;
SettingsFrame.Navigated += SettingsFrameNavigated;
PageHistory.Clear();
SettingsFrame.BackStack.Clear();
SettingsFrame.ForwardStack.Clear();
SettingsFrame.Navigate(typeof(SettingOptionsPage), null, new SuppressNavigationTransitionInfo());
@@ -53,6 +56,10 @@ public sealed partial class SettingsPage : SettingsPageAbstract,
case WinoPage.EmailTemplatesPage:
WeakReferenceMessenger.Default.Send(new BreadcrumbNavigationRequested(Translator.SettingsEmailTemplates_Title, WinoPage.EmailTemplatesPage));
break;
case WinoPage.ManageAccountsPage:
case WinoPage.AccountManagementPage:
WeakReferenceMessenger.Default.Send(new BreadcrumbNavigationRequested(Translator.SettingsManageAccountSettings_Title, WinoPage.ManageAccountsPage));
break;
}
}
+1
View File
@@ -644,6 +644,7 @@
<!-- Main Content -->
<Frame
x:Name="InnerShellFrame"
CacheSize="0"
Padding="0,0,7,7"
IsNavigationStackEnabled="True"
Navigated="ShellFrameContentNavigated">
+29 -11
View File
@@ -13,6 +13,7 @@ using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Navigation;
using Windows.Foundation;
using Wino.Calendar.Controls;
using Wino.Calendar.Views;
using Wino.Calendar.ViewModels;
using Wino.Core.Domain;
using Wino.Core.Domain.Entities.Mail;
@@ -31,6 +32,9 @@ using Wino.Messaging.Client.Accounts;
using Wino.Messaging.Client.Calendar;
using Wino.Messaging.Client.Mails;
using Wino.Messaging.Client.Shell;
using Wino.Views.Mail;
using Wino.Views;
using Wino.Views.Settings;
namespace Wino.Mail.WinUI.Views;
@@ -51,6 +55,11 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
{
InitializeComponent();
var pageDispatcher = new WinUIDispatcher(DispatcherQueue);
ViewModel.MailClient.Dispatcher = pageDispatcher;
ViewModel.CalendarClient.Dispatcher = pageDispatcher;
ViewModel.GetClient(WinoApplicationMode.Contacts).Dispatcher = pageDispatcher;
ViewModel.MailClient.PropertyChanged += MailClientPropertyChanged;
ViewModel.CalendarClient.PropertyChanged += CalendarClientPropertyChanged;
ViewModel.StatePersistenceService.StatePropertyChanged += StatePersistenceServiceChanged;
@@ -66,30 +75,22 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
public Frame GetShellFrame() => InnerShellFrame;
public void ActivateMode(WinoApplicationMode mode, bool isInitialActivation)
public void ActivateMode(WinoApplicationMode mode, ShellModeActivationContext activationContext)
{
if (_activeMode == mode && InnerShellFrame.Content != null)
return;
DeactivateCurrentMode();
ResetShellModeNavigationState();
_activeMode = mode;
ViewModel.SetCurrentMode(mode);
RefreshNavigationViewBindings(syncMailSelection: mode != WinoApplicationMode.Mail);
//InnerShellFrame.IsNavigationStackEnabled = mode == WinoApplicationMode.Calendar;
//InnerShellFrame.BackStack.Clear();
//InnerShellFrame.ForwardStack.Clear();
ApplyModeLayout();
UpdateTitleBarSubtitle();
var activationContext = new ShellModeActivationContext
{
IsInitialActivation = isInitialActivation
};
ViewModel.CurrentClient.Activate(activationContext);
ApplyTitleBarContent();
@@ -110,7 +111,10 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
if (_activeMode == null)
{
ActivateMode(ViewModel.StatePersistenceService.ApplicationMode, true);
ActivateMode(ViewModel.StatePersistenceService.ApplicationMode, new ShellModeActivationContext
{
IsInitialActivation = true
});
}
}
@@ -133,16 +137,30 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
{
if (_activeMode == WinoApplicationMode.Mail)
{
WeakReferenceMessenger.Default.Send(new ClearMailSelectionsRequested());
WeakReferenceMessenger.Default.Send(new DisposeRenderingFrameRequested());
ViewModel.StatePersistenceService.IsReadingMail = false;
ViewModel.MailClient.Deactivate();
}
else if (_activeMode == WinoApplicationMode.Calendar)
{
ViewModel.StatePersistenceService.IsEventDetailsVisible = false;
ViewModel.CalendarClient.Deactivate();
}
else if (_activeMode == WinoApplicationMode.Contacts)
{
ViewModel.CurrentClient.Deactivate();
}
DynamicPageShellContentPresenter.Content = null;
}
private void ResetShellModeNavigationState()
{
ViewModel.StatePersistenceService.IsManageAccountsNavigating = false;
ViewModel.StatePersistenceService.IsSettingsNavigating = false;
InnerShellFrame.BackStack.Clear();
InnerShellFrame.ForwardStack.Clear();
}
private void ApplyTitleBarContent()