public PropertyViewModel(IDataService dataService, LandlordsViewModel landlordsViewModel, PropertiesViewModel propertiesViewModel) { _title = "Add Property"; _dataService = dataService; _landlordsViewModel = landlordsViewModel; _propertiesViewModel = propertiesViewModel; _property = new Property() { AvailableFrom = DateTime.Now }; if (_dataService != null) { _dataService.GetLandlords( (landlords, exception) => { if (landlords != null) { _landlords = landlords; } }); } // subscribe landlord selection change event propertiesViewModel.OnPropertyChanged += PropertiesViewModel_OnPropertyChanged; }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IDataService dataService) { _dataService = dataService; _landlordsViewModel = new LandlordsViewModel(_dataService); _propertiesViewModel = new PropertiesViewModel(_dataService, _landlordsViewModel); _propertyViewModel = new PropertyViewModel(_dataService, _landlordsViewModel, _propertiesViewModel); }