Пример #1
0
 void OnTickerChanged(Ticker prev)
 {
     if (prev != null)
     {
         prev.IsOpened = false;
         prev.OrderBook.SubscribeUpdateEntries(false);
         ClearText();
         ClearGrid();
         ClearChart();
         UnsubscribeEvents(prev);
         prev.StopListenTickerStream();
     }
     UpdateTickerInfoBar();
     this.myTradesCollectionControl1.Ticker       = Ticker;
     this.activeTrailingCollectionControl1.Ticker = Ticker;
     this.buySettingsControl.Ticker = Ticker;
     if (Ticker == null)
     {
         return;
     }
     Ticker.OrderBook.SubscribeUpdateEntries(true);
     Icon             = CurrencyLogoProvider.GetFormIcon(Ticker.MarketCurrency);
     this.rpMain.Text = Ticker.Name;
     Ticker.IsOpened  = true;
     UpdateText();
     UpdateGrid();
     UpdateChart();
     UpdateDockPanels();
     UpdateBuySellSettings();
     SubscribeEvents();
     Ticker.UpdateBalance(Ticker.MarketCurrency);
     Ticker.StartListenTickerStream();
 }
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            //try {
            //    if(System.IO.File.Exists("TickerFormWorkspaceDefault.xml")) {
            //        if(this.workspaceManager1.LoadWorkspace("TickerFormDefault", "TickerFormWorkspaceDefault.xml")) {
            //            //this.workspaceManager1.ApplyWorkspace("TickerFormDefault");
            //            //UpdateDockPanels();
            //        }
            //    }
            //}
            //catch(Exception ee) {
            //    Telemetry.Default.TrackException(ee);
            //}
            if (Ticker == null)
            {
                return;
            }
            Icon             = CurrencyLogoProvider.GetFormIcon(Ticker.MarketCurrency);
            this.rpMain.Text = Ticker.Name;

            ThreadManager manager = new ThreadManager();

            manager.OwnerControl = this.gcTrades;
            Ticker.AccountShortTradeHistory.ThreadManager = manager;
            Ticker.ShortTradeHistory.ThreadManager        = manager;
            Ticker.OrderBook.SubscribeUpdateEntries(true);
            Ticker.IsOpened = true;
            UpdateText();
            UpdateGrid();
            UpdateChart();
            UpdateDockPanels();
            UpdateBuySellSettings();
            UpdateBalances();
            UpdateTrades();
            UpdateAccountTrades();

            Ticker.StartListenTickerStream();
            SubscribeEvents();
        }