public void EnsureStatisticsWindow(bool instantCalculation = false) { foreach (var form in MdiChildren.Where(form => form is AccountTradeResultsForm)) { form.Focus(); return; } var child = new AccountTradeResultsForm { InstantCalculation = instantCalculation }; SetupNonMdiForm(child); child.Show(); }
private void EnsureShowAndPlaceNonChartWindow(NonChartWindowSettings wndSets) { var wnd = MdiChildren.FirstOrDefault(c => c is IMdiNonChartWindow && ((IMdiNonChartWindow)c).WindowCode == wndSets.Window); if (wnd == null) { // создать окно if (wndSets.Window == NonChartWindowSettings.WindowCode.Account) { wnd = new AccountMonitorForm { MdiParent = this } } ; else if (wndSets.Window == NonChartWindowSettings.WindowCode.RobotTest) { wnd = new RoboTesterForm(); ((RoboTesterForm)wnd).OnRobotResultsBoundToCharts += OnRobotResultsBoundToCharts; } else if (wndSets.Window == NonChartWindowSettings.WindowCode.Profit) { wnd = new AccountTradeResultsForm { InstantCalculation = false } } ; else if (wndSets.Window == NonChartWindowSettings.WindowCode.Chat) { wnd = new ChatForm(); } else if (wndSets.Window == NonChartWindowSettings.WindowCode.Quotes) { wnd = new QuoteTableForm(); } else if (wndSets.Window == NonChartWindowSettings.WindowCode.Subscription) { wnd = new SubscriptionForm(); } else if (wndSets.Window == NonChartWindowSettings.WindowCode.WebBrowser) { wnd = new BrowserForm(); } else if (wndSets.Window == NonChartWindowSettings.WindowCode.RiskForm) { wnd = new RiskSetupForm(); } else if (wndSets.Window == NonChartWindowSettings.WindowCode.WalletForm) { wnd = new WalletForm(); } SetupNonMdiForm((IMdiNonChartWindow)wnd); wnd.Show(); } else { wnd.Focus(); } // установить окну положенные размеры wnd.Location = wndSets.WindowPos; wnd.Size = wndSets.WindowSize; wnd.WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), wndSets.WindowState); ((IMdiNonChartWindow)wnd).WindowInnerTabPageIndex = wndSets.CurrentTabIndex; }