public RoboTesterForm() { InitializeComponent(); Localizer.LocalizeControl(this); controlButtonNameStart = Localizer.GetString("TitleLAUNCH"); controlButtonNameStop = Localizer.GetString("TitleAbort"); cbUseSelectedDate.Checked = UserSettings.Instance.UseTestPeriod; dtDateFrom.Value = UserSettings.Instance.TestPeriodFrom == DateTime.MinValue ? DateTime.Now.Date.AddYears(-1) : UserSettings.Instance.TestPeriodFrom; dtDateTo.Value = UserSettings.Instance.TestPeriodTo == DateTime.MinValue ? DateTime.Now: UserSettings.Instance.TestPeriodTo; cbLogTrace.Checked = UserSettings.Instance.SaveLog; worker.WorkerSupportsCancellation = true; worker.DoWork += WorkerDoWork; worker.RunWorkerCompleted += WorkerRunWorkerCompleted; worker.WorkerReportsProgress = true; InitContextAccountSettings(); Instance = this; // запомнить окошко MainForm.Instance.AddNonChartWindowSets(new NonChartWindowSettings { Window = WindowCode, WindowPos = Location, WindowSize = Size, WindowState = WindowState.ToString() }); }
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; }