Handling some warnings and proper disposals of shells etc.
This commit is contained in:
@@ -104,6 +104,7 @@ private string searchQuery = string.Empty;
|
|||||||
- WinUI 3 auto-converts bool to Visibility: `Visibility="{x:Bind IsVisible, Mode=OneWay}"`
|
- WinUI 3 auto-converts bool to Visibility: `Visibility="{x:Bind IsVisible, Mode=OneWay}"`
|
||||||
- Use XamlHelpers for complex conversions: `{x:Bind helpers:XamlHelpers.ReverseBoolToVisibilityConverter(Prop)}`
|
- Use XamlHelpers for complex conversions: `{x:Bind helpers:XamlHelpers.ReverseBoolToVisibilityConverter(Prop)}`
|
||||||
- `x:Bind` does not implicitly convert `double` to `GridLength`; when binding `RowDefinition.Height` or `ColumnDefinition.Width`, use a `XamlHelpers` method such as `DoubleToGridLength(...)`
|
- `x:Bind` does not implicitly convert `double` to `GridLength`; when binding `RowDefinition.Height` or `ColumnDefinition.Width`, use a `XamlHelpers` method such as `DoubleToGridLength(...)`
|
||||||
|
- For `ComboBox` controls in XAML, never use `DisplayMemberPath` or `SelectedValuePath`; use a typed `ItemTemplate` and bind `SelectedItem` explicitly, preferably with `x:Bind`
|
||||||
|
|
||||||
## Localization
|
## Localization
|
||||||
|
|
||||||
|
|||||||
@@ -198,6 +198,26 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
|
|||||||
_calendarPageViewModel.CleanupForShellDeactivation();
|
_calendarPageViewModel.CleanupForShellDeactivation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PrepareForShellShutdown()
|
||||||
|
{
|
||||||
|
DetachRuntimeSubscriptions();
|
||||||
|
PreferencesService.PreferenceChanged -= PreferencesServiceChanged;
|
||||||
|
|
||||||
|
if (_hasRegisteredPersistentRecipients)
|
||||||
|
{
|
||||||
|
UnregisterRecipients();
|
||||||
|
_hasRegisteredPersistentRecipients = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DateNavigationHeaderItems.Clear();
|
||||||
|
SelectedDateNavigationHeaderIndex = -1;
|
||||||
|
SelectedMenuItemIndex = -1;
|
||||||
|
MenuItems?.Clear();
|
||||||
|
FooterItems?.Clear();
|
||||||
|
AccountCalendarStateService.ClearGroupedAccountCalendars();
|
||||||
|
_calendarPageViewModel.CleanupForShellDeactivation();
|
||||||
|
}
|
||||||
|
|
||||||
private void AttachRuntimeSubscriptions()
|
private void AttachRuntimeSubscriptions()
|
||||||
{
|
{
|
||||||
if (_runtimeSubscriptionsAttached)
|
if (_runtimeSubscriptionsAttached)
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ namespace Wino.Mail.ViewModels;
|
|||||||
|
|
||||||
public partial class MailAppShellViewModel : MailBaseViewModel,
|
public partial class MailAppShellViewModel : MailBaseViewModel,
|
||||||
IMailShellClient,
|
IMailShellClient,
|
||||||
IRecipient<AccountCreatedMessage>,
|
|
||||||
IRecipient<MailtoProtocolMessageRequested>,
|
IRecipient<MailtoProtocolMessageRequested>,
|
||||||
IRecipient<RefreshUnreadCountsMessage>,
|
IRecipient<RefreshUnreadCountsMessage>,
|
||||||
IRecipient<AccountsMenuRefreshRequested>,
|
IRecipient<AccountsMenuRefreshRequested>,
|
||||||
@@ -236,14 +235,14 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
|||||||
|
|
||||||
var activationContext = parameters as ShellModeActivationContext;
|
var activationContext = parameters as ShellModeActivationContext;
|
||||||
var shouldRunStartupFlows = activationContext?.IsInitialActivation ?? true;
|
var shouldRunStartupFlows = activationContext?.IsInitialActivation ?? true;
|
||||||
var hasExistingMenuItems = MenuItems?.Any() == true;
|
var hasExistingAccountMenuItems = MenuItems?.OfType<IAccountMenuItem>().Any() == true;
|
||||||
|
|
||||||
PreferencesService.PreferenceChanged -= PreferencesServiceChanged;
|
PreferencesService.PreferenceChanged -= PreferencesServiceChanged;
|
||||||
PreferencesService.PreferenceChanged += PreferencesServiceChanged;
|
PreferencesService.PreferenceChanged += PreferencesServiceChanged;
|
||||||
|
|
||||||
await CreateFooterItemsAsync(true);
|
await CreateFooterItemsAsync(true);
|
||||||
|
|
||||||
if (!hasExistingMenuItems)
|
if (!hasExistingAccountMenuItems)
|
||||||
{
|
{
|
||||||
await RecreateMenuItemsAsync();
|
await RecreateMenuItemsAsync();
|
||||||
}
|
}
|
||||||
@@ -278,6 +277,24 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
|||||||
PreferencesService.PreferenceChanged -= PreferencesServiceChanged;
|
PreferencesService.PreferenceChanged -= PreferencesServiceChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PrepareForShellShutdown()
|
||||||
|
{
|
||||||
|
PreferencesService.PreferenceChanged -= PreferencesServiceChanged;
|
||||||
|
|
||||||
|
if (_hasRegisteredPersistentRecipients)
|
||||||
|
{
|
||||||
|
UnregisterRecipients();
|
||||||
|
_hasRegisteredPersistentRecipients = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
latestSelectedAccountMenuItem = null;
|
||||||
|
SelectedMenuItem = null;
|
||||||
|
|
||||||
|
MenuItems?.Clear();
|
||||||
|
MenuItems?.Add(CreateMailMenuItem);
|
||||||
|
FooterItems?.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
private async Task ShowWhatIsNewIfNeededAsync()
|
private async Task ShowWhatIsNewIfNeededAsync()
|
||||||
{
|
{
|
||||||
if (!_updateManager.ShouldShowUpdateNotes())
|
if (!_updateManager.ShouldShowUpdateNotes())
|
||||||
@@ -1159,7 +1176,6 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
|||||||
|
|
||||||
Messenger.Register<AccountRemovedMessage>(this);
|
Messenger.Register<AccountRemovedMessage>(this);
|
||||||
Messenger.Register<AccountUpdatedMessage>(this);
|
Messenger.Register<AccountUpdatedMessage>(this);
|
||||||
Messenger.Register<AccountCreatedMessage>(this);
|
|
||||||
Messenger.Register<MailtoProtocolMessageRequested>(this);
|
Messenger.Register<MailtoProtocolMessageRequested>(this);
|
||||||
Messenger.Register<RefreshUnreadCountsMessage>(this);
|
Messenger.Register<RefreshUnreadCountsMessage>(this);
|
||||||
Messenger.Register<AccountsMenuRefreshRequested>(this);
|
Messenger.Register<AccountsMenuRefreshRequested>(this);
|
||||||
@@ -1177,7 +1193,6 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
|||||||
|
|
||||||
Messenger.Unregister<AccountRemovedMessage>(this);
|
Messenger.Unregister<AccountRemovedMessage>(this);
|
||||||
Messenger.Unregister<AccountUpdatedMessage>(this);
|
Messenger.Unregister<AccountUpdatedMessage>(this);
|
||||||
Messenger.Unregister<AccountCreatedMessage>(this);
|
|
||||||
Messenger.Unregister<MailtoProtocolMessageRequested>(this);
|
Messenger.Unregister<MailtoProtocolMessageRequested>(this);
|
||||||
Messenger.Unregister<RefreshUnreadCountsMessage>(this);
|
Messenger.Unregister<RefreshUnreadCountsMessage>(this);
|
||||||
Messenger.Unregister<AccountsMenuRefreshRequested>(this);
|
Messenger.Unregister<AccountsMenuRefreshRequested>(this);
|
||||||
@@ -1191,6 +1206,19 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
|||||||
|
|
||||||
public async void Receive(AccountRemovedMessage message)
|
public async void Receive(AccountRemovedMessage message)
|
||||||
{
|
{
|
||||||
|
var remainingAccounts = await _accountService.GetAccountsAsync().ConfigureAwait(false);
|
||||||
|
if (!remainingAccounts.Any())
|
||||||
|
{
|
||||||
|
latestSelectedAccountMenuItem = null;
|
||||||
|
await ExecuteUIThread(() =>
|
||||||
|
{
|
||||||
|
SelectedMenuItem = null;
|
||||||
|
MenuItems?.Clear();
|
||||||
|
MenuItems?.Add(CreateMailMenuItem);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (latestSelectedAccountMenuItem?.HoldingAccounts?.Any(a => a.Id == message.Account.Id) == true)
|
if (latestSelectedAccountMenuItem?.HoldingAccounts?.Any(a => a.Id == message.Account.Id) == true)
|
||||||
{
|
{
|
||||||
latestSelectedAccountMenuItem = null;
|
latestSelectedAccountMenuItem = null;
|
||||||
@@ -1201,9 +1229,6 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
|||||||
await RestoreSelectedAccountAfterMenuRefreshAsync(false);
|
await RestoreSelectedAccountAfterMenuRefreshAsync(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Receive(AccountCreatedMessage message)
|
|
||||||
=> await HandleAccountCreatedAsync(message.Account);
|
|
||||||
|
|
||||||
public async Task HandleAccountCreatedAsync(MailAccount createdAccount)
|
public async Task HandleAccountCreatedAsync(MailAccount createdAccount)
|
||||||
{
|
{
|
||||||
latestSelectedAccountMenuItem = null;
|
latestSelectedAccountMenuItem = null;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using Microsoft.Toolkit.Uwp.Notifications;
|
using Microsoft.Toolkit.Uwp.Notifications;
|
||||||
using Microsoft.UI.Dispatching;
|
using Microsoft.UI.Dispatching;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Media.Animation;
|
||||||
using Microsoft.Windows.AppLifecycle;
|
using Microsoft.Windows.AppLifecycle;
|
||||||
using Microsoft.Windows.AppNotifications;
|
using Microsoft.Windows.AppNotifications;
|
||||||
using MimeKit.Cryptography;
|
using MimeKit.Cryptography;
|
||||||
@@ -192,7 +193,7 @@ public partial class App : WinoApplication,
|
|||||||
if (welcomeWindow == null)
|
if (welcomeWindow == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
windowManager.HideWindow(WinoWindowKind.Shell);
|
CloseShellWindowIfPresent();
|
||||||
await ActivateWindowAsync(welcomeWindow);
|
await ActivateWindowAsync(welcomeWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,6 +233,16 @@ public partial class App : WinoApplication,
|
|||||||
welcomeWindow.Close();
|
welcomeWindow.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CloseShellWindowIfPresent()
|
||||||
|
{
|
||||||
|
var windowManager = Services.GetRequiredService<IWinoWindowManager>();
|
||||||
|
if (windowManager.GetWindow(WinoWindowKind.Shell) is not ShellWindow shellWindow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
shellWindow.PrepareForClose();
|
||||||
|
shellWindow.Close();
|
||||||
|
}
|
||||||
|
|
||||||
private async Task ActivateWindowAsync(WindowEx window)
|
private async Task ActivateWindowAsync(WindowEx window)
|
||||||
{
|
{
|
||||||
var windowManager = Services.GetRequiredService<IWinoWindowManager>();
|
var windowManager = Services.GetRequiredService<IWinoWindowManager>();
|
||||||
@@ -792,8 +803,9 @@ public partial class App : WinoApplication,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Services.GetRequiredService<INavigationService>()
|
rootFrame.BackStack.Clear();
|
||||||
.Navigate(WinoPage.WelcomeHostPage, null, NavigationReferenceFrame.ShellFrame, NavigationTransitionType.None);
|
rootFrame.ForwardStack.Clear();
|
||||||
|
rootFrame.Navigate(typeof(WelcomeHostPage), null, new SuppressNavigationTransitionInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -926,8 +938,8 @@ public partial class App : WinoApplication,
|
|||||||
// All accounts removed — go back to welcome wizard from step 1
|
// All accounts removed — go back to welcome wizard from step 1
|
||||||
Services.GetRequiredService<WelcomeWizardContext>().Reset();
|
Services.GetRequiredService<WelcomeWizardContext>().Reset();
|
||||||
StopAutoSynchronizationLoop();
|
StopAutoSynchronizationLoop();
|
||||||
|
CloseShellWindowIfPresent();
|
||||||
CreateWelcomeWindow();
|
CreateWelcomeWindow();
|
||||||
windowManager.HideWindow(WinoWindowKind.Shell);
|
|
||||||
if (MainWindow != null)
|
if (MainWindow != null)
|
||||||
await ActivateWindowAsync(MainWindow);
|
await ActivateWindowAsync(MainWindow);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,22 +9,22 @@
|
|||||||
Loaded="ControlLoaded"
|
Loaded="ControlLoaded"
|
||||||
SelectionChanged="ModeSegmentedControlSelectionChanged"
|
SelectionChanged="ModeSegmentedControlSelectionChanged"
|
||||||
Unloaded="ControlUnloaded">
|
Unloaded="ControlUnloaded">
|
||||||
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.KeyboardShortcuts_ModeMail, Mode=OneWay}">
|
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.KeyboardShortcuts_ModeMail}">
|
||||||
<controls:SegmentedItem.Icon>
|
<controls:SegmentedItem.Icon>
|
||||||
<SymbolIcon Symbol="Mail" />
|
<SymbolIcon Symbol="Mail" />
|
||||||
</controls:SegmentedItem.Icon>
|
</controls:SegmentedItem.Icon>
|
||||||
</controls:SegmentedItem>
|
</controls:SegmentedItem>
|
||||||
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.KeyboardShortcuts_ModeCalendar, Mode=OneWay}">
|
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.KeyboardShortcuts_ModeCalendar}">
|
||||||
<controls:SegmentedItem.Icon>
|
<controls:SegmentedItem.Icon>
|
||||||
<SymbolIcon Symbol="Calendar" />
|
<SymbolIcon Symbol="Calendar" />
|
||||||
</controls:SegmentedItem.Icon>
|
</controls:SegmentedItem.Icon>
|
||||||
</controls:SegmentedItem>
|
</controls:SegmentedItem>
|
||||||
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.ContactsPage_Title, Mode=OneWay}">
|
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.ContactsPage_Title}">
|
||||||
<controls:SegmentedItem.Icon>
|
<controls:SegmentedItem.Icon>
|
||||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="" />
|
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="" />
|
||||||
</controls:SegmentedItem.Icon>
|
</controls:SegmentedItem.Icon>
|
||||||
</controls:SegmentedItem>
|
</controls:SegmentedItem>
|
||||||
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.MenuSettings, Mode=OneWay}">
|
<controls:SegmentedItem Padding="0" ToolTipService.ToolTip="{x:Bind domain:Translator.MenuSettings}">
|
||||||
<controls:SegmentedItem.Icon>
|
<controls:SegmentedItem.Icon>
|
||||||
<SymbolIcon Symbol="Setting" />
|
<SymbolIcon Symbol="Setting" />
|
||||||
</controls:SegmentedItem.Icon>
|
</controls:SegmentedItem.Icon>
|
||||||
|
|||||||
@@ -52,6 +52,10 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="ParagraphStyleOptionTemplate" x:DataType="mail:EditorParagraphStyleOption">
|
||||||
|
<TextBlock Text="{x:Bind Name}" />
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<toolkit:TabbedCommandBar>
|
<toolkit:TabbedCommandBar>
|
||||||
@@ -231,7 +235,7 @@
|
|||||||
x:Name="ParagraphStyleComboBox"
|
x:Name="ParagraphStyleComboBox"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
MinWidth="104"
|
MinWidth="104"
|
||||||
DisplayMemberPath="Name"
|
ItemTemplate="{StaticResource ParagraphStyleOptionTemplate}"
|
||||||
PlaceholderText="Paragraph"
|
PlaceholderText="Paragraph"
|
||||||
SelectionChanged="ParagraphStyleComboBox_SelectionChanged"
|
SelectionChanged="ParagraphStyleComboBox_SelectionChanged"
|
||||||
Style="{StaticResource CompactComboBoxStyle}" />
|
Style="{StaticResource CompactComboBoxStyle}" />
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
FontFamily="Consolas"
|
FontFamily="Consolas"
|
||||||
FontSize="12"
|
FontSize="12"
|
||||||
IsTextSelectionEnabled="True"
|
IsTextSelectionEnabled="True"
|
||||||
Text="{x:Bind MessageSource, Mode=OneWay}"
|
Text="{x:Bind MessageSource}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
</Border>
|
</Border>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
CanDragItems="False"
|
CanDragItems="False"
|
||||||
CanReorderItems="False"
|
CanReorderItems="False"
|
||||||
ItemTemplate="{StaticResource FolderStructureMenuFlyoutItemTemplate}"
|
ItemTemplate="{StaticResource FolderStructureMenuFlyoutItemTemplate}"
|
||||||
ItemsSource="{x:Bind FolderList, Mode=OneWay}"
|
ItemsSource="{x:Bind FolderList}"
|
||||||
SelectedItem="{x:Bind SelectedFolder, Mode=TwoWay}"
|
SelectedItem="{x:Bind SelectedFolder, Mode=TwoWay}"
|
||||||
SelectionMode="Single" />
|
SelectionMode="Single" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -163,7 +163,7 @@
|
|||||||
|
|
||||||
<ComboBox
|
<ComboBox
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Header="{x:Bind domain:Translator.ImapCalDavSettingsPage_CalendarModeHeader, Mode=OneWay}"
|
Header="{x:Bind domain:Translator.ImapCalDavSettingsPage_CalendarModeHeader}"
|
||||||
ItemsSource="{x:Bind CalendarModeOptions, Mode=OneWay}"
|
ItemsSource="{x:Bind CalendarModeOptions, Mode=OneWay}"
|
||||||
SelectedIndex="{x:Bind SelectedCalendarModeIndex, Mode=TwoWay}" />
|
SelectedIndex="{x:Bind SelectedCalendarModeIndex, Mode=TwoWay}" />
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,13 @@
|
|||||||
<StackPanel Margin="0,8,0,0" Spacing="12">
|
<StackPanel Margin="0,8,0,0" Spacing="12">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||||
Text="{x:Bind domain:Translator.CalendarEventCompose_DefaultCalendarHint, Mode=OneWay}"
|
Text="{x:Bind domain:Translator.CalendarEventCompose_DefaultCalendarHint}"
|
||||||
TextWrapping="WrapWholeWords" />
|
TextWrapping="WrapWholeWords" />
|
||||||
|
|
||||||
<HyperlinkButton
|
<HyperlinkButton
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Click="OpenCalendarSettingsClicked"
|
Click="OpenCalendarSettingsClicked"
|
||||||
Content="{x:Bind domain:Translator.CalendarEventCompose_DefaultCalendarSettingsLink, Mode=OneWay}"
|
Content="{x:Bind domain:Translator.CalendarEventCompose_DefaultCalendarSettingsLink}"
|
||||||
Padding="0" />
|
Padding="0" />
|
||||||
|
|
||||||
<ScrollViewer MaxHeight="400">
|
<ScrollViewer MaxHeight="400">
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
Width="14"
|
Width="14"
|
||||||
Height="14"
|
Height="14"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Fill="{x:Bind helpers:XamlHelpers.GetSolidColorBrushFromHex(BackgroundColorHex), Mode=OneWay}" />
|
Fill="{x:Bind helpers:XamlHelpers.GetSolidColorBrushFromHex(BackgroundColorHex)}" />
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"Wino.Mail.WinUI (Package)": {
|
"Wino.Mail.WinUI (Package)": {
|
||||||
"commandName": "MsixPackage",
|
"commandName": "MsixPackage",
|
||||||
"doNotLaunchApp": false,
|
"doNotLaunchApp": false,
|
||||||
"nativeDebugging": true
|
"nativeDebugging": false
|
||||||
},
|
},
|
||||||
"Wino.Mail.WinUI (Unpackaged)": {
|
"Wino.Mail.WinUI (Unpackaged)": {
|
||||||
"commandName": "Project"
|
"commandName": "Project"
|
||||||
|
|||||||
@@ -143,17 +143,6 @@
|
|||||||
</LinearGradientBrush>
|
</LinearGradientBrush>
|
||||||
</Border.Background>
|
</Border.Background>
|
||||||
<StackPanel Spacing="4">
|
<StackPanel Spacing="4">
|
||||||
<Border
|
|
||||||
Width="40"
|
|
||||||
Height="40"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Background="{ThemeResource AccentFillColorDefaultBrush}"
|
|
||||||
CornerRadius="20">
|
|
||||||
<FontIcon
|
|
||||||
FontSize="18"
|
|
||||||
Foreground="White"
|
|
||||||
Glyph="" />
|
|
||||||
</Border>
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="0,8,0,0"
|
Margin="0,8,0,0"
|
||||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public sealed partial class ShellWindow : WindowEx, IWinoShellWindow,
|
|||||||
IRecipient<WinoAccountProfileUpdatedMessage>,
|
IRecipient<WinoAccountProfileUpdatedMessage>,
|
||||||
IRecipient<WinoAccountProfileDeletedMessage>
|
IRecipient<WinoAccountProfileDeletedMessage>
|
||||||
{
|
{
|
||||||
|
private bool _allowClose;
|
||||||
public IStatePersistanceService StatePersistanceService { get; } = WinoApplication.Current.Services.GetService<IStatePersistanceService>() ?? throw new Exception("StatePersistanceService not registered in DI container.");
|
public IStatePersistanceService StatePersistanceService { get; } = WinoApplication.Current.Services.GetService<IStatePersistanceService>() ?? throw new Exception("StatePersistanceService not registered in DI container.");
|
||||||
public IPreferencesService PreferencesService { get; } = WinoApplication.Current.Services.GetService<IPreferencesService>() ?? throw new Exception("PreferencesService not registered in DI container.");
|
public IPreferencesService PreferencesService { get; } = WinoApplication.Current.Services.GetService<IPreferencesService>() ?? throw new Exception("PreferencesService not registered in DI container.");
|
||||||
public INavigationService NavigationService { get; } = WinoApplication.Current.Services.GetService<INavigationService>() ?? throw new Exception("NavigationService not registered in DI container.");
|
public INavigationService NavigationService { get; } = WinoApplication.Current.Services.GetService<INavigationService>() ?? throw new Exception("NavigationService not registered in DI container.");
|
||||||
@@ -354,7 +355,7 @@ public sealed partial class ShellWindow : WindowEx, IWinoShellWindow,
|
|||||||
|
|
||||||
private void OnAppWindowClosing(object sender, Microsoft.UI.Windowing.AppWindowClosingEventArgs e)
|
private void OnAppWindowClosing(object sender, Microsoft.UI.Windowing.AppWindowClosingEventArgs e)
|
||||||
{
|
{
|
||||||
if ((Application.Current as App)?.IsExiting == true)
|
if (_allowClose || (Application.Current as App)?.IsExiting == true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
@@ -362,10 +363,27 @@ public sealed partial class ShellWindow : WindowEx, IWinoShellWindow,
|
|||||||
windowManager?.HideWindow(this);
|
windowManager?.HideWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PrepareForClose()
|
||||||
|
{
|
||||||
|
if (MainShellFrame.Content is WinoAppShell shellPage)
|
||||||
|
{
|
||||||
|
shellPage.PrepareForWindowClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
_allowClose = true;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnWindowClosed(object sender, WindowEventArgs e)
|
private void OnWindowClosed(object sender, WindowEventArgs e)
|
||||||
{
|
{
|
||||||
|
Closed -= OnWindowClosed;
|
||||||
AppWindow.Closing -= OnAppWindowClosing;
|
AppWindow.Closing -= OnAppWindowClosing;
|
||||||
StatePersistanceService.StatePropertyChanged -= StatePersistenceServiceChanged;
|
StatePersistanceService.StatePropertyChanged -= StatePersistenceServiceChanged;
|
||||||
|
|
||||||
|
if (MainShellFrame.Content is WinoAppShell shellPage)
|
||||||
|
{
|
||||||
|
shellPage.PrepareForWindowClose();
|
||||||
|
}
|
||||||
|
|
||||||
UnregisterRecipients();
|
UnregisterRecipients();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ public sealed class ContactsShellClient(INavigationService navigationService) :
|
|||||||
public void Activate(ShellModeActivationContext activationContext)
|
public void Activate(ShellModeActivationContext activationContext)
|
||||||
{
|
{
|
||||||
OnNavigatedTo(NavigationMode.New, activationContext);
|
OnNavigatedTo(NavigationMode.New, activationContext);
|
||||||
|
|
||||||
|
if (MenuItems?.Count == 0)
|
||||||
|
{
|
||||||
|
MenuItems.Add(_newContactMenuItem);
|
||||||
|
}
|
||||||
|
|
||||||
navigationService.Navigate(WinoPage.ContactsPage, null, NavigationReferenceFrame.InnerShellFrame);
|
navigationService.Navigate(WinoPage.ContactsPage, null, NavigationReferenceFrame.InnerShellFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +48,16 @@ public sealed class ContactsShellClient(INavigationService navigationService) :
|
|||||||
OnNavigatedFrom(NavigationMode.New, null!);
|
OnNavigatedFrom(NavigationMode.New, null!);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PrepareForShellShutdown()
|
||||||
|
{
|
||||||
|
SelectedMenuItem = null;
|
||||||
|
if (MenuItems != null)
|
||||||
|
{
|
||||||
|
MenuItems.Clear();
|
||||||
|
MenuItems.Add(_newContactMenuItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Task HandleNavigationItemInvokedAsync(IMenuItem? menuItem)
|
public Task HandleNavigationItemInvokedAsync(IMenuItem? menuItem)
|
||||||
{
|
{
|
||||||
if (menuItem is NewContactMenuItem)
|
if (menuItem is NewContactMenuItem)
|
||||||
|
|||||||
@@ -57,6 +57,18 @@ public partial class SettingsShellClient(INavigationService navigationService) :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PrepareForShellShutdown()
|
||||||
|
{
|
||||||
|
if (_hasRegisteredPersistentRecipients)
|
||||||
|
{
|
||||||
|
UnregisterRecipients();
|
||||||
|
_hasRegisteredPersistentRecipients = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectedMenuItem = null;
|
||||||
|
MenuItems?.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
public Task HandleNavigationItemInvokedAsync(IMenuItem? menuItem)
|
public Task HandleNavigationItemInvokedAsync(IMenuItem? menuItem)
|
||||||
{
|
{
|
||||||
if (menuItem is not SettingsShellPageMenuItem settingsMenuItem)
|
if (menuItem is not SettingsShellPageMenuItem settingsMenuItem)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -447,7 +447,7 @@
|
|||||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||||
Text="{x:Bind Email}"
|
Text="{x:Bind Email}"
|
||||||
TextTrimming="CharacterEllipsis"
|
TextTrimming="CharacterEllipsis"
|
||||||
Visibility="{x:Bind HasDistinctDisplayName, Mode=OneWay}" />
|
Visibility="{x:Bind HasDistinctDisplayName}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||||
xmlns:reader="using:Wino.Core.Domain.Models.Reader"
|
xmlns:reader="using:Wino.Core.Domain.Models.Reader"
|
||||||
xmlns:toolkitExt="using:CommunityToolkit.WinUI"
|
xmlns:toolkitExt="using:CommunityToolkit.WinUI"
|
||||||
|
xmlns:x509="using:System.Security.Cryptography.X509Certificates"
|
||||||
x:Name="root"
|
x:Name="root"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
@@ -65,18 +66,23 @@
|
|||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Click="SetAliasPrimary_Click"
|
Click="SetAliasPrimary_Click"
|
||||||
CommandParameter="{x:Bind}"
|
CommandParameter="{x:Bind}"
|
||||||
IsChecked="{x:Bind IsPrimary, Mode=OneWay}" />
|
IsChecked="{x:Bind IsPrimary}" />
|
||||||
|
|
||||||
|
|
||||||
<ComboBox
|
<ComboBox
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
DisplayMemberPath="Subject"
|
|
||||||
DropDownClosed="SigningCertificateDropDownClosed"
|
DropDownClosed="SigningCertificateDropDownClosed"
|
||||||
IsEnabled="{x:Bind IsSmimeEncryptionEnabled}"
|
IsEnabled="{x:Bind IsSmimeEncryptionEnabled}"
|
||||||
ItemsSource="{x:Bind Certificates, Mode=OneWay}"
|
ItemsSource="{x:Bind Certificates}"
|
||||||
PlaceholderText="{x:Bind domain:Translator.SettingsSignatureAndEncryption_SigningCertificatePlaceholder}"
|
PlaceholderText="{x:Bind domain:Translator.SettingsSignatureAndEncryption_SigningCertificatePlaceholder}"
|
||||||
SelectedItem="{Binding SelectedSigningCertificate, Mode=TwoWay}" />
|
SelectedItem="{x:Bind SelectedSigningCertificate, Mode=TwoWay}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="x509:X509Certificate2">
|
||||||
|
<TextBlock Text="{x:Bind Subject}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
Grid.Column="4"
|
Grid.Column="4"
|
||||||
|
|||||||
@@ -65,17 +65,17 @@
|
|||||||
<ColumnDefinition Width="120" />
|
<ColumnDefinition Width="120" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Column="1" Text="{x:Bind Subject, Mode=OneWay}" />
|
<TextBlock Grid.Column="1" Text="{x:Bind Subject}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
Foreground="Gray"
|
Foreground="Gray"
|
||||||
Text="{x:Bind NotAfter, Mode=OneWay}" />
|
Text="{x:Bind NotAfter}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
Foreground="Gray"
|
Foreground="Gray"
|
||||||
Text="{x:Bind Thumbprint, Mode=OneWay}" />
|
Text="{x:Bind Thumbprint}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
@@ -146,17 +146,17 @@
|
|||||||
<ColumnDefinition Width="120" />
|
<ColumnDefinition Width="120" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Column="1" Text="{x:Bind Subject, Mode=OneWay}" />
|
<TextBlock Grid.Column="1" Text="{x:Bind Subject}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
Foreground="Gray"
|
Foreground="Gray"
|
||||||
Text="{x:Bind NotAfter, Mode=OneWay}" />
|
Text="{x:Bind NotAfter}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
Foreground="Gray"
|
Foreground="Gray"
|
||||||
Text="{x:Bind Thumbprint, Mode=OneWay}" />
|
Text="{x:Bind Thumbprint}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
|
|||||||
@@ -21,23 +21,23 @@
|
|||||||
</controls:SettingsCard.HeaderIcon>
|
</controls:SettingsCard.HeaderIcon>
|
||||||
<controls:SettingsCard.Header>
|
<controls:SettingsCard.Header>
|
||||||
<StackPanel Spacing="8">
|
<StackPanel Spacing="8">
|
||||||
<TextBlock FontWeight="SemiBold" Text="{x:Bind domain:Translator.GetTranslatedString(NameKey), Mode=OneWay}" />
|
<TextBlock FontWeight="SemiBold" Text="{x:Bind domain:Translator.GetTranslatedString(NameKey)}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||||
Style="{StaticResource BodyTextBlockStyle}"
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
Text="{x:Bind domain:Translator.GetTranslatedString(DescriptionKey), Mode=OneWay}"
|
Text="{x:Bind domain:Translator.GetTranslatedString(DescriptionKey)}"
|
||||||
TextWrapping="WrapWholeWords" />
|
TextWrapping="WrapWholeWords" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||||
Style="{StaticResource CaptionTextBlockStyle}"
|
Style="{StaticResource CaptionTextBlockStyle}"
|
||||||
Text="{x:Bind domain:Translator.GetTranslatedString(KeywordsKey), Mode=OneWay}"
|
Text="{x:Bind domain:Translator.GetTranslatedString(KeywordsKey)}"
|
||||||
TextWrapping="WrapWholeWords" />
|
TextWrapping="WrapWholeWords" />
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Margin="0,4,0,0"
|
Margin="0,4,0,0"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
Spacing="12">
|
Spacing="12">
|
||||||
<Button
|
<Button
|
||||||
Command="{x:Bind PurchaseCommand, Mode=OneWay}"
|
Command="{x:Bind PurchaseCommand}"
|
||||||
CommandParameter="{x:Bind}"
|
CommandParameter="{x:Bind}"
|
||||||
Content="{x:Bind domain:Translator.Buttons_Purchase}"
|
Content="{x:Bind domain:Translator.Buttons_Purchase}"
|
||||||
Style="{StaticResource AccentButtonStyle}" />
|
Style="{StaticResource AccentButtonStyle}" />
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
</controls:SettingsExpander.HeaderIcon>
|
</controls:SettingsExpander.HeaderIcon>
|
||||||
<controls:SettingsExpander.Header>
|
<controls:SettingsExpander.Header>
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
<TextBlock FontWeight="SemiBold" Text="{x:Bind domain:Translator.GetTranslatedString(NameKey), Mode=OneWay}" />
|
<TextBlock FontWeight="SemiBold" Text="{x:Bind domain:Translator.GetTranslatedString(NameKey)}" />
|
||||||
<Border
|
<Border
|
||||||
Padding="8,2"
|
Padding="8,2"
|
||||||
Background="{ThemeResource SystemAccentColor}"
|
Background="{ThemeResource SystemAccentColor}"
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
Text="{x:Bind RenewalText, Mode=OneWay}" />
|
Text="{x:Bind RenewalText, Mode=OneWay}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</controls:SettingsExpander.Description>
|
</controls:SettingsExpander.Description>
|
||||||
<HyperlinkButton Command="{x:Bind ManageCommand, Mode=OneWay}" Content="{x:Bind domain:Translator.Buttons_Manage}" />
|
<HyperlinkButton Command="{x:Bind ManageCommand}" Content="{x:Bind domain:Translator.Buttons_Manage}" />
|
||||||
<controls:SettingsExpander.Items>
|
<controls:SettingsExpander.Items>
|
||||||
<controls:SettingsCard HorizontalContentAlignment="Stretch">
|
<controls:SettingsCard HorizontalContentAlignment="Stretch">
|
||||||
<controls:SettingsCard.Header>
|
<controls:SettingsCard.Header>
|
||||||
@@ -137,16 +137,16 @@
|
|||||||
</controls:SettingsCard.HeaderIcon>
|
</controls:SettingsCard.HeaderIcon>
|
||||||
<controls:SettingsCard.Header>
|
<controls:SettingsCard.Header>
|
||||||
<StackPanel Spacing="8">
|
<StackPanel Spacing="8">
|
||||||
<TextBlock FontWeight="SemiBold" Text="{x:Bind domain:Translator.GetTranslatedString(NameKey), Mode=OneWay}" />
|
<TextBlock FontWeight="SemiBold" Text="{x:Bind domain:Translator.GetTranslatedString(NameKey)}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||||
Style="{StaticResource BodyTextBlockStyle}"
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
Text="{x:Bind domain:Translator.GetTranslatedString(DescriptionKey), Mode=OneWay}"
|
Text="{x:Bind domain:Translator.GetTranslatedString(DescriptionKey)}"
|
||||||
TextWrapping="WrapWholeWords" />
|
TextWrapping="WrapWholeWords" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||||
Style="{StaticResource CaptionTextBlockStyle}"
|
Style="{StaticResource CaptionTextBlockStyle}"
|
||||||
Text="{x:Bind domain:Translator.GetTranslatedString(KeywordsKey), Mode=OneWay}"
|
Text="{x:Bind domain:Translator.GetTranslatedString(KeywordsKey)}"
|
||||||
TextWrapping="WrapWholeWords" />
|
TextWrapping="WrapWholeWords" />
|
||||||
<Border
|
<Border
|
||||||
Padding="12,4"
|
Padding="12,4"
|
||||||
|
|||||||
@@ -23,7 +23,10 @@ using Wino.Core.Domain.Models.Calendar;
|
|||||||
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.Calendar.ViewModels;
|
||||||
|
using Wino.Mail.ViewModels;
|
||||||
using Wino.Mail.ViewModels.Data;
|
using Wino.Mail.ViewModels.Data;
|
||||||
|
using Wino.Mail.WinUI.ViewModels;
|
||||||
using Wino.Mail.WinUI.Controls;
|
using Wino.Mail.WinUI.Controls;
|
||||||
using Wino.MenuFlyouts;
|
using Wino.MenuFlyouts;
|
||||||
using Wino.MenuFlyouts.Context;
|
using Wino.MenuFlyouts.Context;
|
||||||
@@ -49,6 +52,7 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
|
|||||||
private WinoApplicationMode? _activeMode;
|
private WinoApplicationMode? _activeMode;
|
||||||
private bool _isSyncingNavigationViewSelection;
|
private bool _isSyncingNavigationViewSelection;
|
||||||
private bool _isSynchronizingVisibleDateRangeCalendar;
|
private bool _isSynchronizingVisibleDateRangeCalendar;
|
||||||
|
private bool _isPreparedForWindowClose;
|
||||||
|
|
||||||
public WinoAppShell()
|
public WinoAppShell()
|
||||||
{
|
{
|
||||||
@@ -98,10 +102,33 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
|
|||||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnNavigatedFrom(e);
|
base.OnNavigatedFrom(e);
|
||||||
DeactivateCurrentMode();
|
|
||||||
|
if (!_isPreparedForWindowClose)
|
||||||
|
{
|
||||||
|
DeactivateCurrentMode();
|
||||||
|
DetachLifetimeSubscriptions();
|
||||||
|
}
|
||||||
|
|
||||||
Bindings.StopTracking();
|
Bindings.StopTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PrepareForWindowClose()
|
||||||
|
{
|
||||||
|
if (_isPreparedForWindowClose)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_isPreparedForWindowClose = true;
|
||||||
|
|
||||||
|
DeactivateAllShellClients();
|
||||||
|
WeakReferenceMessenger.Default.Unregister<LanguageChanged>(this);
|
||||||
|
UnregisterRecipients();
|
||||||
|
DetachLifetimeSubscriptions();
|
||||||
|
Bindings.StopTracking();
|
||||||
|
|
||||||
|
navigationView.MenuItemsSource = null;
|
||||||
|
CalendarHostListView.ItemsSource = null;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
UpdateNavigationPaneLayout(navigationView.DisplayMode);
|
UpdateNavigationPaneLayout(navigationView.DisplayMode);
|
||||||
@@ -155,6 +182,44 @@ public sealed partial class WinoAppShell : Views.Abstract.WinoAppShellAbstract,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DeactivateAllShellClients()
|
||||||
|
{
|
||||||
|
ViewModel.StatePersistenceService.IsReadingMail = false;
|
||||||
|
ViewModel.StatePersistenceService.IsEventDetailsVisible = false;
|
||||||
|
|
||||||
|
ViewModel.MailClient.Deactivate();
|
||||||
|
ViewModel.CalendarClient.Deactivate();
|
||||||
|
|
||||||
|
if (ViewModel.GetClient(WinoApplicationMode.Contacts) is ContactsShellClient contactsClient)
|
||||||
|
{
|
||||||
|
contactsClient.PrepareForShellShutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ViewModel.GetClient(WinoApplicationMode.Settings) is SettingsShellClient settingsClient)
|
||||||
|
{
|
||||||
|
settingsClient.PrepareForShellShutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ViewModel.MailClient is MailAppShellViewModel mailClient)
|
||||||
|
{
|
||||||
|
mailClient.PrepareForShellShutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ViewModel.CalendarClient is CalendarAppShellViewModel calendarClient)
|
||||||
|
{
|
||||||
|
calendarClient.PrepareForShellShutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DetachLifetimeSubscriptions()
|
||||||
|
{
|
||||||
|
ViewModel.MailClient.PropertyChanged -= MailClientPropertyChanged;
|
||||||
|
ViewModel.CalendarClient.PropertyChanged -= CalendarClientPropertyChanged;
|
||||||
|
ViewModel.PropertyChanged -= ViewModelPropertyChanged;
|
||||||
|
ViewModel.PreferencesService.PreferenceChanged -= PreferencesServiceChanged;
|
||||||
|
ViewModel.StatePersistenceService.StatePropertyChanged -= StatePersistenceServiceChanged;
|
||||||
|
}
|
||||||
|
|
||||||
private void ResetShellModeNavigationState()
|
private void ResetShellModeNavigationState()
|
||||||
{
|
{
|
||||||
InnerShellFrame.BackStack.Clear();
|
InnerShellFrame.BackStack.Clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user