private void UpdateFundSummary(myFund.Common.Model.Fund fundObject) { var fundSummaryValue = new FundSummary(); fundSummaryValue.Calculate(fundObject); this.FundSummary = fundSummaryValue; }
private void OnStockAdded(Stock stock) { if (stock == null || this.Fund == null) { return; } this.Fund.Add(stock); var fundObject = new myFund.Common.Model.Fund { Stocks = this.Fund }; // For now calculated synchronously. If will be time consuming should be parallerized or moved to separate thread. // In case you want to move it to another thread keep in mind to update UI in main thread. foreach (var s in this.Fund) { s.StockWeight.Calculate(fundObject); } // Same as above this.UpdateFundSummary(fundObject); }