mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
WIP Windows 10
Dependencies finally installed Removal of useless code Big cleanup in XAML styles (override colors the correct way)
This commit is contained in:
48
Win10App/ViewModels/ViewModelLocator.cs
Normal file
48
Win10App/ViewModels/ViewModelLocator.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
In App.xaml:
|
||||
<Application.Resources>
|
||||
<vm:ViewModelLocator xmlns:vm="clr-namespace:ModernKeePass"
|
||||
x:Key="Locator" />
|
||||
</Application.Resources>
|
||||
|
||||
In the View:
|
||||
DataContext="{Binding Source={StaticResource Locator}, Path=ViewModelName}"
|
||||
|
||||
You can also use Blend to do all this with the tool's support.
|
||||
See http://www.galasoft.ch/mvvm
|
||||
*/
|
||||
|
||||
using System;
|
||||
using CommonServiceLocator;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using ModernKeePass.ViewModels.ListItems;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains static references to all the view models in the
|
||||
/// application and provides an entry point for the bindings.
|
||||
/// </summary>
|
||||
public class ViewModelLocator : ViewModelLocatorCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ViewModelLocator class.
|
||||
/// </summary>
|
||||
public ViewModelLocator()
|
||||
{
|
||||
SimpleIoc.Default.Register<SettingsVm>();
|
||||
SimpleIoc.Default.Register<MainVm>();
|
||||
SimpleIoc.Default.Register<GroupsVm>();
|
||||
SimpleIoc.Default.Register<EntriesVm>();
|
||||
SimpleIoc.Default.Register<GroupItemVm>();
|
||||
SimpleIoc.Default.Register<EntryItemVm>();
|
||||
}
|
||||
|
||||
public MainVm Main => ServiceLocator.Current.GetInstance<MainVm>(Guid.NewGuid().ToString());
|
||||
public SettingsVm Settings => ServiceLocator.Current.GetInstance<SettingsVm>(Guid.NewGuid().ToString());
|
||||
public GroupsVm Groups => ServiceLocator.Current.GetInstance<GroupsVm>(Guid.NewGuid().ToString());
|
||||
public EntriesVm Entries => ServiceLocator.Current.GetInstance<EntriesVm>(Guid.NewGuid().ToString());
|
||||
public GroupItemVm GroupItem => ServiceLocator.Current.GetInstance<GroupItemVm>(Guid.NewGuid().ToString());
|
||||
public EntryItemVm EntryItem => ServiceLocator.Current.GetInstance<EntryItemVm>(Guid.NewGuid().ToString());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user