public SummaryView(ISummaryViewModel viewModel) { InitializeComponent(); viewModel.SetParentView(this); DataContext = viewModel; }
public SummaryViewController() : base("SummaryViewController") { _summaryViewModel = ServiceLocator.Current.GetInstance <ISummaryViewModel>(); _balanceWidgetViewModel = ServiceLocator.Current.GetInstance <IBalanceWidgetViewModel>(); _accountsWidgetViewModel = ServiceLocator.Current.GetInstance <IAccountsWidgetViewModel>(); _transactionsWidgetViewModel = ServiceLocator.Current.GetInstance <ITransactionsWidgetViewModel>(); _accountsWidgetViewModel.OnAccountsChanged += AccountsCollectionChanged; _transactionsWidgetViewModel.OnTransactionsChanged += TransactionsChanged; }
public MainWindowViewModel(IFundViewModel fundViewModel, ISummaryViewModel summaryViewModel, IAddStockViewModel addStockViewModel) { // This is painful to look at, and we should really use DI here with a proper composition root and bindings and everything, // but I couldn't bring myself to also introduce a DI container here. This solution feels slightly bloated as it is. // I hope the overall design that I strove for in the Domain Model will demonstrate my awareness of the concept. //Fund = new FundViewModel(TestDataProvider.CreateTestFund()); //Summary = new SummaryViewModel(Fund.GetStocksFunc); //AddStock = new AddStockViewModel(_addStockHelper); //_addStockHelper = addStockHelper; AddStock = addStockViewModel; Fund = fundViewModel; Summary = summaryViewModel; }