添加项目文件。
This commit is contained in:
480
GroupLine.App/ViewModel/ViewModelLocator.cs
Normal file
480
GroupLine.App/ViewModel/ViewModelLocator.cs
Normal file
@@ -0,0 +1,480 @@
|
||||
/*
|
||||
In App.xaml:
|
||||
<Application.Resources>
|
||||
<vm:ViewModelLocator xmlns:vm="clr-namespace:GroupLine.App"
|
||||
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 CommonServiceLocator;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using GroupLine.App.ViewModel;
|
||||
using GroupLine.Model;
|
||||
using YC5.App.ViewModel;
|
||||
|
||||
namespace GroupLine.App.ViewModel
|
||||
{
|
||||
/// <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
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ViewModelLocator class.
|
||||
/// </summary>
|
||||
public ViewModelLocator()
|
||||
{
|
||||
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
|
||||
SimpleIoc.Default.Register<AppearanceTestViewModel>();
|
||||
|
||||
SimpleIoc.Default.Register<KanBanViewModel>();
|
||||
SimpleIoc.Default.Register<OffsetConfigViewModel>();
|
||||
|
||||
|
||||
SimpleIoc.Default.Register<MagTorqueViewModel>();
|
||||
SimpleIoc.Default.Register<OilPumpInstallViewModel>();
|
||||
SimpleIoc.Default.Register<DbDataClearViewModel>();
|
||||
|
||||
|
||||
SimpleIoc.Default.Register<CylinderEngravViewModel>();
|
||||
SimpleIoc.Default.Register<TermWeldViewModel>();
|
||||
SimpleIoc.Default.Register<GCylinderBurnEbViewModel>();
|
||||
SimpleIoc.Default.Register<GRotorBurnEbViewModel>();
|
||||
SimpleIoc.Default.Register<GRotorMagViewModel>();
|
||||
SimpleIoc.Default.Register<GInsRotaResViewModel>();
|
||||
SimpleIoc.Default.Register<PRacktPressViewModel>();
|
||||
SimpleIoc.Default.Register<PRacktWeldViewModel>();
|
||||
SimpleIoc.Default.Register<PLowWeldViewModel>();
|
||||
SimpleIoc.Default.Register<PCoreMesViewModel>();
|
||||
SimpleIoc.Default.Register<GMagTorqueViewModel>();
|
||||
SimpleIoc.Default.Register<KPMagTorqueViewModel>();
|
||||
SimpleIoc.Default.Register<GOilPumpInstallViewModel>();
|
||||
SimpleIoc.Default.Register<KPOilPumpInstallViewModel>();
|
||||
SimpleIoc.Default.Register<GCDTransplantViewModel>();
|
||||
SimpleIoc.Default.Register<KPCDTransplantViewModel>();
|
||||
SimpleIoc.Default.Register<GLeakCheckViewModel>();
|
||||
SimpleIoc.Default.Register<KPLeakCheckViewModel>();
|
||||
SimpleIoc.Default.Register<KPSealInstallViewModel>();
|
||||
SimpleIoc.Default.Register<ExhInstallMesViewModel>();
|
||||
SimpleIoc.Default.Register<BurPlugInstallViewModel>();
|
||||
SimpleIoc.Default.Register<OverflowLeakMesViewModel>();
|
||||
SimpleIoc.Default.Register<StaticDiscPressViewModel>();
|
||||
SimpleIoc.Default.Register<GDynStaticMachViewModel>();
|
||||
SimpleIoc.Default.Register<KPDynStaticMachViewModel>();
|
||||
SimpleIoc.Default.Register<GLowVolStartViewModel>();
|
||||
SimpleIoc.Default.Register<KPLowVolStartViewModel>();
|
||||
SimpleIoc.Default.Register<GSpotWeldMachViewModel>();
|
||||
SimpleIoc.Default.Register<KPSpotWeldMachViewModel>();
|
||||
SimpleIoc.Default.Register<GRingWeldMachViewModel>();
|
||||
SimpleIoc.Default.Register<KPRingWeldMachViewModel>();
|
||||
SimpleIoc.Default.Register<GShrinkTubViewModel>();
|
||||
SimpleIoc.Default.Register<GStaticDiskMachViewModel>();
|
||||
SimpleIoc.Default.Register<KPStaticDiskMachViewModel>();
|
||||
SimpleIoc.Default.Register<KPUpBurnEbViewModel>();
|
||||
|
||||
SimpleIoc.Default.Register<KPRingWeldMachDwViewModel>();
|
||||
SimpleIoc.Default.Register<KPRingWeldMachUpViewModel>();
|
||||
SimpleIoc.Default.Register<KPShrinkTubViewModel>();
|
||||
|
||||
|
||||
////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<MainViewModel>();
|
||||
|
||||
|
||||
|
||||
SimpleIoc.Default.Register<ReportTimeConfigViewModel>();
|
||||
|
||||
}
|
||||
|
||||
public MainViewModel Main
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<MainViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public ReportTimeConfigViewModel ReportTimeConfig
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<ReportTimeConfigViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public AppearanceTestViewModel AppearanceTest
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<AppearanceTestViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public OffsetConfigViewModel OffsetConfig
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<OffsetConfigViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public KanBanViewModel KanBan
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KanBanViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public MagTorqueViewModel MagTorque
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<MagTorqueViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public OilPumpInstallViewModel OilPumpInstall
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<OilPumpInstallViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public DbDataClearViewModel DbDataClear
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<DbDataClearViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public CylinderEngravViewModel CylinderEngrav
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<CylinderEngravViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public TermWeldViewModel TermWeld
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<TermWeldViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GCylinderBurnEbViewModel GCylinderBurnEb
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GCylinderBurnEbViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GRotorBurnEbViewModel GRotorBurnEb
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GRotorBurnEbViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GRotorMagViewModel GRotorMag
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GRotorMagViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GInsRotaResViewModel GInsRotaRes
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GInsRotaResViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public PRacktPressViewModel PRacktPress
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<PRacktPressViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public PRacktWeldViewModel PRacktWeld
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<PRacktWeldViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public PLowWeldViewModel PLowWeld
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<PLowWeldViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public PCoreMesViewModel PCoreMes
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<PCoreMesViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GMagTorqueViewModel GMagTorque
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GMagTorqueViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public KPMagTorqueViewModel KPMagTorque
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPMagTorqueViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GOilPumpInstallViewModel GOilPumpInstall
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GOilPumpInstallViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public KPOilPumpInstallViewModel KPOilPumpInstall
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPOilPumpInstallViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GCDTransplantViewModel GCDTransplant
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GCDTransplantViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public KPCDTransplantViewModel KPCDTransplant
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPCDTransplantViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GLeakCheckViewModel GLeakCheck
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GLeakCheckViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public KPLeakCheckViewModel KPLeakCheck
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPLeakCheckViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public KPSealInstallViewModel KPSealInstall
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPSealInstallViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public ExhInstallMesViewModel ExhInstallMes
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<ExhInstallMesViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public BurPlugInstallViewModel BurPlugInstall
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<BurPlugInstallViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public OverflowLeakMesViewModel OverflowLeakMes
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<OverflowLeakMesViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public StaticDiscPressViewModel StaticDiscPress
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<StaticDiscPressViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GDynStaticMachViewModel GDynStaticMach
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GDynStaticMachViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public KPDynStaticMachViewModel KPDynStaticMach
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPDynStaticMachViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GLowVolStartViewModel GLowVolStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GLowVolStartViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public KPLowVolStartViewModel KPLowVolStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPLowVolStartViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GSpotWeldMachViewModel GSpotWeldMach
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GSpotWeldMachViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public KPSpotWeldMachViewModel KPSpotWeldMach
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPSpotWeldMachViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GRingWeldMachViewModel GRingWeldMach
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GRingWeldMachViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public KPRingWeldMachViewModel KPRingWeldMach
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPRingWeldMachViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GShrinkTubViewModel GShrinkTub
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GShrinkTubViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public GStaticDiskMachViewModel GStaticDiskMach
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<GStaticDiskMachViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public KPStaticDiskMachViewModel KPStaticDiskMach
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPStaticDiskMachViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public KPUpBurnEbViewModel KPUpBurnEb
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPUpBurnEbViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public KPRingWeldMachDwViewModel KPRingWeldMachDw
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPRingWeldMachDwViewModel>();
|
||||
}
|
||||
}
|
||||
public KPRingWeldMachUpViewModel KPRingWeldMachUp
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPRingWeldMachUpViewModel>();
|
||||
}
|
||||
}
|
||||
public KPShrinkTubViewModel KPShrinkTub
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<KPShrinkTubViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Cleanup()
|
||||
{
|
||||
// TODO Clear the ViewModels
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user