mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Main sub pages also changed to better work with Main (but needs improvement) Added a Settings Page stub
57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
using System;
|
|
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 MainPage
|
|
{
|
|
public new MainVm Model => (MainVm)DataContext;
|
|
|
|
public MainPage()
|
|
{
|
|
InitializeComponent();
|
|
ListView = MenuListView;
|
|
ListViewSource = MenuItemsSource;
|
|
}
|
|
|
|
private void MenuListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
ListView_SelectionChanged(sender, e);
|
|
var selectedItem = Model.SelectedItem as MainMenuItemVm;
|
|
selectedItem?.Destination.Navigate(selectedItem.PageType, selectedItem.Parameter);
|
|
}
|
|
|
|
#region NavigationHelper registration
|
|
|
|
/// The methods provided in this section are simply used to allow
|
|
/// NavigationHelper to respond to the page's navigation methods.
|
|
///
|
|
/// Page specific logic should be placed in event handlers for the
|
|
/// <see cref="Common.NavigationHelper.LoadState"/>
|
|
/// and <see cref="Common.NavigationHelper.SaveState"/>.
|
|
/// The navigation parameter is available in the LoadState method
|
|
/// in addition to page state preserved during an earlier session.
|
|
|
|
protected override void OnNavigatedTo(NavigationEventArgs e)
|
|
{
|
|
NavigationHelper.OnNavigatedTo(e);
|
|
DataContext = new MainVm(Frame, MenuFrame);
|
|
if (Model.SelectedItem == null) MenuFrame.Navigate(typeof(WelcomePage));
|
|
}
|
|
|
|
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
|
{
|
|
NavigationHelper.OnNavigatedFrom(e);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|