private void HandleQuery(Query query, Dictionary<String, Object> message)
        {
            if (message["type"].Equals("MESSAGE"))
            {
                Json = JsonConvert.SerializeObject(message["data"]);
            }

            if (query.isFinished) countdownLatch.Signal();
        }
Пример #2
0
        private static void HandleQuery(Query query, Dictionary<String,Object> message)
        {
            if(message["type"].Equals("MESSAGE"))
            {
                Console.WriteLine("Got data!");
                Console.WriteLine(JsonConvert.SerializeObject(message["data"]));
            }

            if (query.isFinished) countdownLatch.Signal();
            
        }
Пример #3
0
        private void HandleQuery(Query query, Dictionary<String, Object> message)
        {
            lblMarketCapStatus.SetThreadSafeProperty(() => lblMarketCapStatus.Text, "Refreshing market cap data...");
            picRefreshMarketCap.SetThreadSafeProperty(() => picRefreshMarketCap.Image, Properties.Resources.loading);

            try
            {
                if (message["type"].Equals("MESSAGE"))
                {
                    MarketCapitalization items = JsonConvert.DeserializeObject<MarketCapitalization>(JsonConvert.SerializeObject(message["data"]));

                    var ordered_results = items.Results.OrderBy(o => o.MarketCap).ToList();

                    foreach (Result item in ordered_results)
                        flpMarketCap.InvokeThreadSafeMethod(() => UpdateMarketCapControl(item));
                }
                if (query.isFinished) countdownLatch.Signal();
            }
            catch (Exception ex)
            {
                this.InvokeThreadSafeMethod(() => Notify.ShowMessage(this, Notify.MessageType.Error, "Error occurred while trying to get the market cap data: " + ex.Message));
            }

            flpMarketCap.InvokeThreadSafeMethod(() => flpMarketCap.Focus());
        }