/*
In App.xaml:
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 CommonServiceLocator;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Ioc;
namespace Audit.ViewModel
{
///
/// This class contains static references to all the view models in the
/// application and provides an entry point for the bindings.
///
public class ViewModelLocator
{
///
/// Initializes a new instance of the ViewModelLocator class.
///
public ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
////if (ViewModelBase.IsInDesignModeStatic)
////{
//// // Create design time view services and models
//// SimpleIoc.Default.Register();
////}
////else
////{
//// // Create run time view services and models
//// SimpleIoc.Default.Register();
////}
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
}
///
/// MainViewModel
///
public MainViewModel Main
{
get
{
return ServiceLocator.Current.GetInstance();
}
}
public UserViewModel User
{
get
{
return ServiceLocator.Current.GetInstance();
}
}
///
/// LogViewModel
///
public LogViewModel Login
{
get
{
return ServiceLocator.Current.GetInstance();
}
}
///
/// StatisticsViewModel
///
public StatisticsViewModel Statistics
{
get
{
return ServiceLocator.Current.GetInstance();
}
}
///
/// QueryViewModel
///
public QueryViewModel Query
{
get
{
return ServiceLocator.Current.GetInstance();
}
}
///
/// QueryViewModel
///
public StuffViewModel Stuff
{
get
{
return ServiceLocator.Current.GetInstance();
}
}
///
///
///
public MachinesViewModel Machines
{
get
{
return ServiceLocator.Current.GetInstance();
}
}
///
///
///
public PipesViewModel Pipes
{
get
{
return ServiceLocator.Current.GetInstance();
}
}
///
/// Cleanup
///
public static void Cleanup()
{
// TODO Clear the ViewModels
}
}
}