| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Infrastructure.Enums;
- using Muchinfo.MTPClient.Infrastructure.MessengerArgs;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Reflection;
- using System.Windows;
- using System.Windows.Controls;
- namespace Muchinfo.MTPClient.UI.Utilities
- {
- public class WindowHelper
- {
- public const string restratCommand = "restart";
- /// <summary>
- /// 缓存窗口信息
- /// </summary>
- private static Dictionary<WindowType, UserControl> _windowsDictionary = new Dictionary<WindowType, UserControl>();
- #region Public Static Methods
- /// <summary>
- /// 添加内容窗口
- /// </summary>
- /// <param name="arg">The arg.</param>
- public static void OpenWindow(OpenWindowArg arg)
- {
- switch (arg.Type)
- {
- }
- }
- /// <summary>
- /// 打开新闻窗口
- /// </summary>
- /// <param name="categoryCode">The category code.</param>
- public static void OpenNewsWindow(string categoryCode, string newsId = "")
- {
- return;
- //var newsView = WindowHelper.GetWindow<NewsView>(WindowType.NewsView);
- //if (newsView == null)
- //{
- // var item = new NewsWindowItem(MenuNames.News, categoryCode, newsId);
- // var window = new NewsView(item);
- // window.ShowWindow();
- //}
- //else
- //{
- // newsView.NavigateTo(categoryCode, newsId);
- // newsView.ShowWindow();
- //}
- }
- /// <summary>
- /// 打开分析窗口
- /// </summary>
- /// <param name="arg">The arg.</param>
- public static void OpenQuoteChartWindow(OpenQuoteChartWindowArg arg)
- {
- return;
- //if (arg == null || arg.Goods == null) return;
- //var quoteChartView = GetWindow<FormChartView>(WindowType.QuoteChartView);
- //if (arg.CreateNew || quoteChartView == null)
- //{
- // var item = AnalysisWindowHelper.CreateQuoteChartWindowItem(arg.Goods, arg.CycleType);
- // if (ApplicationParameter.QuotationProxy == 1)
- // {
- // //报价牌放在分析图的位置,0-不显示,1-左边,2-右边
- // var window = new FormChartView(item)
- // {
- // //PriceCard = PriceCardHelper.GetPriceCard(arg.Goods),
- // //PriceCardPosition = 2
- // };
- // window.ShowWindow();
- // }
- // else
- // {
- // //报价牌放在分析图的位置,0-不显示,1-左边,2-右边
- // var window = new QuoteChartView(item)
- // {
- // PriceCard = PriceCardHelper.GetPriceCard(arg.Goods),
- // PriceCardPosition = 2
- // };
- // window.ShowWindow();
- // }
- //}
- ////else
- ////{
- //// quoteChartView.UpdateGoods(arg.Goods, arg.CycleType);
- //// quoteChartView.ShowWindow();
- ////}
- //MessengerHelper.DefaultSend<bool>(true, MessengerTokens.ShowChartMsg); ////显示图表
- //MessengerHelper.DefaultSend(TradeTreeMenu.AccountInfo, MessengerTokens.AccountFunction);
- ////激活Tab标签
- //MessengerHelper.DefaultSend<WindowType>(WindowType.QuoteChartView, MessengerTokens.ActiveHomeTab);
- }
- /// <summary>
- /// Shows the amount manager.
- /// </summary>
- /// <param name="applyType">Type of the apply.</param>
- public static void ShowAmountManager(FundsApplyType applyType)
- {
- return;
- //if (UserManager.CurrentTradeAccount == null)
- //{
- // MessageBoxHelper.ShowInfo(Client_Resource.UI2014_PleaseLogin, Muchinfo.MTPClient.Resources.Client_Resource.UI2014_LoginTips);
- //}
- //else
- //{
- // GalaSoft.MvvmLight.Threading.DispatcherHelper.RunAsync(() =>
- // {
- // var dialog = new AmountManagerView(applyType) { Owner = Application.Current.MainWindow };
- // dialog.ShowDialog();
- // });
- //}
- }
- /// <summary>
- /// 重新启动应用程序
- /// </summary>
- /// <param name="isRerun">是否重新启动程序</param>
- public static void RerunApplication(bool isRerun = true)
- {
- ////关闭CEF浏览器
- //CefRuntime.Shutdown();
- //CefSharp.CEF.Shutdown();
- var assembly = Assembly.GetEntryAssembly();
- if (isRerun) Process.Start(assembly.Location, restratCommand);
- if (Application.Current != null)
- {
- Environment.Exit(0);
- }
- }
- #endregion Public Static Methods
- }
- }
|