protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var model = new DealCaptureModel(equityNameSeed: 1, bondNameSeed: 1); var viewModel = new DealCaptureViewModel(model, bondTolerance: 100 * 1000m, equityTolerance: 200 * 1000m); var window = new MainWindow { DataContext = viewModel }; window.Show(); }
internal DealCaptureViewModel(DealCaptureModel model, decimal bondTolerance, decimal equityTolerance) { if (model == null) { throw new ArgumentNullException(nameof(model)); } this.model = model; this.tolerances = new Dictionary <DealCaptureModel.StockType, decimal> { { DealCaptureModel.StockType.Bond, bondTolerance }, { DealCaptureModel.StockType.Equity, equityTolerance } }; var createEquityCommand = new ActionToCommandAdapter(() => this.CreateEquity()); var createBondCommand = new ActionToCommandAdapter(() => this.CreateBond()); this.NewEquity = new NewStockViewModel(createEquityCommand); this.NewEquity.PropertyChanged += (s, e) => this.OnPropertyChanged(nameof(NewEquity)); this.NewBond = new NewStockViewModel(createBondCommand); this.NewBond.PropertyChanged += (s, e) => this.OnPropertyChanged(nameof(NewBond)); }