Example #1
0
        /// <summary>
        /// 创建套利单控件。
        /// </summary>
        /// <param name="arbitrageOrder"></param>
        /// <returns></returns>
        private ArbitrageOrderControl CreateArbitrageOrderControl(AutoTrader autoTrader)
        {
            ArbitrageOrderControl orderItemControl = new ArbitrageOrderControl(autoTrader);

            orderItemControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            orderItemControl.Dock        = System.Windows.Forms.DockStyle.Top;
            orderItemControl.Location    = new System.Drawing.Point(0, 0);
            orderItemControl.Name        = "arbitrageItemControl1";
            orderItemControl.Size        = new System.Drawing.Size(836, 153);
            orderItemControl.TabIndex    = 0;

            orderItemControl.Initialize();

            return(orderItemControl);
        }
Example #2
0
        /// <summary>
        /// 新增套利单控件。
        /// </summary>
        /// <param name="autoTrader"></param>
        private void AddArbitrageOrderControl(AutoTrader autoTrader)
        {
            if (ExistArbitrageOrderControl(autoTrader.TraderIdentify) == false)
            {
                ArbitrageOrderControl orderControl = CreateArbitrageOrderControl(autoTrader);

                this.panelOrderContainer.Controls.Add(orderControl);
                m_orderControlList.Add(orderControl);
                orderControl.Initialize();
            }
            else
            {
                Debug.Assert(false);
            }
        }
Example #3
0
        /// <summary>
        /// 移除套利单控件。
        /// </summary>
        /// <param name="traderIdentity"></param>
        private void RemoveArbitrageOrderControl(Guid traderIdentity)
        {
            ArbitrageOrderControl arbitrageOrderControl = null;

            foreach (ArbitrageOrderControl orderControl in m_orderControlList)
            {
                if (orderControl.TraderIdentify == traderIdentity)
                {
                    arbitrageOrderControl = orderControl;
                    break;
                }
            }

            Debug.Assert(arbitrageOrderControl != null);
            if (arbitrageOrderControl != null)
            {
                arbitrageOrderControl.Stop();
                this.panelOrderContainer.Controls.Remove(arbitrageOrderControl);
                m_orderControlList.Remove(arbitrageOrderControl);

                arbitrageOrderControl.Dispose();
            }
        }