Inheritance: System.Windows.Forms.ListViewItem
Exemplo n.º 1
0
        public void AddPosition(Position position)
        {
            PositionViewItem positionViewItem = new PositionViewItem(position);

            this.PositionViewItems.Add(position, positionViewItem);
            this.ltvPositions.Items.Insert(0, (ListViewItem)positionViewItem);
        }
Exemplo n.º 2
0
        public void UpdateGUI()
        {
            if (FrameworkControl.UpdatedSuspened && this.framework.Mode != FrameworkMode.Realtime)
            {
                return;
            }
            Event[] eventArray = this.messageQueue.DequeueAll((object)this);
            if (eventArray != null)
            {
                Dictionary <Instrument, Event> dictionary = new Dictionary <Instrument, Event>();
                foreach (Event @event in eventArray)
                {
                    switch (@event.TypeId)
                    {
                    case 99:
                        this.Reset();
                        break;

                    case 110:
                        OnPositionOpened onPositionOpened = @event as OnPositionOpened;
                        if (onPositionOpened.portfolio.Name == this.portfolioName)
                        {
                            dictionary[onPositionOpened.position.Instrument] = @event;
                            break;
                        }
                        break;

                    case 111:
                        OnPositionClosed onPositionClosed = @event as OnPositionClosed;
                        if (onPositionClosed.portfolio.Name == this.portfolioName)
                        {
                            dictionary[onPositionClosed.position.Instrument] = @event;
                            break;
                        }
                        break;

                    case 112:
                        OnPositionChanged onPositionChanged = @event as OnPositionChanged;
                        if (onPositionChanged.portfolio.Name == this.portfolioName)
                        {
                            dictionary[onPositionChanged.position.Instrument] = @event;
                            break;
                        }
                        break;

                    case 114:
                        OnTransaction onTransaction = @event as OnTransaction;
                        if (onTransaction.Portfolio.Name == this.portfolioName)
                        {
                            this.composition.TransactionsViewItems.Add((ListViewItem) new TransactionViewItem(onTransaction.Transaction));
                            break;
                        }
                        break;
                    }
                }
                PositionViewItem positionViewItem = (PositionViewItem)null;
                foreach (Event @event in dictionary.Values)
                {
                    switch (@event.TypeId)
                    {
                    case 99:
                        this.Reset();
                        continue;

                    case 110:
                        OnPositionOpened onPositionOpened = @event as OnPositionOpened;
                        if (this.composition.PositionViewItems.TryGetValue(onPositionOpened.position, out positionViewItem))
                        {
                            this.composition.UpdatePosition(onPositionOpened.position);
                            continue;
                        }
                        this.composition.AddPosition(onPositionOpened.position);
                        continue;

                    case 111:
                        OnPositionClosed onPositionClosed = @event as OnPositionClosed;
                        if (this.composition.PositionViewItems.TryGetValue(onPositionClosed.position, out positionViewItem))
                        {
                            this.composition.RemovePosition(onPositionClosed.position);
                            continue;
                        }
                        continue;

                    case 112:
                        OnPositionChanged onPositionChanged = @event as OnPositionChanged;
                        if (this.composition.PositionViewItems.TryGetValue(onPositionChanged.position, out positionViewItem))
                        {
                            this.composition.UpdatePosition(onPositionChanged.position);
                            continue;
                        }
                        this.composition.AddPosition(onPositionChanged.position);
                        continue;

                    default:
                        continue;
                    }
                }
            }
            this.composition.UpdateGUI();
            this.performance.UpdateGUI();
            this.statistics.UpdateGUI();
            this.childrenStatistics.UpdateGUI();
            this.correlationMatrix.UpdateGUI();
        }
Exemplo n.º 3
0
 public void AddPosition(Position position)
 {
   PositionViewItem positionViewItem = new PositionViewItem(position);
   this.PositionViewItems.Add(position, positionViewItem);
   this.ltvPositions.Items.Insert(0, (ListViewItem) positionViewItem);
 }