mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
New boolean to visibility converter Base class to handle property changes notifications for all View Models Template selector to handle a different first item in listviews or gridviews
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using Windows.UI.Xaml;
|
|
using Windows.UI.Xaml.Controls;
|
|
using Windows.UI.Xaml.Navigation;
|
|
using ModernKeePass.ViewModels;
|
|
|
|
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
|
|
|
namespace ModernKeePass.Pages
|
|
{
|
|
/// <summary>
|
|
/// An empty page that can be used on its own or navigated to within a Frame.
|
|
/// </summary>
|
|
public sealed partial class SaveDatabasePage : Page
|
|
{
|
|
private Frame _mainFrame;
|
|
public SaveDatabasePage()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
protected override void OnNavigatedTo(NavigationEventArgs e)
|
|
{
|
|
base.OnNavigatedTo(e);
|
|
_mainFrame = e.Parameter as Frame;
|
|
var app = (App)Application.Current;
|
|
if (app.Database == null) return;
|
|
var databaseVm = DataContext as DatabaseVm;
|
|
if (databaseVm == null) return;
|
|
UpdateDatabaseStatus(app, databaseVm);
|
|
}
|
|
|
|
private void SaveButton_OnClick(object sender, RoutedEventArgs e)
|
|
{
|
|
var app = (App) Application.Current;
|
|
app.Database.Save();
|
|
app.Database.Close();
|
|
UpdateDatabaseStatus(app, DataContext as DatabaseVm);
|
|
_mainFrame.Navigate(typeof(MainPage));
|
|
}
|
|
|
|
private void UpdateDatabaseStatus(App app, DatabaseVm databaseVm)
|
|
{
|
|
databaseVm.IsOpen = app.Database.IsOpen;
|
|
}
|
|
}
|
|
}
|