예제 #1
0
파일: FormMain.cs 프로젝트: ruslanlyalko/DA
        private void StopCollecting()
        {
            var symbols = new List<string>();
            bool canSendlog = false;
            if (_connector != null)
                _connector.CQG_Stop();
            if (_sdr != null)
            {
                symbols = _sdr.GetSymbols();
                canSendlog = true;
                _sdr.SymbolSubscribed -= CollectRequest;
                _sdr = null;
            }
            fg();

            if (TickNetClientDataManager.CurrentDbIsShared && symbols.Count > 0 && canSendlog && _normalizerStatus)
            {
                Task.Factory.StartNew(() => _dnormClientService.ServiceProxy.AllCollectFinished());
            }
        }
예제 #2
0
파일: FormMain.cs 프로젝트: ruslanlyalko/DA
        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;
        }