You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.0 KiB
81 lines
2.0 KiB
using Microsoft.Extensions.DependencyInjection;
|
|
using System;
|
|
|
|
namespace BBWY.Client.ViewModels
|
|
{
|
|
public class ViewModelLocator
|
|
{
|
|
private IServiceProvider sp;
|
|
|
|
public ViewModelLocator()
|
|
{
|
|
sp = (App.Current as App).ServiceProvider;
|
|
}
|
|
|
|
public MainViewModel Main
|
|
{
|
|
get
|
|
{
|
|
using (var s = sp.CreateScope())
|
|
{
|
|
return s.ServiceProvider.GetRequiredService<MainViewModel>();
|
|
}
|
|
}
|
|
}
|
|
|
|
public WareManagerViewModel WareManager
|
|
{
|
|
get
|
|
{
|
|
using (var s = sp.CreateScope())
|
|
{
|
|
return s.ServiceProvider.GetRequiredService<WareManagerViewModel>();
|
|
}
|
|
}
|
|
}
|
|
|
|
public WareStockViewModel WareStock
|
|
{
|
|
get
|
|
{
|
|
using (var s = sp.CreateScope())
|
|
{
|
|
return s.ServiceProvider.GetRequiredService<WareStockViewModel>();
|
|
}
|
|
}
|
|
}
|
|
|
|
public BindingPurchaseProductViewModel BindingPurchaseProduct
|
|
{
|
|
get
|
|
{
|
|
using (var s = sp.CreateScope())
|
|
{
|
|
return s.ServiceProvider.GetRequiredService<BindingPurchaseProductViewModel>();
|
|
}
|
|
}
|
|
}
|
|
|
|
public OrderListViewModel OrderList
|
|
{
|
|
get
|
|
{
|
|
using (var s = sp.CreateScope())
|
|
{
|
|
return s.ServiceProvider.GetRequiredService<OrderListViewModel>();
|
|
}
|
|
}
|
|
}
|
|
|
|
public ChoosePurchaseSchemeViewModel ChoosePurchaseScheme
|
|
{
|
|
get
|
|
{
|
|
using (var s = sp.CreateScope())
|
|
{
|
|
return s.ServiceProvider.GetRequiredService<ChoosePurchaseSchemeViewModel>();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|