Ejemplo n.º 1
0
 protected override void OnThreadUpdate()
 {
     if (IsUpdating || !Exchange.IsInitialized)
     {
         return;
     }
     IsUpdating = true;
     try {
         if (!Exchange.SupportWebSocket(WebSocketType.Tickers))
         {
             Exchange.UpdateTickersInfo();
         }
         DataCacheManager.UpdateTasks();
         for (int i = 0; i < Exchange.Tickers.Count; i++)
         {
             Exchange.Tickers[i].UpdateTrailings();
         }
     }
     finally {
         IsUpdating = false;
     }
     if (IsHandleCreated)
     {
         BeginInvoke(new Action(() => {
             UpdateConnectionStatus();
             UpdateCachedDataCountInfo();
             if (!Exchange.SupportWebSocket(WebSocketType.Tickers))
             {
                 this.gvTikers.RefreshData();
             }
         }));
     }
 }
Ejemplo n.º 2
0
 protected override void OnShown(EventArgs e)
 {
     base.OnShown(e);
     Exchange.Connect();
     InitializeBaseCurrencies();
     UpdateTickersAccordingBaseCurrency();
     HasShown = true;
     UpdateSelectedTickersFromExchange();
     if (!Exchange.SupportWebSocket(WebSocketType.Tickers))
     {
         SetInfoConnected();
     }
     else
     {
         Exchange.TickerChanged += OnWebSocketTickerUpdate;
         Exchange.TickersUpdate += OnWebSocketTickersUpdate;
         SubscribeWebSocket();
     }
 }