Пример #1
0
        void Form1_OnTick(Form1.Tick tick)
        {
            if (this.InvokeRequired)
            {
                // Execute the same method, but this time on the GUI thread
                this.BeginInvoke(new TickReceived(Form1_OnTick), tick);

                // we return immedeately
                return;
            }



            // A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
            //Additional information: Cross-thread operation not valid: Control 'cboSymbols' accessed from a thread other than the thread it was created on.
            // Control.CheckForIllegalCrossThreadCalls Property == false will fix
            //'TheContainer.TheForm.cboSymbols.SelectedItem' threw an exception of type 'System.InvalidOperationException'
            if ((string)TheContainer.TheForm.cboSymbols.SelectedItem == tick.symbol)
            {
                // Only 1 Chart -- Is tick Match
                // Log(tick.Bid)
                // arrays #, datasource string
                Log(tick.bid.ToString());
                chart1.Update();
                chart1.DataBind();
            }
        }
Пример #2
0
        void Form1_OnTick(Form1.Tick tick)
        {
            if (this.InvokeRequired)
            {
                // Execute the same method, but this time on the GUI thread
                this.BeginInvoke(new TickReceived(Form1_OnTick), tick);

                // we return immedeately
                return;
            }

            if ("USDCHF" == tick.symbol)
            {
                USDCHFbid.Text  = (tick.bid.ToString());
                USDCHFask.Text  = (tick.ask.ToString());
                USDCHFgbox.Text = "USDCHF [" + (tick.date.ToString()) + "]";
            }
            if ("GBPUSD" == tick.symbol)
            {
                GBPUSDbid.Text  = (tick.bid.ToString());
                GBPUSDask.Text  = (tick.ask.ToString());
                GBPUSDgbox.Text = "GBPUSD [" + (tick.date.ToString()) + "]";
            }
            if ("EURUSD" == tick.symbol)
            {
                EURUSDbid.Text  = (tick.bid.ToString());
                EURUSDask.Text  = (tick.ask.ToString());
                EURUSDgbox.Text = "EURUSD [" + (tick.date.ToString()) + "]";
            }
            if ("USDJPY" == tick.symbol)
            {
                USDJPYbid.Text = (tick.bid.ToString());
                USDJPYask.Text = (tick.ask.ToString());
            }
            if ("USDCAD" == tick.symbol)
            {
                USDCADbid.Text = (tick.bid.ToString());
                USDCADask.Text = (tick.ask.ToString());
            }
            if ("AUDUSD" == tick.symbol)
            {
                AUDUSDbid.Text = (tick.bid.ToString());
                AUDUSDask.Text = (tick.ask.ToString());
            }
            if ("EURAUD" == tick.symbol)
            {
                EURAUDbid.Text = (tick.bid.ToString());
                EURAUDask.Text = (tick.ask.ToString());
            }
            if ("EURCHF" == tick.symbol)
            {
                EURCHFbid.Text = (tick.bid.ToString());
                EURCHFask.Text = (tick.ask.ToString());
            }
            if ("EURJPY" == tick.symbol)
            {
                EURJPYbid.Text = (tick.bid.ToString());
                EURJPYask.Text = (tick.ask.ToString());
            }
            if ("GBPCHF" == tick.symbol)
            {
                GBPCHFbid.Text = (tick.bid.ToString());
                GBPCHFask.Text = (tick.ask.ToString());
            }
            if ("CADJPY" == tick.symbol)
            {
                CADJPYbid.Text = (tick.bid.ToString());
                CADJPYask.Text = (tick.ask.ToString());
            }
            if ("GBPJPY" == tick.symbol)
            {
                GBPJPYbid.Text = (tick.bid.ToString());
                GBPJPYask.Text = (tick.ask.ToString());
            }
            if ("AUDNZD" == tick.symbol)
            {
                AUDNZDbid.Text = (tick.bid.ToString());
                AUDNZDask.Text = (tick.ask.ToString());
            }
            if ("AUDCAD" == tick.symbol)
            {
                AUDCADbid.Text = (tick.bid.ToString());
                AUDCADask.Text = (tick.ask.ToString());
            }
            if ("AUDCHF" == tick.symbol)
            {
                AUDCHFbid.Text = (tick.bid.ToString());
                AUDCHFask.Text = (tick.ask.ToString());
            }
            if ("AUDJPY" == tick.symbol)
            {
                AUDJPYbid.Text = (tick.bid.ToString());
                AUDJPYask.Text = (tick.ask.ToString());
            }
            if ("CHFJPY" == tick.symbol)
            {
                CHFJPYbid.Text = (tick.bid.ToString());
                CHFJPYask.Text = (tick.ask.ToString());
            }
            if ("EURNZD" == tick.symbol)
            {
                EURNZDbid.Text = (tick.bid.ToString());
                EURNZDask.Text = (tick.ask.ToString());
            }
            if ("EURCAD" == tick.symbol)
            {
                EURCADbid.Text = (tick.bid.ToString());
                EURCADask.Text = (tick.ask.ToString());
            }
            if ("CADCHF" == tick.symbol)
            {
                CADCHFbid.Text = (tick.bid.ToString());
                CADCHFask.Text = (tick.ask.ToString());
            }
            if ("NZDJPY" == tick.symbol)
            {
                NZDJPYbid.Text = (tick.bid.ToString());
                NZDJPYask.Text = (tick.ask.ToString());
            }
            if ("NZDUSD" == tick.symbol)
            {
                NZDUSDbid.Text = (tick.bid.ToString());
                NZDUSDask.Text = (tick.ask.ToString());
            }
            if ("GOLD" == tick.symbol)
            {
                GOLDbid.Text = (tick.bid.ToString());
                GOLDask.Text = (tick.ask.ToString());
            }
        }