コード例 #1
0
        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;
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        public PropertiesViewModel(IDataService dataService, LandlordsViewModel landlordsViewModel)
        {
            _dataService = dataService;

            RefreshGrid();

            // subscribe landlord selection change event
            landlordsViewModel.OnLandlordChanged += LandlordsViewModel_OnLandlordChanged;
        }