Exemplo n.º 1
0
            /// <summary>
            /// Adds the specified selection.
            /// </summary>
            /// <param name="selection">The selection.</param>
            private void Add(Selection selection)
            {
                if (selection == null)
                {
                    return;
                }
                if (selection.selectionId <= 0 && selection.asianLineId <= 0)
                {
                    return;
                }

                var key = String.Format("SID:{0}AID:{1}", selection.selectionId, selection.asianLineId);

                if (Controls.ContainsKey(key) && Controls[key].GetType() == typeof(SelectionView))
                {
                    var selectionViewControl = (SelectionView)Controls[key];

                    selectionViewControl.SelectionData = selection;
                    selectionViewControl.RefreshControlPrices();
                }
                else
                {
                    var selectionViewControl = new SelectionView
                    {
                        Name       = key,
                        MarketId   = MarketId,
                        ExchangeId = ExchangeId,
                        Currency   = Currency,
                        ShowStartingPricesIfAvailable = ShowStartingPricesIfAvailable,
                        IsBSPMarket   = IsBSPMarket,
                        SelectionData = selection,
                        Dock          = DockStyle.Top
                    };

                    selectionViewControl.RefreshControl();

                    if (Controller != null)
                    {
                        selectionViewControl.Controller = Controller;
                    }

                    Controls.Add(selectionViewControl);
                    selectionViewControl.BringToFront();
                }

                Height = Controls.Count * 40;
            }
Exemplo n.º 2
0
            /// <summary>
            /// Adds the specified selection.
            /// </summary>
            /// <param name="selection">The selection.</param>
            private void Add(Selection selection)
            {
                if (selection == null) return;
                if (selection.selectionId <= 0 && selection.asianLineId <= 0) return;

                var key = String.Format("SID:{0}AID:{1}", selection.selectionId, selection.asianLineId);

                if (Controls.ContainsKey(key) && Controls[key].GetType() == typeof (SelectionView))
                {
                    var selectionViewControl = (SelectionView) Controls[key];

                    selectionViewControl.SelectionData = selection;
                    selectionViewControl.RefreshControlPrices();
                }
                else
                {
                    var selectionViewControl = new SelectionView
                                                   {
                                                       Name = key,
                                                       MarketId = MarketId,
                                                       ExchangeId = ExchangeId,
                                                       Currency = Currency,
                                                       ShowStartingPricesIfAvailable = ShowStartingPricesIfAvailable,
                                                       IsBSPMarket = IsBSPMarket,
                                                       SelectionData = selection,
                                                       Dock = DockStyle.Top
                                                   };

                    selectionViewControl.RefreshControl();

                    if (Controller != null) selectionViewControl.Controller = Controller;

                    Controls.Add(selectionViewControl);
                    selectionViewControl.BringToFront();
                }

                Height = Controls.Count*40;
            }