Improved shell experience.
This commit is contained in:
@@ -30,7 +30,6 @@ namespace Wino.Mail.ViewModels;
|
||||
|
||||
public partial class MailAppShellViewModel : MailBaseViewModel,
|
||||
IMailShellClient,
|
||||
IRecipient<NavigateManageAccountsRequested>,
|
||||
IRecipient<MailtoProtocolMessageRequested>,
|
||||
IRecipient<RefreshUnreadCountsMessage>,
|
||||
IRecipient<AccountsMenuRefreshRequested>,
|
||||
@@ -232,31 +231,19 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
||||
base.OnNavigatedTo(mode, parameters);
|
||||
|
||||
var activationContext = parameters as ShellModeActivationContext;
|
||||
var isModeResetActivation = activationContext != null;
|
||||
var shouldRunStartupFlows = activationContext?.IsInitialActivation ?? true;
|
||||
var hasExistingMenuItems = MenuItems?.Any() == true;
|
||||
|
||||
PreferencesService.PreferenceChanged -= PreferencesServiceChanged;
|
||||
PreferencesService.PreferenceChanged += PreferencesServiceChanged;
|
||||
|
||||
if (mode == NavigationMode.Back && !isModeResetActivation)
|
||||
{
|
||||
// Preserve current mail/folder selection and active rendering page when
|
||||
// switching back from Calendar mode. Recreating menu/folder state here
|
||||
// causes a folder reload, which clears selection and disposes reader page.
|
||||
// Rehydrate only if menu state is unexpectedly empty.
|
||||
if (MenuItems?.Any() != true || FooterItems?.Any() != true)
|
||||
{
|
||||
await CreateFooterItemsAsync();
|
||||
await RecreateMenuItemsAsync();
|
||||
await RestoreSelectedAccountAfterMenuRefreshAsync(false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
await CreateFooterItemsAsync(true);
|
||||
|
||||
await RecreateMenuItemsAsync();
|
||||
if (!hasExistingMenuItems)
|
||||
{
|
||||
await RecreateMenuItemsAsync();
|
||||
}
|
||||
|
||||
await ProcessLaunchOptionsAsync();
|
||||
await ValidateWebView2RuntimeAsync();
|
||||
|
||||
@@ -934,8 +921,6 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
||||
accountMenuItem.UpdateAccount(accountModel);
|
||||
}
|
||||
|
||||
public void Receive(NavigateManageAccountsRequested message) => SelectedMenuItem = ManageAccountsMenuItem;
|
||||
|
||||
public async void Receive(MailtoProtocolMessageRequested message)
|
||||
{
|
||||
var accounts = await _accountService.GetAccountsAsync();
|
||||
@@ -1173,7 +1158,6 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
||||
Messenger.Register<AccountCreatedMessage>(this);
|
||||
Messenger.Register<AccountRemovedMessage>(this);
|
||||
Messenger.Register<AccountUpdatedMessage>(this);
|
||||
Messenger.Register<NavigateManageAccountsRequested>(this);
|
||||
Messenger.Register<MailtoProtocolMessageRequested>(this);
|
||||
Messenger.Register<RefreshUnreadCountsMessage>(this);
|
||||
Messenger.Register<AccountsMenuRefreshRequested>(this);
|
||||
@@ -1192,7 +1176,6 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
||||
Messenger.Unregister<AccountCreatedMessage>(this);
|
||||
Messenger.Unregister<AccountRemovedMessage>(this);
|
||||
Messenger.Unregister<AccountUpdatedMessage>(this);
|
||||
Messenger.Unregister<NavigateManageAccountsRequested>(this);
|
||||
Messenger.Unregister<MailtoProtocolMessageRequested>(this);
|
||||
Messenger.Unregister<RefreshUnreadCountsMessage>(this);
|
||||
Messenger.Unregister<AccountsMenuRefreshRequested>(this);
|
||||
|
||||
@@ -17,8 +17,8 @@ using Wino.Core.Domain.Entities.Mail;
|
||||
using Wino.Core.Domain.Entities.Shared;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models.Folders;
|
||||
using Wino.Core.Domain.Models;
|
||||
using Wino.Core.Domain.Models.Folders;
|
||||
using Wino.Core.Domain.Models.MailItem;
|
||||
using Wino.Core.Domain.Models.Menus;
|
||||
using Wino.Core.Domain.Models.Navigation;
|
||||
@@ -198,30 +198,6 @@ public partial class MailListPageViewModel : MailBaseViewModel,
|
||||
SelectedSortingOption = SortingOptions[0];
|
||||
|
||||
MailListLength = statePersistenceService.MailListPaneLength;
|
||||
|
||||
//_selectionChangedThrottler = new ThrottledEventHandler(100, () =>
|
||||
//{
|
||||
// _ = ExecuteUIThread(() =>
|
||||
// {
|
||||
// if (MailCollection.SelectedVisibleCount == 1)
|
||||
// {
|
||||
// ActiveMailItemChanged(MailCollection.SelectedVisibleItems.ElementAt(0));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // At this point, either we don't have any item selected
|
||||
// // or we have multiple item selected. In either case
|
||||
// // there should be no active item.
|
||||
|
||||
// ActiveMailItemChanged(null);
|
||||
// }
|
||||
|
||||
// NotifyItemSelected();
|
||||
// SetupTopBarActions();
|
||||
// });
|
||||
|
||||
// ThrottledSelectionChanged?.Invoke(this, EventArgs.Empty);
|
||||
//});
|
||||
}
|
||||
|
||||
public override void OnNavigatedTo(NavigationMode mode, object parameters)
|
||||
|
||||
Reference in New Issue
Block a user