mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Unregister the messenger everywhere on unload/navigate from
This commit is contained in:
@@ -18,16 +18,10 @@ namespace ModernKeePass.Views
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
Unloaded += MainPage_Unloaded;
|
||||
ListView = MenuListView;
|
||||
ListViewSource = MenuItemsSource;
|
||||
}
|
||||
|
||||
private void MainPage_Unloaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
Model.Cleanup();
|
||||
}
|
||||
|
||||
|
||||
private new void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
base.ListView_SelectionChanged(sender, e);
|
||||
@@ -47,5 +41,10 @@ namespace ModernKeePass.Views
|
||||
file = e.Parameter as FileInfo;
|
||||
await Model.Initialize(Frame, MenuFrame, file);
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
Model.Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,8 @@
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using ModernKeePass.ViewModels;
|
||||
|
||||
namespace ModernKeePass.Views
|
||||
{
|
||||
/// <summary>
|
||||
@@ -7,9 +10,16 @@ namespace ModernKeePass.Views
|
||||
/// </summary>
|
||||
public sealed partial class NewDatabasePage
|
||||
{
|
||||
public NewVm Model => (NewVm)DataContext;
|
||||
|
||||
public NewDatabasePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
Model.Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,8 @@
|
||||
// Pour en savoir plus sur le modèle d'élément Page vierge, consultez la page http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using ModernKeePass.ViewModels;
|
||||
|
||||
namespace ModernKeePass.Views
|
||||
{
|
||||
/// <summary>
|
||||
@@ -7,9 +10,16 @@ namespace ModernKeePass.Views
|
||||
/// </summary>
|
||||
public sealed partial class RecentDatabasesPage
|
||||
{
|
||||
public RecentVm Model => (RecentVm)DataContext;
|
||||
|
||||
public RecentDatabasesPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
Model.Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,8 @@
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using ModernKeePass.ViewModels;
|
||||
|
||||
namespace ModernKeePass.Views
|
||||
{
|
||||
/// <summary>
|
||||
@@ -7,9 +10,16 @@ namespace ModernKeePass.Views
|
||||
/// </summary>
|
||||
public sealed partial class SaveDatabasePage
|
||||
{
|
||||
public SaveVm Model => (SaveVm)DataContext;
|
||||
|
||||
public SaveDatabasePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
Model.Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:converters="using:ModernKeePass.Converters"
|
||||
mc:Ignorable="d" >
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<converters:EmptyStringToVisibilityConverter x:Key="EmptyStringToVisibilityConverter"/>
|
||||
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
@@ -85,6 +85,9 @@
|
||||
<core:DataTriggerBehavior Binding="{Binding IsError}" Value="False">
|
||||
<core:GoToStateAction StateName="Initial"/>
|
||||
</core:DataTriggerBehavior>
|
||||
<core:EventTriggerBehavior EventName="Unloaded">
|
||||
<core:CallMethodAction TargetObject="{Binding}" MethodName="Cleanup"/>
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
@@ -133,6 +133,9 @@
|
||||
<core:DataTriggerBehavior Binding="{Binding IsKeyFileValid}" Value="True">
|
||||
<core:GoToStateAction StateName="KeyFileValid"/>
|
||||
</core:DataTriggerBehavior>
|
||||
<core:EventTriggerBehavior EventName="Unloaded">
|
||||
<core:CallMethodAction TargetObject="{Binding}" MethodName="Cleanup"/>
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
Reference in New Issue
Block a user