public void RemoveItemFromComposition(ItemModel item)
        {
            this.Items.Remove(item);
            this.IsChanged = true;
            CompositionChangedEventInfo info = new CompositionChangedEventInfo {
                Securities = this.Items.Select(x => Int32.Parse(x.Security.Id)).ToList()
            };

            this.aggregator.GetEvent <CompositionChangedEvent>().Publish(info);
        }
        internal void InitializeDataGrid(RootModel model)
        {
            this.Issuer = model.Issuer;
            this.Items  = model.Items;
            foreach (var item in this.Items)
            {
                item.InitializeRemoveCommand(new DelegateCommand <ItemModel>(RemoveItemFromComposition));
                item.InitializeChangedPreferredCommand(new DelegateCommand <ItemModel>(HasChangedPreferred));
            }
            this.RaisePropertyChanged(() => this.Items);
            CompositionChangedEventInfo info = new CompositionChangedEventInfo {
                Securities = this.Items.Select(x => Int32.Parse(x.Security.Id)).ToList()
            };

            this.aggregator.GetEvent <CompositionChangedEvent>().Publish(info);
        }
        internal void AddSecurity(Aims.Data.Client.ISecurity security)
        {
            var item = new ItemModel {
                Security = security.ToSecurityModel(), Preferred = false
            };

            item.InitializeRemoveCommand(new DelegateCommand <ItemModel>(RemoveItemFromComposition));

            if (this.Items.Count(x => x.Security.Id == item.Security.Id) != 0)
            {
                MessageBox.Show("Security is already in the composition.");
            }
            else
            {
                this.Items.Add(item);
                this.IsChanged = true;
            }

            CompositionChangedEventInfo info = new CompositionChangedEventInfo {
                Securities = this.Items.Select(x => Int32.Parse(x.Security.Id)).ToList()
            };

            this.aggregator.GetEvent <CompositionChangedEvent>().Publish(info);
        }
Esempio n. 4
0
 public void ShowHistory(CompositionChangedEventInfo info)
 {
     this.securities = info.Securities;
     ShowHistory();
 }