Пример #1
0
 /// <summary>
 /// вызывается окном через MainForm.Instance
 /// при открытии окна (счет, профит...) для текущей вкладки добавляется запись этого окошка
 /// </summary>
 public void AddNonChartWindowSets(NonChartWindowSettings wndSets)
 {
     wndSets.ChartTab = bookmarkStrip.SelectedBookmark.Id;
     if (!nonChartWindows.Any(wnd => wnd.ChartTab == wndSets.ChartTab && wnd.Window == wndSets.Window))
     {
         nonChartWindows.Add(wndSets);
     }
 }
Пример #2
0
        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;
        }