|
|
|
|
using CommonServiceLocator;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using GalaSoft.MvvmLight;
|
|
|
|
|
using GalaSoft.MvvmLight.Ioc;
|
|
|
|
|
|
|
|
|
|
namespace formula_manage.ViewModel
|
|
|
|
|
{
|
|
|
|
|
public class ViewModelLocator
|
|
|
|
|
{
|
|
|
|
|
public ViewModelLocator()
|
|
|
|
|
{
|
|
|
|
|
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
|
|
|
|
|
|
|
|
|
|
////if (ViewModelBase.IsInDesignModeStatic)
|
|
|
|
|
////{
|
|
|
|
|
//// // Create design time view services and models
|
|
|
|
|
//// SimpleIoc.Default.Register<IDataService, DesignDataService>();
|
|
|
|
|
////}
|
|
|
|
|
////else
|
|
|
|
|
////{
|
|
|
|
|
//// // Create run time view services and models
|
|
|
|
|
//// SimpleIoc.Default.Register<IDataService, DataService>();
|
|
|
|
|
////}
|
|
|
|
|
|
|
|
|
|
SimpleIoc.Default.Register<MainWindowViewModel>();
|
|
|
|
|
SimpleIoc.Default.Register<RECIPEViewModel>();
|
|
|
|
|
SimpleIoc.Default.Register<ExchangeViewModel>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MainWindowViewModel Main
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return ServiceLocator.Current.GetInstance<MainWindowViewModel>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public RECIPEViewModel Recipev
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return ServiceLocator.Current.GetInstance<RECIPEViewModel>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ExchangeViewModel Exchange
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return ServiceLocator.Current.GetInstance<ExchangeViewModel>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|