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"; /// /// 缓存窗口信息 /// private static Dictionary _windowsDictionary = new Dictionary(); #region Public Static Methods /// /// 添加内容窗口 /// /// The arg. public static void OpenWindow(OpenWindowArg arg) { switch (arg.Type) { } } /// /// 打开新闻窗口 /// /// The category code. public static void OpenNewsWindow(string categoryCode, string newsId = "") { return; //var newsView = WindowHelper.GetWindow(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(); //} } /// /// 打开分析窗口 /// /// The arg. public static void OpenQuoteChartWindow(OpenQuoteChartWindowArg arg) { return; //if (arg == null || arg.Goods == null) return; //var quoteChartView = GetWindow(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(true, MessengerTokens.ShowChartMsg); ////显示图表 //MessengerHelper.DefaultSend(TradeTreeMenu.AccountInfo, MessengerTokens.AccountFunction); ////激活Tab标签 //MessengerHelper.DefaultSend(WindowType.QuoteChartView, MessengerTokens.ActiveHomeTab); } /// /// Shows the amount manager. /// /// Type of the apply. 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(); // }); //} } /// /// 重新启动应用程序 /// /// 是否重新启动程序 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 } }