示例#1
0
        public SymbolDataWriter(CQGConnector connector, string userName, int standardDepth, bool useMoreInfo)
        {
            _userName = userName;
            _isMoreInfo = useMoreInfo;
            _standardDepth = standardDepth;

            _allowedSymbols.Clear();

            if (connector == null)
            {
                throw new Exception("Not initialized CQG connector attached.");
            }
            _symbolsTable = new Dictionary<string, SymbolData>();
            _tickTable = new Dictionary<string, TickData>();
            _cel = connector.ICEL;

            connector.addIncorrectSymbolListener(CEL_IncorrectSymbol);
            connector.addInstrumentSubscribedListener(CEL_InstrumentSubscribed);
            connector.addInstrumentChanged(CQG_InstrumentChanged);
            connector.addInstrumentDOMChangedListene(CEL_InstrumentDOMChanged);
            connector.addStartedListener(CEL_CELStarted);

            _addSybolsList = new Dictionary<string, Control>();
        }
示例#2
0
        public SymbolDataWriter(CQGConnector connector, string userName, int standardDepth, bool useMoreInfo)
        {
            _userName      = userName;
            _isMoreInfo    = useMoreInfo;
            _standardDepth = standardDepth;

            _allowedSymbols.Clear();

            if (connector == null)
            {
                throw new Exception("Not initialized CQG connector attached.");
            }
            _symbolsTable = new Dictionary <string, SymbolData>();
            _tickTable    = new Dictionary <string, TickData>();
            _cel          = connector.ICEL;

            connector.addIncorrectSymbolListener(CEL_IncorrectSymbol);
            connector.addInstrumentSubscribedListener(CEL_InstrumentSubscribed);
            connector.addInstrumentChanged(CQG_InstrumentChanged);
            connector.addInstrumentDOMChangedListene(CEL_InstrumentDOMChanged);
            connector.addStartedListener(CEL_CELStarted);

            _addSybolsList = new Dictionary <string, Control>();
        }
示例#3
0
        private void StartCollect(List<string> symbols, bool isGroup, int groupID)
        {
            ui_componentList.HorizontalScroll.Visible = true;
            if (symbols.Count == 0) return;

            ui_buttonX_localConnect.Enabled = false;
            ui_buttonX_shareConnect.Enabled = false;

            TickNetClientDataManager.MaxQueueSize = (int)ui_SQL_PacketSize.Value;
            TickNetClientDataManager.MaxBufferSize = (int)ui_BufferSizeValue.Value;

            ui_componentList.ColumnCount = 1;
            ui_componentList.AutoSize = true;
            ui_componentList.AutoSizeMode = AutoSizeMode.GrowOnly;
            ui_componentList.AutoScroll = true;
            //
            ui_componentList.MaximumSize = ui_componentList.Size;

            _connector = new CQGConnector();

            _connector.addDataConnectionStatusChangedListener(CEL_DataConnectionStatusChanged);

            _sdr = new SymbolDataWriter(_connector, _client.UserName)
            {

                IsMi = cbUsMI.Checked,
                Depth = (int)ui_nudDOMDepth.Value
            };

            for (var i = 0; i < symbols.Count; i++)
            {
                var container = new Panel
                {
                    BorderStyle = BorderStyle.FixedSingle,
                    Size = new Size(370, 45),
                    AutoSize = false
                };

                var symbolDescription = new Label
                {
                    Text = symbols[i],
                    Location = new Point(20, 4),
                    Size = new Size(100, 20),
                    Dock = DockStyle.None
                };
                container.Controls.Add(symbolDescription);

                var btnCancel = new ButtonX
                {
                    Text = @"cancel",
                    Location = new Point(200, 4),
                    Size = new Size(70, 20),
                    Dock = DockStyle.None,
                    AutoSize = false,
                    Style = ui_collect_buttonX_start.Style
                };
                btnCancel.Click += btnCommandExec;
                container.Controls.Add(btnCancel);

                var btnStop = new ButtonX
                {
                    Text = @"stop",
                    Location = new Point(290, 4),
                    Size = new Size(70, 20),
                    Dock = DockStyle.None,
                    AutoSize = false,
                    Style = ui_collect_buttonX_start.Style
                };
                btnStop.Click += btnCommandExec;
                container.Controls.Add(btnStop);

                var mDesc = new Label
                {
                    Text = @"Status: ",
                    Location = new Point(5, 24),
                    Size = new Size(50, 20),
                    Dock = DockStyle.None
                };
                container.Controls.Add(mDesc);

                var message = new LabelX
                {
                    Text = @"Waiting for processing...",
                    Size = new Size(295, 17),
                    Location = new Point(55, 24),
                    AutoSize = false,
                    Dock = DockStyle.None,
                    PaddingLeft = 5
                };
                message.BackgroundStyle.BorderLeft = eStyleBorderType.Solid;
                message.BackgroundStyle.BorderLeftColor = Color.Gray;
                message.BackgroundStyle.BorderLeftWidth = 3;

                message.MouseMove += labelMessage_MouseMove;

                container.Controls.Add(message);

                ui_componentList.RowCount = i;
                ui_componentList.Controls.Add(container, 0, ui_componentList.RowCount);

                _sdr.AddSymbol(symbols[i], message);
            }
            if (TickNetClientDataManager.CurrentDbIsShared)
            {
                _sdr.SymbolSubscribed += CollectRequest;
            }
            _connector.ICEL.Startup();

            ui_collect_buttonX_start.Enabled =
                ui_collect_buttonX_startGroup.Enabled =
                ui_listBox_symbols.Enabled =
                ui_listBox_groups.Enabled = false;
            ui_collect_buttonX_stop.Enabled = true;
        }