Main page now uses Frame to change views when selecting items

Backgrounds unified
Menu items can be disabled thanks to custom ListView control
This commit is contained in:
2017-09-27 18:01:21 +02:00
committed by BONNEVILLE Geoffroy
parent 3a045dbb16
commit caaf34918e
19 changed files with 319 additions and 138 deletions

View File

@@ -0,0 +1,39 @@
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
{
public SaveDatabasePage()
{
this.InitializeComponent();
DataContext = new DatabaseVm();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
var app = (App)Application.Current;
if (app.Database == null) return;
var databaseVm = DataContext as DatabaseVm;
if (databaseVm == null) return;
databaseVm.IsOpen = app.Database.IsOpen;
databaseVm.NotifyPropertyChanged("IsOpen");
}
private void SaveButton_OnClick(object sender, RoutedEventArgs e)
{
var app = (App) Application.Current;
app.Database.Save();
app.Database.Close();
}
}
}