| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043 |
- using GalaSoft.MvvmLight;
- using GalaSoft.MvvmLight.Command;
- using GalaSoft.MvvmLight.Ioc;
- using Muchinfo.MTPClient.Account.ViewModels;
- using Muchinfo.MTPClient.Account.ViewModels.AllOrderViewModel;
- using Muchinfo.MTPClient.Account.Views;
- using Muchinfo.MTPClient.CustomException;
- using Muchinfo.MTPClient.Data;
- using Muchinfo.MTPClient.Data.DTO;
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Data.Model;
- using Muchinfo.MTPClient.Data.Model.Account;
- using Muchinfo.MTPClient.Data.Model.GoodRules;
- using Muchinfo.MTPClient.Data.Model.Message;
- using Muchinfo.MTPClient.Infrastructure.Cache;
- using Muchinfo.MTPClient.Infrastructure.Helpers;
- using Muchinfo.MTPClient.Infrastructure.LinkProxy;
- using Muchinfo.MTPClient.Infrastructure.MessageBox;
- using Muchinfo.MTPClient.Infrastructure.Users;
- using Muchinfo.MTPClient.Infrastructure.Utilities;
- using Muchinfo.MTPClient.Infrastructure.Windows;
- using Muchinfo.MTPClient.IService;
- using Muchinfo.MTPClient.Resources;
- using Muchinfo.MTPClient.Service.Utilities;
- using Muchinfo.MTPClient.Trade.ViewModels;
- using Muchinfo.MTPClient.Trade.Views.ERMCP;
- using Muchinfo.MTPClient.UI.Utilities;
- using Muchinfo.MTPClient.UI.Views;
- using Muchinfo.PC.Common.Extensions;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Diagnostics;
- using System.Linq;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Input;
- using System.Windows.Threading;
- namespace Muchinfo.MTPClient.UI.ViewModels
- {
- /// <summary>
- /// HomePageViewModel类
- /// </summary>
- public class HomeViewModel : ViewModelBase
- {
- #region Fields
- private bool _isClosePower;//是否有平仓权限
- private ObservableCollection<SysMenuItem> _mainMenuItems;
- private Visibility _statusBarVisibility;
- private Visibility _toolBarVisibility;
- private IAnnouncementService _announcementService;
- private ILoginService _loginService;
- private int _oldTabIndex;
- private ISystemService _systemService;
- private IDeliveryService _deliveryService;//交割服务-》查询交割关系列表
- private Dictionary<ResxVerType, ResxVerInfo> _resxVerInfos; ////服务端资源版本
- private IOrderService _orderService;
- private ICommonQueryService _commonQueryService;
- #endregion Fields
- #region Constructors
- /// <summary>
- /// Initializes a new instance of the <see cref="HomeViewModel" /> class.
- /// </summary>
- /// <param name="service">系统服务</param>
- public HomeViewModel(ISystemService service)
- {
- //初始化命令
- InitializeCommands();
- _toolBarVisibility = Visibility.Visible;
- _statusBarVisibility = Visibility.Visible;
- _announcementService = SimpleIoc.Default.GetInstance<IAnnouncementService>();
- _loginService = SimpleIoc.Default.GetInstance<ILoginService>();
- SystemName = ApplicationParameter.TradeSystemName;
- _deliveryService = SimpleIoc.Default.GetInstance<IDeliveryService>();
- _systemService = service;
- _orderService = SimpleIoc.Default.GetInstance<IOrderService>();
- _commonQueryService = SimpleIoc.Default.GetInstance<ICommonQueryService>();
- ApplicationParameter.MakePublishNetIp();
- //消息注册
- RegisterMessenger();
- if (UserManager.IsAccountLogin) ////已交易登录
- {
- TradeDataInit();
- }
- else
- { ////游客没有交易菜单
- CreateLoaclMenu(new List<SysMenuItem>());
- }
- }
- #endregion Constructors
- #region Properties
- #region Public Properties
- private RelayCommand _ftenCommand;
- /// <summary>
- /// Gets the FtenCommand.
- /// </summary>
- public RelayCommand FtenCommand
- {
- get
- {
- return _ftenCommand
- ?? (_ftenCommand = new RelayCommand(
- () =>
- {
- var FtenAddress = ApplicationParameter.FtenAddress;
- if (!string.IsNullOrEmpty(FtenAddress))
- {
- MessengerHelper.DefaultSend<TabContetMode>(TabContetMode.QuoteGoodsInfo, MessengerTokens.ChangeGoodsInfo);
- }
- }));
- }
- }
- /// <summary>
- /// 当前使用的样式
- /// </summary>
- public Object CurrentStyle
- {
- get;
- set;
- }
- public string TradeTypeDisplay
- {
- get
- {
- return string.Empty;
- //var isConfigVersion = ConfigurationManager.AppSettings["IsMockTrade"];
- //return isConfigVersion == "0" ? " - 模拟盘" : " - 实盘";
- }
- }
- /// <summary>
- /// 系统名称
- /// </summary>
- public string SystemName { get; set; }
- /// <summary>
- /// 获取和设置the main menu items
- /// </summary>
- public ObservableCollection<SysMenuItem> MainMenuItems
- {
- get
- {
- return _mainMenuItems;
- }
- set
- {
- Set(() => MainMenuItems, ref _mainMenuItems, value);
- }
- }
- /// <summary>
- /// 获取和设置the menu command
- /// </summary>
- public RelayCommand<SysMenuItem> MenuCommand
- {
- get;
- private set;
- }
- /// <summary>
- /// Gets or sets the name of the user.
- /// </summary>
- public Visibility StatusbarVisibility
- {
- get { return _statusBarVisibility; }
- set
- {
- Set(() => StatusbarVisibility, ref _statusBarVisibility, value);
- }
- }
- /// <summary>
- /// Gets or sets the name of the user.
- /// </summary>
- public Visibility ToolbarVisibility
- {
- get { return _toolBarVisibility; }
- set
- {
- Set(() => ToolbarVisibility, ref _toolBarVisibility, value);
- }
- }
- /// <summary>
- /// 主窗体是否隐藏
- /// </summary>
- private Visibility _mainPanelVisibility = Visibility.Collapsed;
- public Visibility MainPanelVisibility
- {
- get { return _mainPanelVisibility; }
- set
- {
- Set(() => MainPanelVisibility, ref _mainPanelVisibility, value);
- }
- }
- #region 快速下单
- public RelayCommand<int> OrderTransactionCommand
- {
- get
- {
- return new RelayCommand<int>((commandParameter) => Task.Factory.TryStartNew(() =>
- {
- }));
- }
- }
- #endregion
- /// <summary>
- /// 是否为已使用交易账号登录
- /// </summary>
- public bool IsAccountLogin
- {
- get { return UserManager.IsAccountLogin; }
- }
- /// <summary>
- /// 是否顯示功能樹
- /// </summary>
- public bool IsTreeVbs
- {
- get { return UserManager.IsAccountLogin && IsTradeVisible; }
- }
- private bool _isBusy;
- /// <summary>
- /// 是否忙
- /// </summary>
- public bool IsBusy
- {
- get { return _isBusy; }
- set { Set(() => IsBusy, ref _isBusy, value); }
- }
- #endregion Public Properties
- private bool _isTradeVisible = true;
- /// <summary>
- /// 是否显示交易数据
- /// </summary>
- public bool IsTradeVisible
- {
- get { return _isTradeVisible; }
- set
- {
- Set(() => IsTradeVisible, ref _isTradeVisible, value);
- var defaultLayout = UserManager.GetCurrentLayoutStyle();
- MainLayoutUpdate(defaultLayout);
- }
- }
- /// <summary>
- /// 是否保存布局
- /// </summary>
- public bool IsSaveLayout
- {
- get;
- set;
- }
- /// <summary>
- /// 是否显示期货组件
- /// </summary>
- private Visibility _quoteVisibility = Visibility.Hidden;
- public Visibility QuoteVisibility
- {
- get { return _quoteVisibility; }
- set
- {
- Set(() => QuoteVisibility, ref _quoteVisibility, value);
- }
- }
- /// <summary>
- /// 是否显示WEB浏览器组件
- /// </summary>
- private Visibility _webBrowerVisibility = Visibility.Visible;
- public Visibility WebBrowerVisibility
- {
- get { return _webBrowerVisibility; }
- set
- {
- Set(() => WebBrowerVisibility, ref _webBrowerVisibility, value);
- }
- }
- #endregion Properties
- #region Methods
- #region Private Methods
- /// <summary>
- /// 构建本地菜单
- /// </summary>
- /// <param name="accessItems">交易菜单</param>
- private void CreateLoaclMenu(List<SysMenuItem> accessItems)
- {
- _systemService = SimpleIoc.Default.GetInstance<ISystemService>();
- _orderService = SimpleIoc.Default.GetInstance<IOrderService>();
- MainMenuItems = _systemService.GetSysMenuItems(accessItems, MenuCommand);
- var toolMenu = _mainMenuItems.FirstOrDefault(z => z.Title == MenuNames.Tools);
- if (toolMenu == null || toolMenu.Children == null || !toolMenu.Children.Any()) return;
- var toolBarItem = toolMenu.Children.FirstOrDefault(z => z.SysCommandType == MenuCommandType.Toolbar);
- if (toolBarItem != null) ToolbarVisibility = toolBarItem.IsChecked ? Visibility.Visible : Visibility.Collapsed;
- var statusBarItem = toolMenu.Children.FirstOrDefault(z => z.SysCommandType == MenuCommandType.Statusbar);
- if (statusBarItem != null) StatusbarVisibility = statusBarItem.IsChecked ? Visibility.Visible : Visibility.Collapsed;
- }
- /// <summary>
- /// 消息注册
- /// </summary>
- private void RegisterMessenger()
- {
- MessengerHelper.DefaultRegister<bool>(this, MessengerTokens.MainPanelIsUnlock, MainPanelIsEnableMethod);
- MessengerHelper.DefaultRegister<bool>(this, MessengerTokens.InitLockTimer, InitLockTimer);
- MessengerHelper.DefaultRegister<QuoteGoodsDTO>(this, MessengerTokens.SelectGoodsChange, SelectGoodsChange);
- MessengerHelper.DefaultRegister<QuoteGoodsForSelectOrder>(this, MessengerTokens.SelectGoodsOrderChange, SelectGoods);
- MessengerHelper.DefaultRegister<QuoteGoodsDTO>(this, MessengerTokens.SelectCommissionGoodsChange, SelectCommissionGoodsChange);
- //注册快捷下单消息
- MessengerHelper.DefaultRegister<FrameworkElement>(this, MessengerTokens.ShowQueryContet, (view) =>
- {
- QueryView = view;
- });
- MessengerHelper.DefaultRegister<string>(this, MessengerTokens.OrderRefresh, OrderViewRefresh);
- MessengerHelper.DefaultRegister<bool>(this, MessengerTokens.SetHideExpandTradeToken, SetHideTradeMsg);
- MessengerHelper.DefaultRegister<bool>(this, MessengerTokens.CancelOrderEnable, (isEnable) =>
- {
- //var tradeFunc = UserManager.TradeFuncMenus.FirstOrDefault((item) => item.FuncMenuCode == UserManager.GetMenuCommandValue(MenuCommandType.Cancel));
- var tradeFunc = UserManager.TradeFuncMenus.FirstOrDefault((item) => item.FuncMenuCode == MenuCommandType.Cancel.ToString());
- if (tradeFunc != null)
- {
- tradeFunc.IsEnabled = isEnable;
- }
- });
- MessengerHelper.DefaultRegister<TradeOrderViewModel>(this, MessengerTokens.OrderMessage, SetOrderView);
- }
- /// <summary>
- /// 选择某个商品
- /// </summary>
- /// <param name="goods"></param>
- private void SelectGoods(QuoteGoodsForSelectOrder goods)
- {
- if (goods == null)
- {
- return;
- }
- if (goods.IsSelect)
- {
- if (ApplicationParameter._LockType == LockType.Lock &&
- UserManager.GetCurrentLayoutStyle() == LayoutStyle.Tradition)
- {
- return;
- }
- }
-
- SelectedQuoteGoods = goods.QuoteGoods;
- if (IsAccountLogin && (SelectedQuoteGoods.ContainsGoodsSrc & (int)GoodsFromScr.Trade) > 0) //交易商品可下单
- {
- ////处理点击会卡的问题
- Task.Factory.TryStartNew(() =>
- {
- var viewModel = new TradeOrderViewModel(SelectedQuoteGoods, Direction.Bid);
- SetOrderView(viewModel);
- });
- }
- }
- /// <summary>
- /// 选择商品改变
- /// </summary>
- /// <param name="goods">The goods.</param>
- private void SelectGoodsChange(QuoteGoodsDTO goods)
- {
- var quoteGoods = CacheManager.CacheGoodsBaseInfos.FirstOrDefault((item) => item.Symbol == goods.Symbol);
- // bool showChart;
- if (quoteGoods != null)
- {
- //todo:
- //if (goods.GoodsParameters.TradeMode == TradeModeType.BidGoods)
- //{
- // showChart = ApplicationParameter.ShowChart == 2; //设置竞价商品才显示图表
- //}
- QuoteGoodsForSelectOrder orderGoods = new QuoteGoodsForSelectOrder
- {
- IsSelect = true,
- QuoteGoods = quoteGoods
- };
- SelectGoods(orderGoods);
-
- }
- //IsShowChart = ApplicationParameter.ShowChart == 1 || showChart;
- }
- /// <summary>
- /// 选择五档买卖商品改变
- /// </summary>
- /// <param name="goods">The goods.</param>
- private void SelectCommissionGoodsChange(QuoteGoodsDTO goods)
- {
- var quoteGoods = CacheManager.CacheGoodsBaseInfos.FirstOrDefault((item) => item.Symbol == goods.Symbol);
- if (quoteGoods != null)
- {
- SelectedCommissionQuoteGoods = quoteGoods;
- }
- }
- /// <summary>
- /// 设置是否展开交易信息
- /// </summary>
- /// <param name="result"></param>
- private void SetHideTradeMsg(bool result)
- {
- IsTradeVisible = result;
- }
- private FrameworkElement _queryView;
- /// <summary>
- /// 查询面板显示的内容
- /// </summary>
- public FrameworkElement QueryView
- {
- get { return _queryView; }
- set
- {
- if (_queryView != null && value.Equals(_queryView))
- {
- return;
- }
- else
- {
- if (_queryView != null)
- {
- var queryPanel = _queryView.DataContext as QueryPanelModelBase;
- if (queryPanel != null)
- {
- queryPanel.UnRegisterMessage();
- }
- }
- }
- Set(() => QueryView, ref _queryView, value);
- var newQueryPanel = value.DataContext as QueryPanelModelBase;
- if (newQueryPanel != null)
- {
- newQueryPanel.RegisterMessage();
- }
- }
- }
- private FrameworkElement _mainContent;
- /// <summary>
- /// 布局内容显示
- /// </summary>
- public FrameworkElement MainContent
- {
- get { return _mainContent; }
- set { Set(() => MainContent, ref _mainContent, value); }
- }
- /// <summary>
- /// 选择的商品
- /// </summary>
- public QuoteGoods SelectedQuoteGoods { get; set; }
- /// <summary>
- /// 选择的商品
- /// </summary>
- public QuoteGoods SelectedCommissionQuoteGoods { get; set; }
- /// <summary>
- /// 更新单据窗口的内容
- /// </summary>
- /// <param name="update"></param>
- private void OrderViewRefresh(string update)
- {
- //下方查询界面显示方式修改后此方法无效,要刷新单据须在各自界面注册消息OrderViewRefresh去实现 --dyp
- if (QueryView != null && QueryView.DataContext is IOrderRefresh)
- {
- (QueryView.DataContext as IOrderRefresh).Refresh();
- }
- ///刷新后-重新查询交割关系列表--pending by dk
- // _deliveryService.QueryRelationPAndXGoodsInfoList(QueryAllDeliveryRelationSuccess, null);
- }
- /// <summary>
- /// <summary>
- /// 设置撤单是否可用
- /// </summary>
- /// <param name="isEnable"></param>
- private void SetCancelItemEable(bool isEnable)
- {
- var menuItem = _mainMenuItems.FirstOrDefault((item) => item.Title == MenuNames.Trading);
- if (menuItem == null) return;
- var canelItem = menuItem.Children.FirstOrDefault((cItem) => cItem.Title == MenuNames.OrderCancel);
- if (canelItem == null) return;
- //var accountManager = SimpleIoc.Default.GetInstance<AccountManagerViewModel>();
- }
- /// <summary>
- /// Executes the command.
- /// </summary>
- /// <param name="item">The item.</param>
- private void ExecuteCommand(SysMenuItem item)
- {
- CacheManager.FromType = eOrderFormType.Commom; //顶部买卖按钮与挂牌无关
- var goods = this.SelectedQuoteGoods;
- switch (item.SysCommandType)
- {
- #region 系统
- case MenuCommandType.Reconnect:
- if (MessageBoxHelper.ShowQuestion(Muchinfo.MTPClient.Resources.Client_Resource.UI2014_IsOrNotReconnect,
- Muchinfo.MTPClient.Resources.Client_Resource.UI2014_Tips) == MessageBoxResult.Yes)
- {
- if (UserManager.IsAccountLogin)
- {
- ////保存布局及列表行情抬头
- MessengerHelper.DefaultSend(string.Empty, MessengerTokens.SaveLayout);
- //手动发送登出消息
- var service = SimpleIoc.Default.GetInstance<ILoginService>();
- if (service != null) service.TradeAccountLogout(UserManager.CurrentTradeAccount);
- }
- WindowHelper.RerunApplication();
- }
- break;
- case MenuCommandType.ChangeTradePassword:
- //非强制修改密码
- MessengerHelper.DefaultSend(true, MessengerTokens.ShowModifyPwd);
- break;
- case MenuCommandType.Horizontal:
- SetInitializeCheck(item);
- MainLayoutUpdate(LayoutStyle.Horizontal);
- break;
- case MenuCommandType.Vertical:
- SetInitializeCheck(item);
- MainLayoutUpdate(LayoutStyle.Vertical);
- break;
- case MenuCommandType.Tradition:
- SetInitializeCheck(item);
- MainLayoutUpdate(LayoutStyle.Tradition);
- break;
- case MenuCommandType.Logout:
- OnClose();
- break;
- case MenuCommandType.CoolBlack:
- SetInitializeCheck(item);
- ThemesUpdate(ColorStyle.CoolBlack);
- break;
- //case MenuCommandType.White:
- // break;
- //case MenuCommandType.SkyBlue:
- // SetInitializeCheck(item);
- // ThemesUpdate(ColorStyle.SkyBlue);
- // break;
- //case MenuCommandType.DarkRed:
- // SetInitializeCheck(item);
- // ThemesUpdate(ColorStyle.DarkRed);
- // break;
- case MenuCommandType.DarkBlue:
- SetInitializeCheck(item);
- ThemesUpdate(ColorStyle.DarkBlue);
- break;
- case MenuCommandType.BlueWhite:
- SetInitializeCheck(item);
- ThemesUpdate(ColorStyle.BlueWhite);
- break;
- case MenuCommandType.LockScreen:
- this.IsLockScreen = true;
- break;
- #endregion
- #region 分析
- case MenuCommandType.CandleChart:
- if (goods == null) return;
- // WindowHelper.OpenQuoteChartWindow(new OpenQuoteChartWindowArg(goods, CycleType.Minute));
- break;
- case MenuCommandType.TimeSharingChart:
- if (goods == null) return;
- // WindowHelper.OpenQuoteChartWindow(new OpenQuoteChartWindowArg(goods, CycleType.TimeSharing));
- break;
- case MenuCommandType.TikChart:
- if (goods == null) return;
- // WindowHelper.OpenQuoteChartWindow(new OpenQuoteChartWindowArg(goods, CycleType.Tik));
- break;
- case MenuCommandType.TradeDetails:
- if (goods == null) return;
- //PriceCardHelper.OpenSubPenDetail(goods);
- break;
- case MenuCommandType.TikDetails:
- if (goods == null) return;
- //PriceCardHelper.OpenSubPriceDetail(goods);
- break;
- case MenuCommandType.F10:
- //todo:
- break;
- case MenuCommandType.MA:
- //todo:
- break;
- case MenuCommandType.BOLL:
- //todo:
- break;
- case MenuCommandType.MACD:
- //todo:
- break;
- case MenuCommandType.DMI:
- //todo:
- break;
- case MenuCommandType.OBV:
- //todo:
- break;
- case MenuCommandType.VOL:
- //todo:
- break;
- case MenuCommandType.RSI:
- //todo:
- break;
- case MenuCommandType.KDJ:
- //todo:
- break;
- case MenuCommandType.CCI:
- //todo:
- break;
- case MenuCommandType.BIAS:
- //todo:
- break;
- case MenuCommandType.PSY:
- //todo:
- break;
- case MenuCommandType.MTM:
- //todo:
- break;
- case MenuCommandType.WR:
- //todo:
- break;
- case MenuCommandType.MultiCycles:
- //todo:
- break;
- case MenuCommandType.MultiGoodses:
- //todo:
- break;
- case MenuCommandType.ComparisonGoodes:
- //todo:
- break;
- #endregion
- #region 交易
- case MenuCommandType.BuyIn:
- //建仓
- var openOrder = new OrderMessage() { Direction = Direction.Bid, OrderPriceMode = ePriceMode.PRICEMODE_MARKET };
- MessengerHelper.DefaultSend(openOrder, MessengerTokens.OrderMessageToken);
- break;
- case MenuCommandType.Sellout:
- //平仓
- var order = new OrderMessage() { Direction = Direction.Ask, OrderPriceMode = ePriceMode.PRICEMODE_MARKET };
- MessengerHelper.DefaultSend(order, MessengerTokens.OrderMessageToken);
- break;
- case MenuCommandType.Cancel:
- //撤单
- if (ViewModelLocator.MOrderDetails.CanCancelOrderDetial())
- {
- // ViewModelLocator.MOrderDetails.CancelAllHoldingCammand.Execute(null);
- ViewModelLocator.MOrderDetails.CancelHoldingCammand.Execute(null);
- }
- else
- {
- MessageBoxHelper.ShowQuestion(Muchinfo.MTPClient.Resources.Client_Resource.UnSupportOrderTypes, Muchinfo.MTPClient.Resources.Client_Resource.Models_CancelBillTips);
- }
- break;
- case MenuCommandType.SaleApply:
- var sale = new OrderMessage() { Direction = Direction.Bid, OrderPriceMode = ePriceMode.PRICEMODE_MARKET };
- MessengerHelper.DefaultSend(sale, MessengerTokens.OrderMessageToken);
- break;
- case MenuCommandType.DeliveryApply:
- //交收申请
- MessengerHelper.DefaultSend(UserManager.CurrentTradeAccount, MessengerTokens.DeliveryDeclare);
- break;
- case MenuCommandType.ReportQuery:
- //报表查询
- MessengerHelper.DefaultSend(UserManager.CurrentTradeAccount, MessengerTokens.AccountReport);
- break;
- case MenuCommandType.TradeLogin:
- var login = new TradeLoginView()
- {
- Owner = Application.Current.MainWindow,
- WindowStartupLocation = WindowStartupLocation.CenterOwner,
- ShowInTaskbar = false,
- };
- if (login.ShowDialog() == true)
- {
- TradeDataInit(); ////交易账号登录
- }
- break;
- //case MenuCommandType.TradeSettings:
- // MessengerHelper.DefaultSend(UserManager.CurrentTradeAccount, MessengerTokens.TraderingParamSet);
- // break;
- #endregion
- #region 帮助
- //case MenuCommandType.UserGuide:
- // break;
- case MenuCommandType.EscapeClause:
- var v = new AboutView(1);
- v.Owner = Application.Current.MainWindow;
- v.WindowStartupLocation = WindowStartupLocation.CenterOwner;
- v.ShowDialog();
- break;
- case MenuCommandType.OfficalWeb:
- //if (string.IsNullOrWhiteSpace(ApplicationParameter.WebSite))
- //{
- // MessageBoxHelper.ShowInfo(Muchinfo.MTPClient.Resources.Client_Resource.UI2014_NoOfficialWebsitePleaseConfigurationFile, Muchinfo.MTPClient.Resources.Client_Resource.UI2014_ConfigurationError);
- //}
- //else
- //{
- // var proc = new Process { StartInfo = { FileName = ApplicationParameter.WebSite } };
- // proc.Start();
- //}
- HedgingEntrustWindow hedgingEntrustWindow = new HedgingEntrustWindow()
- {
- WindowStartupLocation = WindowStartupLocation.CenterScreen
- };
- _ = hedgingEntrustWindow.ShowDialog();
- break;
- //case MenuCommandType.OnlineCS:
- // break;
- case MenuCommandType.AboutUs:
- var t = new AboutView(2)
- {
- Owner = Application.Current.MainWindow,
- WindowStartupLocation = WindowStartupLocation.CenterOwner
- };
- t.ShowDialog();
- break;
- #endregion
- #region 风管云平台
- case MenuCommandType.Manage:
- // 现货
- QuoteVisibility = Visibility.Hidden;
- WebBrowerVisibility = Visibility.Visible;
- break;
- #endregion
- case MenuCommandType.MarketQuote:
- case MenuCommandType.SelectedGoodses:
- MessengerHelper.DefaultSend(item, MessengerTokens.ChangeMarket);
- // 期货
- QuoteVisibility = Visibility.Visible;
- WebBrowerVisibility = Visibility.Hidden;
- break;
- default:
- if (item.Command != null) ////默认实现自带操作的命令
- {
- item.Command.Execute(null);
- }
- break;
- }
- }
- /// <summary>
- /// Initializes the commands.
- /// </summary>
- private void InitializeCommands()
- {
- MenuCommand = new RelayCommand<SysMenuItem>((item) =>
- {
- if (item == null || (item.Children != null && item.Children.Any())) return;
- ExecuteCommand(item);
- });
- }
- #region 快捷键
- private RelayCommand<CommandFunc> _keyCommand;
- /// <summary>
- /// 初始化命令
- /// </summary>
- public RelayCommand<CommandFunc> KeyCommand
- {
- get
- {
- if (_keyCommand != null)
- {
- return _keyCommand;
- }
- _keyCommand = new RelayCommand<CommandFunc>((command) =>
- {
- ExecuteKeyCommand(command);
- });
- return _keyCommand;
- }
- }
- /// <summary>
- /// 执行命令
- /// </summary>
- /// <param name="command"></param>
- private void ExecuteKeyCommand(CommandFunc command)
- {
- if (this.IsLockScreen) ////锁屏时不执行命令
- {
- return;
- }
- var curMode = ViewModelLocator.MainContent.TabContetMode;
- switch (command)
- {
- case CommandFunc.OpenOrder:
- if (CanCommandEnable(MenuCommandType.BuyIn) &&
- UserManager.QuotationWindowType == TabContetMode.QuoteList)
- {
- var order = new OrderMessage()
- {
- Direction = Direction.Bid,
- OrderPriceMode = ePriceMode.PRICEMODE_MARKET
- };
- MessengerHelper.DefaultSend(order, MessengerTokens.OrderMessageToken);
- }
- break;
- case CommandFunc.OpenChart:
- MessengerHelper.DefaultSend(TabContetMode.QuoteChart, MessengerTokens.MainContentChange);
- break;
- case CommandFunc.BrowserBack: ////返回行情列表,在行情列表则提示是否退出
- var mode = ViewModelLocator.MainContent.TabContetMode;
- if (mode == TabContetMode.QuoteList)
- {
- OnClose();
- }
- else
- {
- MessengerHelper.DefaultSend(TabContetMode.QuoteList, MessengerTokens.MainContentChange);
- }
- break;
- case CommandFunc.QuoteInsert:
- if ((curMode == TabContetMode.QuoteList || curMode == TabContetMode.QuoteBoard) &&
- SelectedQuoteGoods != null)
- {
- if (ApplicationParameter.ShowChart == 1 || !UserManager.IsAccountLogin) ////游客登录也可看图表
- {
- //如果是在内容行上双击, 打开分析图表窗口
- //MessengerHelper.DefaultSend(new OpenQuoteChartWindowArg(QuoteListDataGrid.SelectedItem as QuoteGoods, CycleType.Minutes1),
- // MessengerTokens.OpenQuoteChartWindow);
- MessengerHelper.DefaultSend(TabContetMode.QuoteChart, MessengerTokens.MainContentChange);
- }
- }
- break;
- case CommandFunc.QuotePageDown:
- case CommandFunc.QuotePageup:
- if (curMode == TabContetMode.QuoteList || curMode == TabContetMode.QuoteChart)
- {
- MessengerHelper.DefaultSend<CommandFunc>(command, MessengerTokens.QuoteGoodsListToken);
- }
- break;
- case CommandFunc.GoodsF10:
- var FtenAddress = ApplicationParameter.FtenAddress;
- if (!string.IsNullOrEmpty(FtenAddress))
- {
- MessengerHelper.DefaultSend<TabContetMode>(TabContetMode.QuoteGoodsInfo,
- MessengerTokens.ChangeGoodsInfo);
- }
- break;
- case CommandFunc.Tab:
- if (UserManager.GetCurrentLayoutStyle() == LayoutStyle.Tradition)
- {
- MessengerHelper.DefaultSend(true, MessengerTokens.SetOrderFoucsToken);
- }
- break;
- case CommandFunc.Amount:
- MessengerHelper.DefaultSend(MenuCommandType.AccountInfo, MessengerTokens.MenuSelectChange);
- break;
- case CommandFunc.HoldDetail:
- MessengerHelper.DefaultSend(MenuCommandType.Position, MessengerTokens.MenuSelectChange);
- break;
- case CommandFunc.CompleteOrder:
- MessengerHelper.DefaultSend(MenuCommandType.TransactionOrder, MessengerTokens.MenuSelectChange);
- break;
- case CommandFunc.QuoteTik:
- if (SelectedQuoteGoods != null &&
- (SelectedQuoteGoods.TradeMode == eTradeMode.TRADEMODE_BIDDING ||
- SelectedQuoteGoods.TradeMode == eTradeMode.TRADEMODE_MARKETMAKE ||
- SelectedQuoteGoods.TradeMode == eTradeMode.TRADEMODE_BIDDINGMARKETMAKE))
- {
- MessengerHelper.DefaultSend<QuoteGoods>(SelectedQuoteGoods, MessengerTokens.ShowTikDetail);
- }
- MessengerHelper.DefaultSend(MenuCommandType.AccountInfo, MessengerTokens.MenuSelectChange);
- break;
- case CommandFunc.Buy:
- var tradeView = SimpleIoc.Default.GetInstance<TradeHeaderViewModel>();
- if (tradeView.CanCommandEnable(MenuCommandType.BuyIn))
- {
- tradeView.BuyCommand.Execute(null);
- }
- break;
- case CommandFunc.Sell:
- var tradeViewsell = SimpleIoc.Default.GetInstance<TradeHeaderViewModel>();
- if (tradeViewsell.CanCommandEnable(MenuCommandType.Sellout))
- {
- tradeViewsell.SellCommand.Execute(null);
- }
- break;
- case CommandFunc.Cancel:
- var orderView = SimpleIoc.Default.GetInstance<MOOrderDetailViewModel>();
- orderView.SearchOrderStatus = SearchOrderStatus.OnMarket;
- MessengerHelper.DefaultSend(MenuCommandType.EntrustOrder, MessengerTokens.MenuSelectChange);
- break;
- case CommandFunc.OpenTradeBoard:
- IsTradeVisible = !IsTradeVisible;
- break;
- case CommandFunc.TranFloatOrder:
- break;
- default:
- break;
- }
- }
- /// <summary>
- /// 命令类型
- /// </summary>
- /// <param name="commandType"></param>
- /// <returns></returns>
- public bool CanCommandEnable(MenuCommandType commandType)
- {
- if (UserManager.TradeFuncMenus != null && UserManager.TradeFuncMenus.Any())
- {
- var tradeFunc = UserManager.TradeFuncMenus.FirstOrDefault((item) => item.FuncMenuCode == commandType.ToString());
- if (tradeFunc != null)
- {
- return tradeFunc.IsEnabled;
- }
- }
- return false;
- }
- /// <summary>
- /// 初始化键命令
- /// </summary>
- /// <returns></returns>
- public List<KeyBinding> InitKeysCommand()
- {
- return _systemService.GetHomeKeyBindings(KeyCommand);
- }
- #endregion
- /// <summary>
- /// 将菜单的同级结点选择状态设置为False
- /// </summary>
- /// <param name="item">设置选择状态的菜单</param>
- private void SetInitializeCheck(SysMenuItem item)
- {
- if (item.ParentItem != null)
- {
- foreach (var childItem in item.ParentItem.Children)
- {
- childItem.IsChecked = false;
- }
- }
- item.IsChecked = true;
- SaveUserConfig(item); //只有设置布局的方可使用该方法
- }
- /// <summary>
- /// 保存用户主题布局
- /// </summary>
- /// <param name="item">设置的菜单</param>
- private void SaveUserConfig(SysMenuItem item)
- {
- switch (item.SysCommandType)
- {
- case MenuCommandType.Vertical:
- ////保存配置
- UserManager.SaveCurrentLayoutStyle(LayoutStyle.Vertical);
- break;
- case MenuCommandType.Horizontal:
- ////保存配置
- UserManager.SaveCurrentLayoutStyle(LayoutStyle.Horizontal);
- break;
- case MenuCommandType.Tradition:
- ////保存配置
- UserManager.SaveCurrentLayoutStyle(LayoutStyle.Tradition);
- break;
- case MenuCommandType.CoolBlack:
- ////保存配置
- UserManager.SaveCurrentColorStyle(ColorStyle.CoolBlack);
- break;
- case MenuCommandType.BlueWhite:
- ////保存配置
- UserManager.SaveCurrentColorStyle(ColorStyle.BlueWhite);
- break;
- case MenuCommandType.DarkBlue:
- ////保存配置
- UserManager.SaveCurrentColorStyle(ColorStyle.DarkBlue);
- break;
- default:
- break;
- }
- }
- /// <summary>
- /// 设置系统主题
- /// </summary>
- public void InitializeThemes()
- {
- Application.Current.Dispatcher.BeginInvoke(new Action(() =>
- {
- var defaultLayout = UserManager.GetCurrentLayoutStyle();
- MainLayoutUpdate(defaultLayout);
- var defaultColor = UserManager.GetCurrentColorStyle();
- ThemesUpdate(defaultColor);
- }));
- }
- /// <summary>
- /// 切换主题加载资源
- /// </summary>
- /// <param name="colorStyle"></param>
- private void ThemesUpdate(ColorStyle colorStyle)
- {
- string themesType;
- switch (colorStyle)
- {
- case ColorStyle.CoolBlack:
- themesType = "CoolBlack";
- break;
- //case ColorStyle.SkyBlue:
- // themesType = "SkyBlue";
- // break;
- //case ColorStyle.DarkRed:
- // themesType = "DarkRed";
- // break;
- case ColorStyle.DarkBlue:
- themesType = "DarkBlue";
- break;
- case ColorStyle.BlueWhite:
- themesType = "BlueWhite";
- break;
- default:
- themesType = "DarkBlue";
- break;
- }
- string url = string.Format("/Client.Main;component/Themes/{0}/Style.xaml", themesType);
- var resource = (ResourceDictionary)Application.LoadComponent(new Uri(url, UriKind.Relative));
- if (CurrentStyle != null && Application.Current.Resources.MergedDictionaries.Contains(CurrentStyle))
- {
- Application.Current.Resources.MergedDictionaries.Remove(CurrentStyle as ResourceDictionary);
- }
- else
- {
- for (int i = 0; i < Application.Current.Resources.MergedDictionaries.Count; i++)
- {
- var resourceDic = Application.Current.Resources.MergedDictionaries[i];
- if (resourceDic != null)
- {
- resourceDic.Clear();
- }
- }
- // Application.Current.Resources.MergedDictionaries.Clear();
- }
- //if (ApplicationParameter.DataGridColor == "0") //显示纯色
- //{
- // resource.Add("MuchinfoBrush35", System.Windows.Media.Brushes.Transparent);
- // resource.Add("MuchinfoBrush36", System.Windows.Media.Brushes.Transparent);
- //}
- Application.Current.Resources.MergedDictionaries.Add(resource);
- CurrentStyle = resource;
- MessengerHelper.DefaultSend<string>(themesType, MessengerTokens.RegisterResourceChange);
- ////主題变化时强制通知商品颜色改变
- MessengerHelper.DefaultSend(true, MessengerTokens.NotifyQuoteGoodsColorChanged);
- }
- private void MainLayoutUpdate(LayoutStyle layout)
- {
- LogInfoHelper.WriteInfo("Starting MainLayoutUpdate......");
- try
- {
- switch (layout)
- {
- case LayoutStyle.Horizontal:
- MainContent = new HorizontalLayout();
- break;
- case LayoutStyle.Vertical:
- MainContent = new VerticalLayout();
- break;
- case LayoutStyle.Tradition:
- MainContent = new TraditionLayout();
- break;
- default:
- MainContent = new HorizontalLayout();
- break;
- }
- LogInfoHelper.WriteInfo("end MainLayoutUpdate,begin send Message MessengerTokens.UpdateLayoutChange");
- MessengerHelper.DefaultSend(layout, MessengerTokens.UpdateLayoutChange);
- }
- catch (Exception ex)
- {
- LogInfoHelper.WriteInfo("布局异常..." + ex.ToString());
- }
- }
- /// <summary>
- /// Called when [close].
- /// </summary>
- private void OnClose()
- {
- if (MessageBoxHelper.ShowQuestion(Muchinfo.MTPClient.Resources.Client_Resource.UI2014_IsOrNotExit,
- Muchinfo.MTPClient.Resources.Client_Resource.UI2014_Tips) == MessageBoxResult.Yes)
- {
- if (UserManager.IsAccountLogin)
- {
- ////保存布局及列表行情抬头
- MessengerHelper.DefaultSend(string.Empty, MessengerTokens.SaveLayout);
- //手动发送登出消息
- var service = SimpleIoc.Default.GetInstance<ILoginService>();
- if (service != null) service.TradeAccountLogout(UserManager.CurrentTradeAccount);
- }
- WindowHelper.RerunApplication(false);
- }
- }
- private void MainPanelIsEnableMethod(bool mainPanelIsUnlock)
- {
- if (mainPanelIsUnlock == true)
- {
- WindowCollection list = Application.Current.Windows;
- foreach (Window w in list)
- {
- if (w.Owner == null)
- {
- MainPanelVisibility = Visibility.Collapsed;
- }
- else
- {
- w.WindowState = WindowState.Normal;
- w.Opacity = 1;
- }
- }
- }
- else
- {
- MainPanelVisibility = Visibility.Visible;
- }
- }
- #endregion Private Methods
- #region 公告处理
- /// <summary>
- /// 查询是否有未读公告
- /// </summary>
- /// <param name="itemList">数据列表</param>
- protected void NoticeCountSuccess(List<NoticeCount> itemList)
- {
- if (itemList != null && itemList.Any())
- {
- var notice = itemList.FirstOrDefault((item) => item.MsgType == MsgTypeEnum.Bulletin && item.MsgCount > 0);
- if (notice != null) //弹出公告
- {
- MessengerHelper.DefaultSend<MsgTypeEnum>(notice.MsgType, MessengerTokens.AnnouncementMessage);
- return; //不用两个都弹出来
- }
- var notify = itemList.FirstOrDefault((item) => item.MsgType == MsgTypeEnum.NTF && item.MsgCount > 0);
- if (notify != null) //弹出消息
- {
- MessengerHelper.DefaultSend<MsgTypeEnum>(notify.MsgType, MessengerTokens.AnnouncementMessage);
- }
- }
- }
- protected void QueryErrorCallback(ErrorEntity errorEntity)
- {
- //IsBusy = false;
- //Application.Current.Dispatcher.BeginInvoke(new Action(() =>
- //{
- // ErrorManager.ShowReturnError(errorEntity, Muchinfo.MTPClient.Resources.Client_Resource.APP_Tips, false);
- //}));
- }
- #endregion
- #region 下单
- /// <summary>
- /// 下单类型
- /// </summary>
- /// <param name="tradeViewModel">下单模型</param>
- private void SetOrderView(TradeOrderViewModel tradeViewModel)
- {
- IsOrderVisible = true;
- TradeViewModel = tradeViewModel;
- }
- //ViewLoadedCommand = new RelayCommand<Home>((MainPage) =>
- //{
- // view.MainPanel.Children.Clear();
- // UserManager.UserManagerCurrentMarketType = MenuCommandType.CustomQuote;
- // UserManager.QuotationWindowType = QuotationWindowType.Board;
- // _oldTabIndex = 9;
- // WindowHelper.OpenDefaultQuoteListView(false);
- //});
- private bool _isOrderVisible;
- /// <summary>
- /// 是否显示下单
- /// </summary>
- public bool IsOrderVisible
- {
- get { return _isOrderVisible; }
- set { Set(() => IsOrderVisible, ref _isOrderVisible, value); }
- }
- private TradeOrderViewModel _tradeViewModel;
- /// <summary>
- /// 下单逻辑
- /// </summary>
- public TradeOrderViewModel TradeViewModel
- {
- get { return _tradeViewModel; }
- set { Set(() => TradeViewModel, ref _tradeViewModel, value); }
- }
- #endregion
- #region 交易登录初始化
- /// <summary>
- /// 交易数据初始化
- /// </summary>
- private void TradeDataInit()
- {
- IsBusy = true;
- ////初始化我的自选
- FavoriteManager.InitializeFavorite(MenuNames.QuotationFavorite);
- //先查询市场信息,再查询商品信息
- ulong lastUpdateTimeUTC = CacheManager.GetLastUpdateTimeBy(Muchinfo.MTPClient.Data.Enums.LastUpdateTimeType.MarketsUTime);
- if (MarketResxManager.MarketResx.ResourceHashtable == null || MarketResxManager.MarketResx.Version != lastUpdateTimeUTC)
- {
- _loginService.MarketsQuerySearch(lastUpdateTimeUTC, MarketsInfoCallBack, ErrorEntityCallBack);
- }
- else
- {
- MarketsInfoModel[] marketsArr = Newtonsoft.Json.JsonConvert.DeserializeObject<MarketsInfoModel[]>(Newtonsoft.Json.JsonConvert.SerializeObject(MarketResxManager.MarketResx.ResourceHashtable.Values));
- List<MarketsInfoModel> marketLst = marketsArr.ToList();
- CacheManager.LoadMarketInfoList(marketLst);
- MarketsInfoCallBack(marketLst, 0, false);
- }
- SearchDeliveryGoods();
- }
- /// <summary>
- /// ///查询交割关系列表-成功返回
- /// </summary>
- private void QueryAllDeliveryRelationSuccess(List<Muchinfo.MTPClient.Data.Model.Delivery.RelationPAndXGoodsInfoModel> itemList)
- {
- Muchinfo.MTPClient.Infrastructure.Cache.CacheManager.AllDeliveryRelationList = itemList;
- }
- private void SearchAllGoodsUnitCallBack(List<Muchinfo.MTPClient.Data.Model.DBTableMsg.GoodsUnit> goodUnit)
- {
- Muchinfo.MTPClient.Infrastructure.Cache.CacheManager.TradeGoodsUnit = goodUnit;
- foreach (var quoteGoods in CacheManager.CacheGoodsBaseInfos)
- {
- quoteGoods.AgreeUnitDisplay = quoteGoods.GoodsParameters.AgreeUnit.ToString() + CacheManager.TradeGoodsUnit.Where(x => x.UNITID == quoteGoods.GoodsParameters.AgreeUnitType).Select(x => x.GOODSUNITNAME).FirstOrDefault();
- }
- }
- /// <summary>
- /// 查询失败
- /// </summary>
- /// <param name="error"></param>
- private void ErrorEntityCallBack(ErrorEntity error)
- {
- LogInfoHelper.WriteInfo("MarketsQuerySearch or GoodsQuerySearch or GoodsGroup callback Failed");
- IsBusy = false;
- InitComplete();
- FuncMenusErrorFunc(error);
- }
- private void AccountBaseInfoInitError(ErrorEntity error)
- {
- var format = "查询账号基本信息:" + string.Format(ErrorManager.FormatErrorMsg(error));
- LogInfoHelper.WriteInfo(format);
- ////清除链路
- // LinkManager.Instance.Dispose();
- }
- /// <summary>
- /// 市场成功查询MTP2.0
- /// </summary>
- /// <param name="MarketsInfoList"></param>
- public void MarketsInfoCallBack(List<MarketsInfoModel> MarketsInfoList, ulong marketStamp = 0, bool bUpdate = true)
- {
- //登陆后基本数据查询
- _loginService.LoginQuerySearch(UserManager.CurrentTradeAccount.LoginID, LoginQueryType.All, LoadAccountBaseInfoCallback, AccountBaseInfoInitError);
- if (bUpdate)
- {
- //如果是调用接口更新的系统参数,需要更新对应的本地文件
- var hashtable = new Hashtable();
- foreach (var market in MarketsInfoList)
- {
- hashtable.Add(market.MarketID, market);
- }
- MarketResxManager.SaveMarketResx(hashtable, marketStamp, UserManager.UserDataFolder);
- }
- }
- /// <summary>
- /// 商品成功查询MTP2.0
- /// </summary>
- /// <param name="GoodsInfoList">The goods information list.</param>
- /// <param name="goodsStamp">The goods stamp.</param>
- /// <param name="bUpdate">if set to <c>true</c> [b update].</param>
- /// <param name="midParam">The mid parameter.</param>
- public void GoodsInfoCallBack(List<QuoteGoods> GoodsInfoList, ulong goodsStamp = 0, bool bUpdate = true, List<TradeGoodsFeeRule> midParam = null)
- {
- if (bUpdate)
- {
- //如果是调用接口更新的系统参数,需要更新对应的本地文件
- var hashtable = new Hashtable();
- foreach (var goods in GoodsInfoList)
- {
- hashtable.Add(goods.GoodsCode, goods);
- }
- GoodsResxManager.SaveGoodsResx(hashtable, goodsStamp, UserManager.UserDataFolder);
- }
- ////创建行情链路, 链路成功后订阅商品
- //LinkManager.Instance.CreateQuoteTcpLink();
- //查询交易端配置的菜单--菜单权限从服务端不使用缓存
- ulong menuUTime = CacheManager.GetLastUpdateTimeBy(Muchinfo.MTPClient.Data.Enums.LastUpdateTimeType.MenuUTime);
- _loginService.QueryAccountFuncMenu(menuUTime, midParam, FuncMenusSuccess, FuncMenusErrorFunc);
- //改成串行下载数据
- /*
- ////查询商品组信息
- //_loginService.QueryGoodsGroup(null, ErrorEntityCallBack);
- ////外部交易所查询
- //_loginService.QueryExternalExchange(ExternalExchangeCallBack, ErrorEntityCallBack);
- ////查询持仓汇总
- //var queryList = new List<QueryCommonParam>
- //{
- // new QueryCommonParam() {ParamKey = "accountId", ParamValue = UserManager.CurrentTradeAccount.FundsAccountId + string.Empty}
- //};
- //_orderService.QueryHoldingPosistion(QueryStatement.TradePositionDetail, queryList, QuerySuccessCallBack, QueryErrorCallback);
- //_commonQueryService.QueryMarketRun(0, MarketRunQuerySuccessCallBack, QueryErrorCallback);
- */
- }
- /// <summary>
- /// Markets the run query success call back.
- /// </summary>
- /// <param name="models">The models.</param>
- private void MarketRunQuerySuccessCallBack(List<MarketRunModelNew> models)
- {
- // 这里需要把所属母账户也带上 <- 又不用带了……
- var fundsAccountIDs = string.Join(",", UserManager.CurrentTradeAccount.FundsAccountIds);
- //if (UserManager.CurrentTradeAccount.FundsAccounts.Count > 0 && UserManager.CurrentTradeAccount.FundsAccounts[0].ParentAccountID != 0)
- //{
- // fundsAccountIDs += string.Format(",{0}", UserManager.CurrentTradeAccount.FundsAccounts[0].ParentAccountID);
- //}
- // 查询账户汇率模板
- _commonQueryService.QueryTradeRateTmpConfig(fundsAccountIDs, null, QueryErrorCallback);
- // 查询外部汇率模版配置表
- //_commonQueryService.QueryExtenalTradeRateTmpConfig(fundsAccountIDs, DateTime.Now.ToString("yyyyMMdd"), null, QueryErrorCallback);
- // 查询资金账户汇率
- //_commonQueryService.QueryTaAccountExchangeRate(fundsAccountIDs, null, QueryErrorCallback);
- CacheManager.UpdateMarketRun(models);
- }
- /// <summary>
- /// 外部交易所查询成功调用
- /// </summary>
- /// <param name="externalExchages"></param>
- private void ExternalExchangeCallBack(List<ExternalExchangeModel> externalExchages)
- {
- ////查询交易端配置的菜单
- List<Exchange> exchangeLst = new List<Exchange>();
- foreach (var exchange in externalExchages)
- {
- var newExchanage = new Exchange
- {
- ExchangeId = exchange.AutoID,
- ExchangeCode = exchange.ExExchangeCode,
- ExchangeName = exchange.ExExchangeName,
- IsMarketPrice = exchange.IsMarketPrice
- };
- exchangeLst.Add(newExchanage);
- }
- //使用外部交易所做为交易所缓存
- CacheManager.LoadExchangeInfo(exchangeLst);
- //重新构建分类菜单
- MessengerHelper.DefaultSend(UserManager.CurrentTradeAccount, MessengerTokens.UpdateQuoteMarket);
- //查询持仓汇总
- var queryList = new List<QueryCommonParam>
- {
- new QueryCommonParam() {ParamKey = "accountId", ParamValue = UserManager.CurrentTradeAccount.FundsAccountId + string.Empty}
- };
- _orderService.QueryHoldingPosistion(QueryStatement.TradePositionDetail, queryList, QuerySuccessCallBack, ErrorEntityCallBack);
- CreateLoaclMenu(UserManager.AccessFuncMenus);
- }
- /// <summary>
- /// Queries the success call back.
- /// </summary>
- /// <param name="orders">The orders.</param>
- private void QuerySuccessCallBack(List<HoldingSummary> orders)
- {
- _commonQueryService.QueryMarketRun(0, MarketRunQuerySuccessCallBack, ErrorEntityCallBack);
- }
- /// <summary>
- /// 构建菜单
- /// </summary>
- /// <param name="funcs"></param>
- private void FuncMenusSuccess(List<SysMenuItem> funcs, ulong menuUTime, List<TradeGoodsFeeRule> GoodsRuleLst, bool update = true)
- {
- UserManager.LocalFuncMenus = eSystemMenuValue.CreateInstance().menu;//实例化本地菜单数据;
- UserManager.FixedFuncMenus = eSystemMenuValue.CreateInstance().fixedMenuList;
- List<SysMenuItem> menus;
- try
- {
- //可使用菜单为 本地固定菜单+服务端获取的且终端已实现的菜单 - dyp
- menus = UserManager.FixedFuncMenus.Union(funcs.Where(z => UserManager.LocalFuncMenus.Select(t => t.Value).Contains(z.FuncMenuCode))).ToList();
- //对菜单进行排序 - dyp
- menus.Sort((x, y) => { return x.SortId > y.SortId ? 1 : (x.SortId == y.SortId ? 0 : -1); });
- }
- catch
- {
- menus = new List<SysMenuItem>();
- }
- //更新交集的菜单
- if (update)
- {
- var hashtable = new Hashtable();
- foreach (var menu in menus)
- {
- hashtable.Add(menu.FuncMenuCode, menu);
- }
- MenuResxManager.SaveMenuResx(hashtable, menuUTime, UserManager.UserDataFolder);
- }
- UserManager.AccessFuncMenus = menus;
- // ////是否可看
- // GetDepositPlan();
- // ////更新市场菜单
- //// MessengerHelper.DefaultSend(UserManager.CurrentTradeAccount, MessengerTokens.UpdateQuoteMarket);
- CreateLoaclMenu(menus);
- if (menus != null && menus.Any())
- {
- Application.Current.Dispatcher.BeginInvoke(new Action(() =>
- {
- ViewModelLocator.MenuTree.LoadMenus(menus);
- //缓存 -交易商品的费用计算方式,与交易规则
- CacheManager.TradeGoodsFeeRules = GoodsRuleLst.ToArray<TradeGoodsFeeRule>().ToDictionary(key => key.GoodsID, value => value);
- ///todo:保存在缓存中
- IsBusy = false;
- InitComplete();
- }));
- }
- //查询商品组信息
- _loginService.QueryGoodsGroup(null, ErrorEntityCallBack);
- //外部交易所查询
- _loginService.QueryExternalExchange(ExternalExchangeCallBack, ErrorEntityCallBack);
- }
- /// <summary>
- /// 错误处理
- /// </summary>
- /// <param name="error">错误内容</param>
- private void FuncMenusErrorFunc(ErrorEntity error)
- {
- var funcs = new List<SysMenuItem>();
- UserManager.LocalFuncMenus = eSystemMenuValue.CreateInstance().menu;//实例化本地菜单数据;
- UserManager.FixedFuncMenus = eSystemMenuValue.CreateInstance().fixedMenuList;
- funcs.AddRange(UserManager.FixedFuncMenus);
- UserManager.AccessFuncMenus = funcs;
- CreateLoaclMenu(funcs); ////查询不到菜单时显示默认
- if (funcs != null && funcs.Any())
- {
- Application.Current.Dispatcher.BeginInvoke(new Action(() =>
- {
- ViewModelLocator.MenuTree.LoadMenus(funcs);
- }));
- }
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 登录后初始化内容
- /// </summary>
- /// <param name="accountInfo">与账号相关基本信息</param>
- private void LoadAccountBaseInfoCallback(AccountBaseInfoModel accountInfo)
- {
- ulong lastUpdateTimeUTC = CacheManager.GetLastUpdateTimeBy(Muchinfo.MTPClient.Data.Enums.LastUpdateTimeType.GoodsUTime);
- if (GoodsResxManager.GoodsResx.ResourceHashtable == null || GoodsResxManager.GoodsResx.Version != lastUpdateTimeUTC)
- {
- _loginService.GoodsInfoSearch(lastUpdateTimeUTC, accountInfo.GoodsRuleAndFeeList, GoodsInfoCallBack, ErrorEntityCallBack);
- }
- else
- {
- QuoteGoods[] quoteGoodsArr = Newtonsoft.Json.JsonConvert.DeserializeObject<QuoteGoods[]>(Newtonsoft.Json.JsonConvert.SerializeObject(GoodsResxManager.GoodsResx.ResourceHashtable.Values));
- var goodsLst =quoteGoodsArr == null? new List<QuoteGoods>(): quoteGoodsArr.OrderBy(z=>z.GoodsCode).ToList();
- CacheManager.LoadGoodsInfoList(goodsLst, GoodsFromScr.Trade);
- GoodsInfoCallBack(goodsLst, 0, false, accountInfo.GoodsRuleAndFeeList);
- }
- }
- private void InitComplete()
- {
- //创建行情链路, 链路成功后订阅商品
- // LinkManager.Instance.CreateQuoteTcpLink();
- //进入主界面后再开户断线重连机制
- LinkManager.Instance.StartReconnect();
- Application.Current.Dispatcher.BeginInvoke(new Action(() =>
- {
- //设置系统主题
- InitializeThemes();
- InitLockTimer();///启动锁屏
- ////公告查询处理(处理先显示公告时,样式不一致)--pendding dk
- // _announcementService.QueryNoticeCount(UserManager.CurrentTradeAccount.AccountId, NoticeCountSuccess, QueryErrorCallback);
- ////更新市场菜单
- MessengerHelper.DefaultSend(UserManager.CurrentTradeAccount, MessengerTokens.UpdateQuoteMarket);
- MessengerHelper.DefaultSend(true, MessengerTokens.CheckTokenMsg); ///同步时间
- SimpleIoc.Default.GetInstance<MainContentViewModel>().InitMainPanel(); ////主界面内容 更新
- RaisePropertyChanged(() => IsAccountLogin);
- Task.Factory.TryStartNew(() =>
- {
- //var random = new Random();
- //var seconds = random.Next(2000, 10000); ////随机时间再取资源信息
- //var seconds = random.Next(1, 10); ////随机时间再取资源信息
- //Thread.Sleep(seconds);
- //获取资源版本号
- //_systemService.QueryResxVer(ResxVerSuccess, QueryResxVerError);
- if (CacheManager.CacheLastUpdateTimeList != null)
- {
- SearchErrorResxAndConstResx();
- SearchRiskMsgResx();
- }
- });
- }));
- }
- /// <summary>
- /// 查询数据库错误资源和常量资源信息
- /// </summary>
- private void SearchErrorResxAndConstResx()
- {
- ulong errorCodeTimeUTC = CacheManager.GetLastUpdateTimeBy(Muchinfo.MTPClient.Data.Enums.LastUpdateTimeType.ErrorcodeUTime);
- if (MuchinfoException.ErrorResx.ResourceHashtable == null || MuchinfoException.ErrorResx.Version != errorCodeTimeUTC)
- {
- //错误码字典查询 MTP2.0
- _loginService.ErrorCodeQuerySearch(errorCodeTimeUTC, ErrorCodeResxCallback, QueryResxVerError);
- }
- ulong constTimeUTC = CacheManager.GetLastUpdateTimeBy(Muchinfo.MTPClient.Data.Enums.LastUpdateTimeType.DirctionaryUTime);
- if (ConstResxManager.ConstResx.ResourceHashtable == null || ConstResxManager.ConstResx.Version != constTimeUTC)
- {
- //枚举常量字典查询 MTP2.0
- _loginService.DictionaryQuerySearch(constTimeUTC, ConstCodeResxCallback, QueryResxVerError);
- }
- }
- private void SearchDeliveryGoods()
- {
- ulong DeliveryGoodsUTime = CacheManager.GetLastUpdateTimeBy(Muchinfo.MTPClient.Data.Enums.LastUpdateTimeType.DvGoodsUTime);
- if (DeliveryResxManager.DeliveryResx.ResourceHashtable == null || DeliveryResxManager.DeliveryResx.Version != DeliveryGoodsUTime)
- {
- //错误码字典查询 MTP2.0
- _loginService.DeliveryGoodsQuerySearch(DeliveryGoodsUTime, DeliveryGoodsCallback, DeliveryGoodsError);
- }
- else
- {
- DeliveryGoodsInfoModel[] deliveryGoodsArr = Newtonsoft.Json.JsonConvert.DeserializeObject<DeliveryGoodsInfoModel[]>(Newtonsoft.Json.JsonConvert.SerializeObject(DeliveryResxManager.DeliveryResx.ResourceHashtable.Values));
- List<DeliveryGoodsInfoModel> retLst = deliveryGoodsArr.ToList();
- CacheManager.CacheDeliveryGoodsInfo = retLst;
- }
- }
- private void DeliveryGoodsCallback(List<DeliveryGoodsInfoModel> retLst, ulong DeliveryGoodsUTime = 0, bool bUpdate = true)
- {
- if (bUpdate)
- {
- //如果是调用接口更新的系统参数,需要更新对应的本地文件
- var hashtable = new Hashtable();
- foreach (var deliveryGoods in retLst)
- {
- hashtable.Add(deliveryGoods.DeliveryGoodsCode, deliveryGoods);
- }
- DeliveryResxManager.SaveDeliveryResx(hashtable, DeliveryGoodsUTime, UserManager.UserDataFolder);
- }
- CacheManager.CacheDeliveryGoodsInfo = retLst;
- }
- private void DeliveryGoodsError(ErrorEntity errorEntity)
- {
- var format = "交割商品查询" + string.Format(ErrorManager.FormatErrorMsg(errorEntity));
- LogInfoHelper.WriteInfo(format);
- }
- /// <summary>
- /// 错误资源成功回调
- /// </summary>
- /// <param name="descritions"></param>
- private void ErrorCodeResxCallback(List<ErrorCodeInfoModel> descritions, ulong errCodeStamp)
- {
- Task.Factory.TryStartNew(() =>
- {
- var hashtable = new Hashtable();
- foreach (var desc in descritions)
- {
- hashtable.Add(desc.ErrorCode, desc.ErrorMsg);
- }
- MuchinfoException.ErrorResxSaveRep(hashtable, errCodeStamp);
- });
- }
- /// <summary>
- /// 常量资源成功回调
- /// </summary>
- /// <param name="descritions"></param>
- private void ConstCodeResxCallback(List<DictionaryInfoModel> descritions, ulong constStamp)
- {
- Task.Factory.TryStartNew(() =>
- {
- var hashtable = new Hashtable();
- foreach (var desc in descritions)
- {
- hashtable.Add(desc.FieldCode + "_" + desc.Key, desc.Value);
- }
- ConstResxManager.ConstResxSaveRep(hashtable, constStamp, UserManager.UserDataFolder);
- });
- }
- private void ResxVerSuccess(List<ResxVerInfo> resxVer)
- {
- if (resxVer != null && resxVer.Any())
- {
- _resxVerInfos = resxVer.ToDictionary((item) => item.Versiontype);
- if (_resxVerInfos.ContainsKey(ResxVerType.errorCode))
- {
- if (MuchinfoException.ErrorResx == null || MuchinfoException.ErrorResx.Version < _resxVerInfos[ResxVerType.errorCode].Versionno)
- {
- _systemService.QueryResxDescrition(ResxVerType.errorCode, ResxCallback, QueryResxVerError);
- }
- }
- if (_resxVerInfos.ContainsKey(ResxVerType._const))
- {
- if (ConstResxManager.ConstResx == null || ConstResxManager.ConstResx.Version < _resxVerInfos[ResxVerType._const].Versionno)
- {
- _systemService.QueryResxDescrition(ResxVerType._const, ResxCallback, QueryResxVerError);
- }
- }
- }
- }
- /// <summary>
- /// 查询资源回调
- /// </summary>
- /// <param name="descrition"></param>
- private void ResxCallback(List<ResxDescrition> descritions, ResxVerType varType)
- {
- Task.Factory.TryStartNew(() =>
- {
- var hashtable = new Hashtable();
- foreach (var desc in descritions)
- {
- hashtable.Add(desc.ConstKey, desc.Remarks);
- }
- if (varType == ResxVerType._const)
- {
- ConstResxManager.ConstResxSaveRep(hashtable, _resxVerInfos[varType].Versionno, UserManager.UserDataFolder);
- }
- else if (varType == ResxVerType.errorCode)
- {
- MuchinfoException.ErrorResxSaveRep(hashtable, _resxVerInfos[varType].Versionno);
- }
- });
- }
- private void QueryResxVerError(ErrorEntity errorEntity)
- {
- var format = "资源" + string.Format(ErrorManager.FormatErrorMsg(errorEntity));
- LogInfoHelper.WriteInfo(format);
- }
- #region 风险协议书获取
- /// <summary>
- /// 封装获取风险协议书的方法,如有更新就调用接口重新获取
- /// </summary>
- private void SearchRiskMsgResx()
- {
- ulong riskMsgTimeUTC = CacheManager.GetLastUpdateTimeBy(Muchinfo.MTPClient.Data.Enums.LastUpdateTimeType.RiskMsgUTime);
- if (RiskMsgResxManager.RiskMsgResx.ResourceHashtable == null || RiskMsgResxManager.RiskMsgResx.Version != riskMsgTimeUTC)
- {
- //错误码字典查询 MTP2.0
- _loginService.RiskTipQuerySearch(riskMsgTimeUTC, RiskMsgResxCallback, QueryResxVerError);
- }
- }
- private void RiskMsgResxCallback(RiskTipQueryRspModel risktip, ulong risktipStamp = 0)
- {
- Task.Factory.TryStartNew(() =>
- {
- var hashtable = new Hashtable();
- hashtable.Add(risktip.TipTitle, risktip);
- RiskMsgResxManager.SaveRiskMsgResx(hashtable, risktipStamp, UserManager.UserDataFolder);
- });
- }
- #endregion
- #endregion Methods
- #region 锁屏
- private bool _isLockScreen;
- /// <summary>
- /// 是否锁屏
- /// </summary>
- public bool IsLockScreen
- {
- get { return _isLockScreen; }
- set
- {
- Set(() => IsLockScreen, ref _isLockScreen, value);
- }
- }
- /// <summary>
- /// 锁屏方式
- /// </summary>
- public bool LockScreenType
- {
- get
- {
- return ApplicationParameter.IsShowBGLockSreen == 1;
- }
- }
- /// <summary>
- /// 锁屏定时器
- /// </summary>
- private DispatcherTimer _dispatcherTimer;
- private void InitLockTimer(bool result)
- {
- InitLockTimer();
- }
- /// <summary>
- /// 初始化锁屏
- /// </summary>
- private void InitLockTimer()
- {
- var userInfo = UserManager.GetCurrentUserInfo(); ////交易菜单设置
- int time = 0;
- if (userInfo.TradeParams == null)
- {
- time = ApplicationParameter.LockSreenTime;
- }
- else
- {
- time = userInfo.TradeParams.LockScreenTime;
- }
- if (_dispatcherTimer != null)
- {
- _dispatcherTimer.Stop();
- }
- // 目前暂时不显示锁屏
- time = 0;
- if (time > 0 && UserManager.IsAccountLogin) ////配置了时间才进行锁屏
- {
- _dispatcherTimer = new DispatcherTimer();
- _dispatcherTimer.Tick += _dispatcherTimer_Tick;
- int i = 100;
- _dispatcherTimer.Interval = new TimeSpan(0, 0, i);
- _dispatcherTimer.Start();
- }
- }
- private string _password;
- /// <summary>
- /// 密码
- /// </summary>
- public string Password
- {
- get { return _password; }
- set { Set(() => Password, ref _password, value); }
- }
- private string _errorMsg;
- /// <summary>
- /// 错误消息
- /// </summary>
- public string ErrorMsg
- {
- get { return _errorMsg; }
- set { Set(() => ErrorMsg, ref _errorMsg, value); }
- }
- private void _dispatcherTimer_Tick(object sender, EventArgs e)
- {
- var userInfo = UserManager.GetCurrentUserInfo(); ////交易菜单设置
- int time = 0;
- if (userInfo.TradeParams == null)
- {
- time = ApplicationParameter.LockSreenTime;
- }
- else
- {
- time = userInfo.TradeParams.LockScreenTime;
- }
- var LastInputTime = GetLastInputInfoHelper.GetLastInputTime();
- if (LastInputTime >= time)
- {
- #if DEBUG
- Console.WriteLine("时间:" + LastInputTime);
- #endif
- WindowCollection list = Application.Current.Windows;
- foreach (Window w in list)
- {
- if (w == Application.Current.MainWindow) ////主窗口
- {
- ////切换到行情列表 , 其他浏览器控件
- MessengerHelper.DefaultSend(TabContetMode.QuoteList, MessengerTokens.MainContentChange);
- }
- else
- {
- w.Close(); ////关其他窗口
- }
- }
- _dispatcherTimer.Stop();
- IsLockScreen = true; ////显示锁屏
- MessengerHelper.DefaultSend(false, MessengerTokens.LockScreenSetHideExpandTradeToken);
- //var lockScreen=new LockScreenWin(){Owner = Application.Current.MainWindow,WindowStartupLocation =WindowStartupLocation.CenterOwner };
- //lockScreen.ShowDialog();
- }
- }
- public RelayCommand UnLockCommand
- {
- get
- {
- return new RelayCommand(() =>
- {
- if (Vailed())
- {
- ErrorMsg = string.Empty;
- var password = EncryptHelper.SHA256(UserManager.CurrentTradeAccount.LoginID.ToString() + Password).ToLower();
- if (password.Equals(UserManager.CurrentTradeAccount.Md5Password))
- {
- IsLockScreen = false;
- Password = string.Empty;
- if (_dispatcherTimer == null)
- {
- if (ApplicationParameter.LockSreenTime > 0 && UserManager.IsAccountLogin) ////配置了时间才进行锁屏
- {
- _dispatcherTimer = new DispatcherTimer();
- _dispatcherTimer.Tick += _dispatcherTimer_Tick;
- int i = 100;
- _dispatcherTimer.Interval = new TimeSpan(0, 0, i);
- _dispatcherTimer.Start();
- }
- }
- else
- {
- _dispatcherTimer.Start();
- }
- MessengerHelper.DefaultSend(true, MessengerTokens.LockScreenSetHideExpandTradeToken);
- }
- else
- {
- //ErrorMsg = Client_Resource.Lock_loginpasswordError;
- MessageBoxHelper.ShowInfo(Client_Resource.Lock_loginpasswordError, Client_Resource.UI2014_Tips, true);
- }
- }
- });
- }
- }
- public RelayCommand LoginOutCommand
- {
- get
- {
- return new RelayCommand(() =>
- {
- this.OnClose();
- });
- }
- }
- private bool Vailed()
- {
- if (string.IsNullOrWhiteSpace(Password) || Password.Length < 6)
- {
- MessageBoxHelper.ShowInfo(Client_Resource.UI2014_AccountNotLessThan6Characters, Client_Resource.UI2014_Tips, true);
- return false;
- }
- return true;
- }
- #endregion
- #endregion
- }
- }
|