Ejemplo n.º 1
0
        private void ShowSocialFlyout()
        {
            var socialScreenBounds = biTwitter.Links[0].ScreenBounds;

            socialScreenBounds.Width += biGitHub.Links[0].ScreenBounds.Width;

            var flyout = new DevExpress.Utils.FlyoutPanel {
                OwnerControl = this
            };

            flyout.Controls.Add(beakPanel);
            flyout.Size    = beakPanel.Size;
            beakPanel.Dock = DockStyle.Fill;
            flyout.OptionsBeakPanel.BorderColor = Color.FromArgb(214, 255, 241);
            labelControl1.ForeColor             = flyout.OptionsBeakPanel.BorderColor;
            beakPanel.Show();
            flyout.OptionsBeakPanel.BeakLocation = DevExpress.Utils.BeakPanelBeakLocation.Top;
            flyout.ShowBeakForm(socialScreenBounds);
        }
        public void addOrderToFlyoutPanel(OrderInfo order)
        {
            LabelControl newLabel = new LabelControl();

            newLabel.Appearance.Font      = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Bold);
            newLabel.Appearance.ForeColor = System.Drawing.Color.White;
            newLabel.Location             = new System.Drawing.Point(3, 7);
            newLabel.Size = new System.Drawing.Size(277, 18);


            DevExpress.Utils.FlyoutPanel newOrderFlyout = new DevExpress.Utils.FlyoutPanel();

            newOrderFlyout.Appearance.BackColor            = System.Drawing.Color.LimeGreen;
            newOrderFlyout.Appearance.Options.UseBackColor = true;
            newOrderFlyout.Location     = new System.Drawing.Point(2, 2);
            newOrderFlyout.Name         = "orderConfirmationFlyoutPanel";
            newOrderFlyout.OwnerControl = this;
            newOrderFlyout.Size         = new System.Drawing.Size(591, 31);
            newOrderFlyout.TabIndex     = 1;

            string orderString;

            if (order.instruments[0].type == InstrInfo.EType.EQUITY)
            {
                orderString = order.qty + "x" + " @ $" + order.prc + " of " + Utilities.InstrToStr(order.instruments);
            }
            else
            {
                orderString = order.qty + "x " + "@ $" + order.prc + (order.side == OrderInfo.ESide.BUY ? "BUY" : "SELL") + Utilities.InstrToStr(order.instruments);
            }

            if (order.status == OrderStatus.New)
            {
                newLabel.Text = "Order Accepted: " + orderString;
            }
            else if (order.status == OrderStatus.Rejected)
            {
                newLabel.Text = "Order Rejected: " + orderString;
                newOrderFlyout.Appearance.BackColor = System.Drawing.Color.Red;
            }
            else if (order.status == OrderStatus.Filled)
            {
                newLabel.Text = "Order Filled: " + orderString;
                newOrderFlyout.Appearance.BackColor = System.Drawing.Color.DarkBlue;
            }
            else if (order.status == OrderStatus.Cancelled)
            {
                newLabel.Text = "Order Cancelled: " + orderString;
                newOrderFlyout.Appearance.BackColor = System.Drawing.Color.Black;
            }
            else if (order.status == OrderStatus.Partial)
            {
                newLabel.Text = "Order Partially Filled (" + order.lastQtyExecuted + "): " + orderString;
                newOrderFlyout.Appearance.BackColor = System.Drawing.Color.DarkGray;
            }


            newOrderFlyout.Controls.Add(newLabel);

            if (InvokeRequired)
            {
                Invoke(new Action(() => {
                    level2PanelControlHeader.Controls.Add(newOrderFlyout);
                    newOrderFlyout.ShowPopup();

                    System.Windows.Forms.Timer orderShownTimer = new System.Windows.Forms.Timer();
                    orderShownTimer.Interval = 5000;
                    orderShownTimer.Tick    += new EventHandler(delegate(Object o, EventArgs e)
                    {
                        DevExpress.Utils.FlyoutPanel panel   = newOrderFlyout;
                        System.Windows.Forms.Timer thisTimer = orderShownTimer;
                        panel.HidePopup();
                        level2PanelControlHeader.Controls.Remove(panel);
                        _timerList.Remove(thisTimer);
                    });
                    orderShownTimer.Enabled = true;
                }));
            }
        }