Exemple #1
0
        public void stopSubscribeChart(ChartQuotes receiver)
        {
            try
            {
                Subscription s_stocks = charts[receiver];

                client.unsubscribe(s_stocks);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception while subscribing: " + ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
        }
Exemple #2
0
        public void subscribeChart(string item, ChartQuotes receiver)
        {
            try
            {
                if (charts.ContainsKey(receiver))
                {
                    return;
                }

                // We subscribes it again because we don't want any
                // restriction to updates frequecy of the main subscription.

                Subscription s_stocks = new Subscription("MERGE");

                s_stocks.Fields = new string[3] {
                    "last_price", "time", "stock_name"
                };
                s_stocks.Items = new string[1] {
                    item
                };

                s_stocks.DataAdapter           = "QUOTE_ADAPTER";
                s_stocks.RequestedSnapshot     = "yes";
                s_stocks.RequestedMaxFrequency = "3.0";

                s_stocks.addListener(new ChartListener(">> ", receiver));

                charts.Add(receiver, s_stocks);

                client.subscribe(s_stocks);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception while subscribing: " + ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
        }
        private void dataGridview_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            ChartQuotes cq = new ChartQuotes("item" + (e.RowIndex + 1), dataGridview.Rows[e.RowIndex].Cells[0].Value.ToString(), stocklistClient);

            cq.Show();
        }
 public ChartListener(string prefix, ChartQuotes chartForm)
 {
     this.prefix        = prefix;
     this.chartForm     = chartForm;
     this.delegateChart = new LightstreamerChartUpdateDelegate(chartForm.OnLightstreamerUpdate);
 }