| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.Design;
- using System.Linq;
- using System.Text;
- //----------------------------------------------------------------
- //Module Name: $safeprojectname$
- //Purpose:
- //CopyRight: Muchinfo
- //History:
- //----------------------------------------------------------------
- //DateTime 2016/4/19 17:09:50
- //Author
- //Description Create
- //----------------------------------------------------------------
- using System.Windows;
- using System.Windows.Input;
- using GalaSoft.MvvmLight.Command;
- using GalaSoft.MvvmLight.Ioc;
- using GalaSoft.MvvmLight.Messaging;
- using Muchinfo.MTPClient.Data;
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Infrastructure.Cache;
- using Muchinfo.MTPClient.Infrastructure.Helpers;
- using Muchinfo.MTPClient.IService;
- using Muchinfo.MTPClient.Sale.ViewModels;
- using Muchinfo.MTPClient.Sale.Views;
- namespace Muchinfo.MTPClient.Sale.Utilities
- {
- public class SaleMenuService:IModuleMenuService
- {
- public Dictionary<Data.Enums.MenuCommandType, Data.SysMenuItem> GetModuleMenuItems()
- {
- var sysMenu = new Dictionary<MenuCommandType, SysMenuItem>();
- //sysMenu.Add(MenuCommandType.SaleOrder, new SysMenuItem(MenuCommandType.SaleOrder));
- // sysMenu.Add(MenuCommandType.AccountInfo,
- // new SysMenuItem(MenuCommandType.AccountInfo) { Command = MenuCommand, View = new QueryDealPurchaseView()});
- //sysMenu.Add(MenuCommandType.SaleApply, new SysMenuItem(MenuCommandType.SaleApply) { Command = SimpleIoc.Default.GetInstance<QuerySaleGoodsViewModel>().DetailCommand } );
- sysMenu.Add(MenuCommandType.Distribute,
- new SysMenuItem(MenuCommandType.Distribute) { Command = MenuCommand, ViewType = typeof(DistributeBallotView) });
- var showQuery = CacheManager.CacheMarketsGroups != null && CacheManager.CacheMarketsGroups.Any((goodsGroups) => goodsGroups.TradeMode == eTradeMode.TRADEMODE_SALE);
- if (showQuery) ////没有发售市场不显示
- {
- sysMenu.Add(MenuCommandType.DepositQuery,
- new SysMenuItem(MenuCommandType.DepositQuery)
- {
- Command = MenuCommand,
- ViewType = typeof (QueryDepositAppView)
- });
- }
- return sysMenu;
- }
- private ICommand _menuCommand;
- /// <summary>
- /// 菜单操作
- /// </summary>
- public ICommand MenuCommand
- {
- get
- {
- if (_menuCommand == null)
- {
- _menuCommand = new RelayCommand<SysMenuItem>((item) =>
- {
- if (!item.IsDialog)
- {
- var type = item.ViewType;
- var assembly = System.Reflection.Assembly.GetAssembly(type);
- var view = assembly.CreateInstance(type.FullName, false, System.Reflection.BindingFlags.CreateInstance, null, item.Params == null ? null : item.Params.ToArray(), null, null) as FrameworkElement;
- if (view != null)
- {
- MessengerHelper.DefaultSend(view, MessengerTokens.ShowQueryContet);
- }
- }
- else
- {
- var type = item.ViewType;
- if (type == null) return;
- var assembly = System.Reflection.Assembly.GetAssembly(type);
- var view = assembly.CreateInstance(type.FullName, false, System.Reflection.BindingFlags.CreateInstance, null, item.Params == null ? null : item.Params.ToArray(), null, null) as Window;
- if (view != null)
- {
- view.ShowDialog();
- }
- }
- });
- }
- return _menuCommand;
- }
- }
-
- }
- }
|