Improved shell experience.
This commit is contained in:
@@ -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="" />
|
||||
</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="" />
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -644,6 +644,7 @@
|
||||
<!-- Main Content -->
|
||||
<Frame
|
||||
x:Name="InnerShellFrame"
|
||||
CacheSize="0"
|
||||
Padding="0,0,7,7"
|
||||
IsNavigationStackEnabled="True"
|
||||
Navigated="ShellFrameContentNavigated">
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user