mirror of
https://github.com/jie65535/Helpers.git
synced 2025-12-15 19:02:41 +08:00
Add MvvmLight Template
This commit is contained in:
21
MvvmLightDemo/ViewModel/ViewModelLocator.cs
Normal file
21
MvvmLightDemo/ViewModel/ViewModelLocator.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using CommonServiceLocator;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
|
||||
namespace MvvmLightDemo.ViewModel
|
||||
{
|
||||
public class ViewModelLocator
|
||||
{
|
||||
public ViewModelLocator()
|
||||
{
|
||||
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
|
||||
SimpleIoc.Default.Register<MainViewModel>();
|
||||
}
|
||||
|
||||
public MainViewModel Main => ServiceLocator.Current.GetInstance<MainViewModel>();
|
||||
|
||||
public static void Cleanup()
|
||||
{
|
||||
// TODO Clear the ViewModels
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user