| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- //----------------------------------------------------------------
- //Module Name: $safeprojectname$
- //Purpose:
- //CopyRight: Muchinfo
- //History:
- //----------------------------------------------------------------
- //DateTime 2016/4/14 15:53:02
- //Author
- //Description Create
- //----------------------------------------------------------------
- using System.Windows;
- using System.Windows.Input;
- using GalaSoft.MvvmLight.Command;
- using GalaSoft.MvvmLight.Messaging;
- using Muchinfo.MTPClient.Bank.Views;
- using Muchinfo.MTPClient.Data;
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Infrastructure.Helpers;
- using Muchinfo.MTPClient.IService;
- namespace Muchinfo.MTPClient.Bank.ViewModels
- {
- public class BankMenuService : IModuleMenuService
- {
- public Dictionary<Data.Enums.MenuCommandType, Data.SysMenuItem> GetModuleMenuItems()
- {
- var sysMenu = new Dictionary<MenuCommandType, SysMenuItem>();
- //消息中心
- sysMenu.Add(MenuCommandType.BreakSign, new SysMenuItem(MenuCommandType.BreakSign));
- //sysMenu.Add(MenuCommandType.Notice,
- // new SysMenuItem(MenuCommandType.Notice) { Command = MenuCommand, View = new AmountManagerView(), IsDialog = true });
- sysMenu.Add(MenuCommandType.BankSign,
- new SysMenuItem(MenuCommandType.BankSign) { Command = MenuCommand, ViewType = typeof(BankSignQueryView),});
- sysMenu.Add(MenuCommandType.AmountQuety,
- new SysMenuItem(MenuCommandType.AmountQuety) { Command = MenuCommand, ViewType = typeof(AmountQuetyView), });
- //sysMenu.Add(MenuCommandType.BankBreak,
- // new SysMenuItem(MenuCommandType.BankBreak) { Command = MenuCommand, ViewType = typeof(BankTerminationView), IsDialog = true });
- sysMenu.Add(MenuCommandType.BankUpdate,
- new SysMenuItem(MenuCommandType.BankUpdate) { Command = MenuCommand, ViewType = typeof(BankUpdateView), IsDialog = true });
- sysMenu.Add(MenuCommandType.Apply, new SysMenuItem(MenuCommandType.Apply));
- // sysMenu.Add(MenuCommandType.AmountInApply,
- //new SysMenuItem(MenuCommandType.AmountInApply) { Command = MenuCommand, ViewType = typeof(AmountManagerView), Params = new List<object>() { FundsApplyType.Deposit }, IsDialog = true });
- // sysMenu.Add(MenuCommandType.AmountOutApply,
- // new SysMenuItem(MenuCommandType.AmountOutApply) { Command = MenuCommand, ViewType = typeof (AmountManagerView),Params=new List<object>() { FundsApplyType.Withdraw }, IsDialog = true });
- // sysMenu.Add(MenuCommandType.Apply,
-
- 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;
-
- 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.WindowStartupLocation = WindowStartupLocation.CenterOwner;
- view.Owner = Application.Current.MainWindow;
- view.ShowInTaskbar = false;
- view.ShowDialog();
- }
- }
- });
- }
- return _menuCommand;
- }
- }
- }
- }
|