| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809 |
- using GalaSoft.MvvmLight;
- using GalaSoft.MvvmLight.Ioc;
- using GalaSoft.MvvmLight.Threading;
- using Muchinfo.MTPClient.Account.ViewModels;
- using Muchinfo.MTPClient.Analysis.ViewModels;
- using Muchinfo.MTPClient.Analysis.Views;
- using Muchinfo.MTPClient.Analysis.Views.PriceCard;
- 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.Analysis;
- using Muchinfo.MTPClient.Data.Model.Listing;
- using Muchinfo.MTPClient.Infrastructure.Cache;
- using Muchinfo.MTPClient.Infrastructure.Enums;
- using Muchinfo.MTPClient.Infrastructure.Helpers;
- using Muchinfo.MTPClient.Infrastructure.Interfaces;
- using Muchinfo.MTPClient.Infrastructure.MessengerArgs;
- using Muchinfo.MTPClient.Infrastructure.Utilities;
- using Muchinfo.MTPClient.IService;
- using Muchinfo.MTPClient.Listing.ViewModel;
- using Muchinfo.MTPClient.Listing.Views;
- using Muchinfo.MTPClient.Report.Views;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- //----------------------------------------------------------------
- //Module Name: $safeprojectname$
- //Purpose:
- //CopyRight: Muchinfo
- //History:
- //----------------------------------------------------------------
- //DateTime 2016/2/17 17:33:10
- //Author
- //Description Create
- //----------------------------------------------------------------
- using System.Windows;
- namespace Muchinfo.MTPClient.UI.ViewModels
- {
- public class MainContentViewModel : ViewModelBase
- {
- private int _oldTabIndex;
- private IGoodsService _goodsService;
- private MarketsInfoModel _currentGroup;
- private SearchCommissionsParameter parameters;
- public MainContentViewModel()
- {
- //DataGrid currentDataGrid = QuoteDataGridHelper.FindChild<DataGrid>(Application.Current.MainWindow, "QuoteListDataGrid");
- //currentDataGrid.Focus();
- //打开内容窗口
- // MessengerHelper.DefaultRegister<AddContentPageArgs>(this, MessengerTokens.AddContentPage, AddContentPage);
- _goodsService = SimpleIoc.Default.GetInstance<IGoodsService>();
- // _oldTabIndex = 9;
- TabContetMode = TabContetMode.QuoteList;
- //todo: 默认显示的,改成由左边标签类型来做实现
- //var window = new QuoteListView(null);
- //window.ShowWindow();
- IsShowChart = !UserManager.IsAccountLogin; ////游客登录默认显示图表
- MessengerHelper.DefaultRegister<QuoteGoodsDTO>(this, MessengerTokens.SelectGoodsChange, SelectGoodsChange);
- ////此消息不能在Dispatcher线程处理,否则会使左边功能RadioButton显示出错
- MessengerHelper.DefaultRegister<MarketsInfoModel>(this, MessengerTokens.SelectGoodsGroupChange,
- SelectGoodsGrounpChange, false);
- MessengerHelper.DefaultRegister<OpenQuoteChartWindowArg>(this, MessengerTokens.OpenQuoteChartWindow,
- (e) =>
- {
- TabContetMode = TabContetMode.QuoteChart;
- });
- ///主窗口发送F10快捷键命令
- MessengerHelper.DefaultRegister<TabContetMode>(this, MessengerTokens.ChangeGoodsInfo,
- (e) =>
- {
- ShowF10();
- });
- ///主窗口发送五档历史
- MessengerHelper.DefaultRegister<SearchCommissionsParameter>(this, MessengerTokens.HistoryCommissionsTab,
- (e) =>
- {
- this.parameters = e;
- TabContetMode = TabContetMode.HistoryCommissions;
- });
- ///
- MessengerHelper.DefaultRegister<TabContetMode>(this, MessengerTokens.MainContentChange, (e) =>
- {
- if (e == TabContetMode.QuoteChart)
- {
- if (_currentGroup == null || _currentGroup.TradeMode == eTradeMode.TRADEMODE_SALE ||
- _currentGroup.TradeMode == eTradeMode.TRADEMODE_HANGTAG)
- {
- return;
- }
- }
- TabContetMode = e;
-
- });
- ///布局改变时,图表需重新生成
- MessengerHelper.DefaultRegister<LayoutStyle>(this, MessengerTokens.UpdateLayoutChange, (layout) =>
- {
- LogInfoHelper.WriteInfo(" Enter MessengerTokens.UpdateLayoutChange");
- if (TabContetMode == TabContetMode.QuoteChart)
- {
- if (this.SelectedQuoteGoods != null)
- {
- if (Content != null && Content.DataContext is IDisposable)
- {
- Content.InputBindings.Clear();
- (Content.DataContext as IDisposable).Dispose(); ////清除图表数据,注册消息
- if (Content is IDisposable)
- {
- (Content as IDisposable).Dispose();
- }
- }
- // var formchart = new FormChartView(new ChartWindowItem(string.Empty, this.SelectedQuoteGoods, CycleType.Minutes1));
- var formchart =
- new CChartView(new ChartWindowItem(string.Empty, this.SelectedQuoteGoods, CycleType.Minutes1));
- Content = formchart;
- }
- }
- });
- ////显示历史Tik分笔
- MessengerHelper.DefaultRegister<QuoteGoods>(this, MessengerTokens.ShowTikDetail, (goods) =>
- {
- if (TabContetMode != TabContetMode.QuoteChart)
- {
- TabContetMode = TabContetMode.QuoteChart;
- }
- var quoteTik =new QuoteTikDetailView(goods);
- Content = quoteTik;
- });
- ////显示挂牌报价大厅
- MessengerHelper.DefaultRegister<ListingDeliveryGoods>(this, MessengerTokens.ShowListingBoard, (goods) =>
- {
- if (TabContetMode != TabContetMode.ListingBoard)
- {
- TabContetMode = TabContetMode.ListingBoard;
- }
- else
- {
- var board = new ListingApplyBoard(goods);
- Content = board;
- }
- });
- MessengerHelper.QuoteRegister<List<QuoteGoods>>(this, MessengerTokens.ReceiveRealTimeQuote, (quoteList) =>
- {
- //更新账户浮动盈亏
- FloatPLExpressions.UpdateAccountTotalFloatPL();
- });
- MessengerHelper.DefaultRegister<TradeAccount>(this, MessengerTokens.UpdateAccountFloatPL, (e) =>
- {
- //更新账户浮动盈亏
- FloatPLExpressions.UpdateAccountTotalFloatPL();
- });
- //调用MOPosition,初始化持仓汇总MOHoldSummaryViewModel, 以便接收头寸变更通知更新持仓汇总缓存
- var vm = ViewModelLocator.MOProsition;
- }
-
- private FrameworkElement _contentElement;
- /// <summary>
- /// 显示内容
- /// </summary>
- public FrameworkElement Content
- {
- get { return _contentElement; }
- set { Set(() => Content, ref _contentElement, value); }
- }
- private UIElement _GoodsInfoContentElement;
- /// <summary>
- /// 显示内容
- /// </summary>
- public UIElement GoodsInfoContent
- {
- get { return _GoodsInfoContentElement; }
- set { Set(() => GoodsInfoContent, ref _GoodsInfoContentElement, value); }
- }
- private UIElement _historyCmContentElement;
- /// <summary>
- /// 五档历史内容
- /// </summary>
- public UIElement HistoryCmContent
- {
- get { return _historyCmContentElement; }
- set { Set(() => HistoryCmContent, ref _historyCmContentElement, value); }
- }
- private TabContetMode _tabContetMode;
- /// <summary>
- /// 当前选择的类型
- /// </summary>
- public TabContetMode TabContetMode
- {
- get { return _tabContetMode; }
- set
- {
- if ((int)value == -1) return;
- ////F10弹窗显示 -- 嵌入显示则注释以下代码
- if (value == TabContetMode.QuoteGoodsInfo)
- {
- MessengerHelper.DefaultSend<TabContetMode>(TabContetMode.QuoteGoodsInfo, MessengerTokens.ChangeGoodsInfo);
- return;
- }
- if (value != _tabContetMode)
- {
- SetSelectTabItem(value);
- }
- Set(() => TabContetMode, ref _tabContetMode, value);
- UserManager.QuotationWindowType = _tabContetMode;
- }
- }
- #region 是否显示行情报价面板
- private Visibility _isVisibilityQuoteBorad = Visibility.Visible;
- /// <summary>
- /// 是否显示行情报价面板
- /// </summary>
- public Visibility IsVisibilityQuoteBorad
- {
- get
- {
- return _isVisibilityQuoteBorad;
- }
- set
- {
- Set(() => IsVisibilityQuoteBorad, ref _isVisibilityQuoteBorad, value);
- }
- }
- #endregion
- #region 是否显示K线图面板
- private Visibility _isVisibilityKline = Visibility.Collapsed;
- /// <summary>
- /// 是否显示K线图面板
- /// </summary>
- public Visibility IsVisibilityKline
- {
- get
- {
- return _isVisibilityKline;
- }
- set
- {
- Set(() => IsVisibilityKline, ref _isVisibilityKline, value);
- }
- }
- #endregion
- #region 是否显示F10面板
- private Visibility _isVisibilityFten = Visibility.Collapsed;
- /// <summary>
- /// 是否显示F10面板
- /// </summary>
- public Visibility IsVisibilityFten
- {
- get
- {
- return _isVisibilityFten;
- }
- set
- {
- Set(() => IsVisibilityFten, ref _isVisibilityFten, value);
- }
- }
- #endregion
- #region 是否显示历史五档内容
- private Visibility _isVisibilityHistoryCommissions = Visibility.Collapsed;
- /// <summary>
- /// 是否显示历史五档内容
- /// </summary>
- public Visibility IsVisibilityHistoryCommissions
- {
- get
- {
- return _isVisibilityHistoryCommissions;
- }
- set
- {
- Set(() => IsVisibilityHistoryCommissions, ref _isVisibilityHistoryCommissions, value);
- }
- }
- #endregion
- #region 是否显示历史五档按钮
- private Visibility _isVisHistoryCommissionsBtn = Visibility.Collapsed;
- /// <summary>
- ///是否显示历史五档按钮
- /// </summary>
- public Visibility IsVisHistoryCommissionsBtn
- {
- get
- {
- return _isVisHistoryCommissionsBtn;
- }
- set
- {
- Set(() => IsVisHistoryCommissionsBtn, ref _isVisHistoryCommissionsBtn, value);
- }
- }
- #endregion
- #region 是否显示大字报价
- private bool _isShowQuoteBoard;
- /// <summary>
- /// 是否显示大字报价
- /// </summary>
- public bool IsShowQuoteBoard
- {
- get
- {
- var result = ApplicationParameter.IsShowQuoteBoard == 1 && UserManager.IsAccountLogin; //(游客登录不显示大字报价牌); ///是否显示报价牌
- if (this._currentGroup == null)
- {
- return result;
- }
- else
- {
- switch (_currentGroup.TradeMode)
- {
- case eTradeMode.AllGoods:
- case eTradeMode.MySelected:
- case eTradeMode.TRADEMODE_MARKETMAKE:
- case eTradeMode.TRADEMODE_BIDDING:
- case eTradeMode.TRADEMODE_BIDDINGMARKETMAKE:
- break;
- case eTradeMode.TRADEMODE_SALE:
- case eTradeMode.Deposit:
- case eTradeMode.TRADEMODE_HANGTAG:
- //case eTradeMode.TRADEMODE_AUCTION:
- //case eTradeMode.TRADEMODE_MALL:
- result = false;
- break;
- default:
- break;
- }
- return result;
- }
- }
- }
- #endregion
-
- #region 是否显示商品资料
- private bool _isShowGoodsDetailInfo = false;
- /// <summary>
- /// 是否显示商品资料
- /// </summary>
- public bool IsShowGoodsDetailInfo
- {
- get
- {
- return _isShowGoodsDetailInfo;
- }
- set
- {
- Set(() => IsShowGoodsDetailInfo, ref _isShowGoodsDetailInfo, value);
- }
- }
- #endregion
- /// <summary>
- /// 打开F10
- /// </summary>
- private void ShowF10()
- {
- string exchHqCode = string.Empty, goodsCode = string.Empty;
- //F10嵌入显示
- //TabContetMode = TabContetMode.QuoteGoodsInfo;
- if (_currentGroup != null && _currentGroup.TradeMode == eTradeMode.TRADEMODE_HANGTAG)
- {
- var viewModel = SimpleIoc.Default.GetInstance<ListingDeliveryGoodsViewModel>();
- if (viewModel.CurrentGoods != null)
- {
- // exchHqCode = viewModel.CurrentGoods.ExchHqCode;
- goodsCode = viewModel.CurrentGoods.DeliveryGoodsCode;
- }
- }
- else
- {//F10弹窗显示
- if (this.SelectedQuoteGoods != null)
- {
- exchHqCode = SelectedQuoteGoods.ExchHqCode;
- goodsCode = SelectedQuoteGoods.GoodsCode;
- }
- }
- if (!string.IsNullOrEmpty(ApplicationParameter.FtenAddress))
- {
- DispatcherHelper.RunAsync(() =>
- {
- var reportView = new F10View(exchHqCode, goodsCode)
- {
- Owner = Application.Current.MainWindow
- };
- reportView.ShowDialog();
- });
- }
- }
-
- public QuoteGoods SelectedQuoteGoods { get; set; }
- /// <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 && quoteGoods.GoodsParameters != null)
- //{
- //todo:
- //if (goods.GoodsParameters.TradeMode == TradeModeType.BidGoods)
- //{
- // showChart = ApplicationParameter.ShowChart == 2; //设置竞价商品才显示图表
- //}
- // }
- //IsShowChart = ApplicationParameter.ShowChart == 1 || showChart;
- SelectedQuoteGoods = quoteGoods;
- if (!UserManager.IsAccountLogin) ////游客登录
- {
- return;
- }
-
- if (string.IsNullOrEmpty(ApplicationParameter.FtenAddress))
- {
- IsShowGoodsDetailInfo = false;
- }
- //Application.Current.Dispatcher.BeginInvoke(new Action(() =>
- //{
- // var tradeFunc =
- // UserManager.TradeFuncMenus.FirstOrDefault(
- // (item) => item.FuncMenuCode == (int) MenuCommandType.Sellout);
- // if (SelectedQuoteGoods != null &&tradeFunc != null )
- // {
- // if (SelectedQuoteGoods.GoodsParameters.MoneyMode == eMoneyMode.MONEYMODE_PAY )
- // {
- // var holders = UserManager.GetCacheOrders<HoldingOrder>();
- // tradeFunc.IsEnabled =
- // holders.Any((hold) => hold.GoodsId == goods.GoodsId && hold.Direction == Direction.Bid);
- // }
- // else
- // {
- // tradeFunc.IsEnabled = true;
- // }
- // }
- //}));
- //卖出
- }
- /// <summary>
- /// 选择商品组改变时
- /// </summary>
- /// <param name="goodsGroup"></param>
- private void SelectGoodsGrounpChange(MarketsInfoModel goodsGroup)
- {
- IsVisibilityQuoteBorad = Visibility.Visible;
- IsVisibilityKline = Visibility.Collapsed;
- IsVisibilityFten = Visibility.Collapsed;
- UserManager.CurrentGroupHasGoods = false;
- _currentGroup = goodsGroup;
- RaisePropertyChanged(() => IsShowQuoteBoard);
- ////当选择市场改变时从图表切换回到行情列表
- if (_tabContetMode == TabContetMode.QuoteChart || _tabContetMode == TabContetMode.QuoteGoodsInfo || _tabContetMode == TabContetMode.HistoryCommissions)
- {
- TabContetMode = TabContetMode.QuoteList;
-
- }
-
- if (!UserManager.IsAccountLogin) ////游客登录都是看有行情商品
- {
- IsShowChart = goodsGroup.TradeMode != eTradeMode.TRADEMODE_SALE;
- IsChartEnable = true;
- return;
- }
- #region 是否显示挂牌
- var instance = SimpleIoc.Default.GetInstance<TradeHeaderViewModel>();
- var isListingMarket = goodsGroup.TradeMode == eTradeMode.TRADEMODE_HANGTAG;
- instance.IsShowListing =isListingMarket;
- IsShowListingBoard = isListingMarket;
- #endregion
- var tradeFunc =
- UserManager.TradeFuncMenus.FirstOrDefault((item) => item.FuncMenuCode == MenuCommandType.Sellout.ToString());
- //卖出
- var saleFunc =
- UserManager.TradeFuncMenus.FirstOrDefault((item) => item.FuncMenuCode == MenuCommandType.SaleApply.ToString());
- //申购
- var buyFunc =
- UserManager.TradeFuncMenus.FirstOrDefault((item) => item.FuncMenuCode == MenuCommandType.BuyIn.ToString());
- //买入
- switch (goodsGroup.TradeMode)
- {
- case eTradeMode.Deposit:
- case eTradeMode.TRADEMODE_HANGTAG:
- IsShowChart = false;
- if (tradeFunc != null)
- {
- tradeFunc.IsEnabled = false;
- }
- if (buyFunc != null) //买入是否可用
- {
- buyFunc.IsEnabled = false;
- }
- IsShowGoodsDetailInfo = false;
- break;
- case eTradeMode.TRADEMODE_SALE:
-
- IsShowChart = false;
- if (tradeFunc != null)
- {
- tradeFunc.IsEnabled = false;
- }
- if (buyFunc != null) //买入是否可用
- {
- buyFunc.IsEnabled = false;
- }
- if (saleFunc != null)
- {
- var result = CacheManager.CacheGoodsBaseInfos != null && CacheManager.CacheGoodsBaseInfos.Any(
- (item) =>
- goodsGroup.MarketID == item.GoodsParameters.SortId &&
- item.GoodsParameters.RunSteps == eRunStep.RUNSTEP_BIDDINGCONTINUOUS);
- saleFunc.IsEnabled = result;
- UserManager.CurrentGroupHasGoods = result;
- }
- break;
- case eTradeMode.MySelected:
- //自选不做特殊处理
- //IsShowChart = ApplicationParameter.ShowChart == 1;
-
- //var ifavoriteService = SimpleIoc.Default.GetInstance<IFavoriteService>();
- //var goodsList = ifavoriteService.GetMyFavoriteGoodses(goodsGroup.MarketID);
- //bool enable = false;
- //enable = goodsList != null && _goodsService.ConvertGoodsDtos(goodsList.ToList()).Any();
- //if (buyFunc != null) //买入是否可用
- //{
- // buyFunc.IsEnabled = enable;
- //}
- //if (tradeFunc != null)
- //{
- // tradeFunc.IsEnabled = enable;
- //}
- //IsChartEnable = enable; ////当前商品组没有商品,不可点图表。
- //UserManager.CurrentGroupHasGoods = enable;
- //break;
- default:
-
- IsShowChart = ApplicationParameter.ShowChart == 1;
- //var goodsarr = _goodsService.GetQuoteGoodsDTOList(MenuCommandType.MarketQuote, goodsGroup);
- //var isHasGoods = CacheManager.CacheGoodsBaseInfos != null &&goodsarr!=null&&goodsarr.Any(); //当前商品组无商品时是否可买入
- var isHasGoods = CacheManager.CacheGoodsBaseInfos != null && CacheManager.CacheGoodsBaseInfos.Any();
- if (tradeFunc != null)
- {
- tradeFunc.IsEnabled = isHasGoods;
- if (buyFunc != null) //买入是否可用
- {
- buyFunc.IsEnabled = isHasGoods;
- }
- }
- if (saleFunc != null)
- {
- saleFunc.IsEnabled = false;
- }
- IsChartEnable = isHasGoods; ////当前商品组没有商品,不可点图表。
- UserManager.CurrentGroupHasGoods = isHasGoods;
- break;
- }
- }
- /// <summary>
- /// Sets the select tab item.
- /// </summary>
- /// <param name="tabContetMode">The tab contet mode.</param>
- private void SetSelectTabItem(TabContetMode tabContetMode)
- {
- ////先发送RadioButton激活通知
- MessengerHelper.DefaultSend(tabContetMode, MessengerTokens.ActiveMainRadio);
- if (Content != null && Content.DataContext is IDisposable)
- {
- Content.InputBindings.Clear();
- (Content.DataContext as IDisposable).Dispose(); ////清除图表数据,注册消息
- }
- #region 顶部买卖按钮与挂牌无关
- //switch (tabContetMode)
- //{
- // case TabContetMode.QuoteList:
- // case TabContetMode.QuoteGoodsInfo:
- // case TabContetMode.QuoteBoard:
- // case TabContetMode.QuoteChart:
- // MessengerHelper.DefaultSend<bool>(true, MessengerTokens.IsShowSellCommondBtn);
- // MessengerHelper.DefaultSend<bool>(true, MessengerTokens.IsShowBuyCommondBtn);
- // CacheManager.IsHasListingData = true;
- // MessengerHelper.DefaultSend<bool>(true, MessengerTokens.IsEnableBuyAndSellCommondBtn);
- // break;
- //}
- #endregion
- switch (tabContetMode)
- {
- case TabContetMode.QuoteList:
- CacheManager.FromType = eOrderFormType.Commom;
- //切换到系统默认的报价牌
- //UserManager.QuotationWindowType = QuotationWindowType.List;
- //WindowHelper.OpenDefaultQuoteListView(false);
- IsVisibilityQuoteBorad = Visibility.Visible;
- IsVisibilityKline = Visibility.Collapsed;
- IsVisibilityFten = Visibility.Collapsed;
- IsVisHistoryCommissionsBtn=IsVisibilityHistoryCommissions = Visibility.Collapsed;
- MessengerHelper.DefaultSend<QuotationWindowType>(QuotationWindowType.List, MessengerTokens.ChangeQuote);
- break;
- #region cancel
- //case TabContetMode.QuoteList:
- // //切换到光标选中的(当前)商品合约K线
- // // ExecuteCommand(new SysMenuItem(MenuNames.AnalysisCandlestick, MenuCommandType.CandleChart));
- // //k线图因为没有执行树形控件的记录当前市场的方法,所以要手动记录当前市场
- // MessengerHelper.DefaultSend<MenuCommandType>(MenuCommandType.CandleChart,
- // MessengerTokens.UpdateCurrentMarketType);
- // break;
- //case 2:
- // //切换到光标选中的(当前)商品合约分时
- // // ExecuteCommand(new SysMenuItem(MenuNames.AnalysisTimeSharing, MenuCommandType.TimeSharingChart));
- // break;
- //case 3:
- // //切换到光标选中的(当前)商品合约实时
- // // ExecuteCommand(new SysMenuItem(MenuNames.AnalysisTik, MenuCommandType.TikChart));
- // break;
- #endregion
- case TabContetMode.QuoteGoodsInfo:
- CacheManager.FromType = eOrderFormType.Commom;
- //切换到F10基本资料
- ShowF10();
- IsVisibilityFten = Visibility.Visible;
- IsVisibilityQuoteBorad = Visibility.Collapsed;
- IsVisibilityKline = Visibility.Collapsed;
- IsVisHistoryCommissionsBtn=IsVisibilityHistoryCommissions = Visibility.Collapsed;
- break;
- #region cancel
- //case 5:
- // //切换到新闻资讯
- // var newsCategory = CacheManager.CacheNewsCategory;
- // if (newsCategory != null && newsCategory.Any())
- // {
- // var first = newsCategory.FirstOrDefault();
- // if (first == null || string.IsNullOrWhiteSpace(first.ClassCode)) return;
- // WindowHelper.OpenNewsWindow(first.ClassCode);
- // }
- // break;
- //case 6:
- // //切换到经济数据
- // break;
- //case 8:
- // MessengerHelper.DefaultSend(TradeTreeMenu.MyInvestmentContract,
- // MessengerTokens.AccountFunction);
- // //MessengerHelper.DefaultSend<WindowType>(WindowType.QueryFinacing,
- // // MessengerTokens.ActiveHomeTab);
- // break;
- #endregion
- case TabContetMode.QuoteBoard:
- CacheManager.FromType = eOrderFormType.Commom;
- //大字报价牌
- IsVisibilityQuoteBorad = Visibility.Visible;
- IsVisibilityKline = Visibility.Collapsed;
- IsVisibilityFten = Visibility.Collapsed;
- IsVisHistoryCommissionsBtn = IsVisibilityHistoryCommissions = Visibility.Collapsed;
- MessengerHelper.DefaultSend<QuotationWindowType>(QuotationWindowType.Board, MessengerTokens.ChangeQuote);
- break;
- case TabContetMode.QuoteChart:
- CacheManager.FromType = eOrderFormType.Commom;
- IsVisibilityQuoteBorad = Visibility.Collapsed;
- IsVisibilityFten = Visibility.Collapsed;
- IsVisHistoryCommissionsBtn = IsVisibilityHistoryCommissions = Visibility.Collapsed;
- IsVisibilityKline = Visibility.Visible;
- //图表
- // MessengerHelper.DefaultSend<QuotationWindowType>(QuotationWindowType.Board, MessengerTokens.);
- if (this.SelectedQuoteGoods != null)
- {
- // var formchart = new FormChartView(new ChartWindowItem(string.Empty, this.SelectedQuoteGoods, CycleType.Minutes1));
- var formchart = new CChartView(new ChartWindowItem(string.Empty, this.SelectedQuoteGoods, CycleType.Minutes1));
- Content = formchart;
- }
- break;
- case TabContetMode.ListingBoard:
- CacheManager.FromType = eOrderFormType.Commom;
- IsVisibilityQuoteBorad = Visibility.Collapsed;
- IsVisibilityFten = Visibility.Collapsed;
- IsVisHistoryCommissionsBtn = IsVisibilityHistoryCommissions = Visibility.Collapsed;
- IsVisibilityKline = Visibility.Visible;
- //图表
- // MessengerHelper.DefaultSend<QuotationWindowType>(QuotationWindowType.Board, MessengerTokens.);
- var viewModel = SimpleIoc.Default.GetInstance<ListingDeliveryGoodsViewModel>();
- if (viewModel.CurrentGoods != null)
- {
- var board = new ListingApplyBoard(viewModel.CurrentGoods);
- Content = board;
- }
- break;
- //历史五档
- case TabContetMode.HistoryCommissions:
- CacheManager.FromType = eOrderFormType.Commom;
- IsVisibilityQuoteBorad = Visibility.Collapsed;
- IsVisibilityFten = Visibility.Collapsed;
- IsVisibilityKline = Visibility.Collapsed;
- IsVisHistoryCommissionsBtn = IsVisibilityHistoryCommissions = Visibility.Visible;
- var viewHistoryCommissionsListModel = SimpleIoc.Default.GetInstance<HistoryCommissionsListViewModel>();
- if (viewHistoryCommissionsListModel != null)
- {
- var HistoryCommissionsContent = new HistoryCommissionsList(viewHistoryCommissionsListModel);
- HistoryCmContent = HistoryCommissionsContent;
- if (parameters != null)
- {
- MessengerHelper.DefaultSend<SearchCommissionsParameter>(parameters, MessengerTokens.HistoryCommissions);
- }
-
- }
- break;
- }
- }
-
- private bool _isShowChart = true;
- /// <summary>
- /// 是否显示图表
- /// </summary>
- public bool IsShowChart
- {
- get { return _isShowChart; }
- set { Set(() => IsShowChart, ref _isShowChart, value); }
- }
- private bool _isChartEnabled;
- private bool _isShowListingBoard;
- /// <summary>
- /// 是否显示报价大厅
- /// </summary>
- public bool IsShowListingBoard
- {
- get { return _isShowListingBoard; }
- set { Set(() => IsShowListingBoard, ref _isShowListingBoard, value); }
- }
-
- /// <summary>
- /// 是否可用
- /// </summary>
- public bool IsChartEnable
- {
- get { return _isChartEnabled; }
- set { Set(() => IsChartEnable, ref _isChartEnabled, value); }
- }
- /// <summary>
- /// 交易登录后在初始化的内容
- /// </summary>
- public void InitMainPanel()
- {
- IsShowChart = ApplicationParameter.ShowChart == 1;
- }
- }
- }
|