mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
All VMs use viewmodellocator
This commit is contained in:
@@ -7,7 +7,6 @@ using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using GalaSoft.MvvmLight.Views;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Application.Entry.Models;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Models;
|
||||
@@ -23,26 +22,27 @@ namespace ModernKeePass.Views
|
||||
/// </summary>
|
||||
public sealed partial class GroupDetailPage
|
||||
{
|
||||
private readonly IResourceProxy _resource;
|
||||
private readonly INavigationService _navigation;
|
||||
|
||||
public GroupDetailVm Model => (GroupDetailVm)DataContext;
|
||||
|
||||
public GroupDetailPage(): this (App.Services.GetRequiredService<IResourceProxy>(), App.Services.GetRequiredService<INavigationService>()) { }
|
||||
public GroupDetailPage(IResourceProxy resource, INavigationService navigation)
|
||||
public GroupDetailPage(): this (App.Services.GetRequiredService<INavigationService>()) { }
|
||||
public GroupDetailPage(INavigationService navigation)
|
||||
{
|
||||
InitializeComponent();
|
||||
_resource = resource;
|
||||
_navigation = navigation;
|
||||
}
|
||||
|
||||
#region NavigationHelper registration
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
protected override async void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
var navigationItem = e.Parameter as NavigationItem;
|
||||
if (navigationItem != null)
|
||||
DataContext = new GroupDetailVm(navigationItem.Id) { IsEditMode = navigationItem.IsNew };
|
||||
{
|
||||
await Model.Initialize(navigationItem.Id);
|
||||
Model.IsEditMode = navigationItem.IsNew;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Reference in New Issue
Block a user