步步为盈
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.

251 lines
6.6 KiB

using BBWY.Client.ViewModels.PackTask;
using GalaSoft.MvvmLight.Ioc;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Windows.Navigation;
using static System.Formats.Asn1.AsnWriter;
namespace BBWY.Client.ViewModels
{
public class ViewModelLocator
{
private IServiceProvider sp;
public bool IsCreateWareManager { get; private set; }
public bool IsCreateWareStock { get; private set; }
public bool IsCreateOrderList { get; private set; }
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
{
IsCreateWareManager = true;
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<WareManagerViewModel>();
}
}
}
public WareStockViewModel WareStock
{
get
{
IsCreateWareStock = true;
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
{
IsCreateOrderList = true;
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<OrderListViewModel>();
}
}
}
public ServiceOrderViewModel ServiceOrderList
{
get
{
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<ServiceOrderViewModel>();
}
}
}
public ConsumableViewModel Consumable
{
get
{
//IsCreateOrderList = true;
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<ConsumableViewModel>();
}
}
}
public TaskListViewModel TaskList
{
get
{
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<TaskListViewModel>();
}
}
}
public WareHouseListViewModel WareHouseList
{
get
{
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<WareHouseListViewModel>();
}
}
}
public PackServiceViewModel PackServiceList
{
get
{
//IsCreateOrderList = true;
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<PackServiceViewModel>();
}
}
}
public TipsViewModel TipsView
{
get
{
//IsCreateOrderList = true;
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<TipsViewModel>();
}
}
}
public SetBarCodeViewModel CreateSetBarCodeView
{
get
{
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<SetBarCodeViewModel>();
}
}
}
public CreatePackTaskViewModel CreateTaskView
{
get
{
using (var s = sp.CreateScope())
{
var viewModel = s.ServiceProvider.GetRequiredService<CreatePackTaskViewModel>();
//bool areSame = object.ReferenceEquals(viewModel, sp.GetRequiredService<CreatePackTaskViewModel>());
return viewModel;
}
}
}
public ChoosePurchaseSchemeViewModel ChoosePurchaseScheme
{
get
{
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<ChoosePurchaseSchemeViewModel>();
}
}
}
public _1688PreviewPurchaseViewModel _1688PreviewPurchase
{
get
{
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<_1688PreviewPurchaseViewModel>();
}
}
}
public ShopSettingViewModel ShopSetting
{
get
{
using var s = sp.CreateScope();
return s.ServiceProvider.GetRequiredService<ShopSettingViewModel>();
}
}
public ProcurementAuditViewModel ProcurementAudit
{
get
{
using var s = sp.CreateScope();
return s.ServiceProvider.GetRequiredService<ProcurementAuditViewModel>();
}
}
public BillCorrectionViewModel BillCorrection
{
get
{
using var s = sp.CreateScope();
return s.ServiceProvider.GetRequiredService<BillCorrectionViewModel>();
}
}
public EditServiceOrderViewModel EditServiceOrder
{
get
{
using var s = sp.CreateScope();
return s.ServiceProvider.GetRequiredService<EditServiceOrderViewModel>();
}
}
public BatchPurchaseOrderListViewModel BatchPurchaseOrderListVM
{
get
{
using var s = sp.CreateScope();
return s.ServiceProvider.GetRequiredService<BatchPurchaseOrderListViewModel>();
}
}
}
}