public void TakeData(BuRootModel model) { this.KeptRootModel = model; this.RegisterInChangeWatcher(model); var lines = Helper.ToObservableCollection(model.Items.Select(x => Helper.As <IBuLineModel>(x))); lines.Add(new BuCashModel(model.Cash)); lines.Add(new BuTotalModel(model.TargetTotal)); this.Lines = lines; var portfolioId = this.LastValidInput.BottomUpPortfolioId; var registeredExpressions = new List <EditableExpressionModel>(); foreach (var line in model.Items) { EditableExpressionModel targetExpression = line.Target; var securityId = line.Security.Id; var requestBuPortfolioSecurityTargetCommentsCommand = new DelegateCommand(delegate { this.RequesCommentsForBuPortfolioSecurityTarget(portfolioId, securityId); }); targetExpression.RegisterForBeingWatched(this, requestBuPortfolioSecurityTargetCommentsCommand); registeredExpressions.Add(targetExpression); } this.FinishLoading(); this.OnGotData(); }
private void RegisterInChangeWatcher(BuRootModel model) { foreach (var security in model.Items) { security.Target.RegisterForBeingWatched(this, null); } }
public void Discard() { this.Lines = null; this.KeptRootModel = null; }