예제 #1
0
        private void Initialize()
        {
            CarModel = new CarModel();
            RefreshFuelTypeList();
            RefreshBrandModelList();
            RegisterCommands();

            if (AvailableBrands != null && AvailableBrands.Count > 0)
            {
                SelectedBrand = AvailableBrands.First();
                RefreshCarModelList();
            }

            if (AvailableCarModels != null && AvailableCarModels.Count > 0)
            {
                SelectedModelType = AvailableCarModels.First();
            }

            if (AvailableFuelTypes != null && AvailableFuelTypes.Count > 0)
            {
                SelectedFuelType = AvailableFuelTypes.First();
            }
            IsActive = true;
            _eventAggregator.GetEvent <ObjectEvent>().Subscribe(HandleObjectEvent);
        }
        /// <summary>
        /// Assigns all values to default after the default Constructor is called.
        /// </summary>
        private void InitializeCarDetailsView()
        {
            carModel           = new CarModel();
            AvailableFuelTypes = new ObservableCollection <FuelTypeModel>(SqliteDataAccess.LoadAllFuelTypes());
            AvailableBrands    = new ObservableCollection <BrandModel>(SqliteDataAccess.LoadAllBrands());

            if (AvailableBrands != null && AvailableBrands.Count > 0)
            {
                SelectedBrand = AvailableBrands.First();
            }

            if (AvailableCarModels != null && AvailableCarModels.Count > 0)
            {
                SelectedModelType = AvailableCarModels.First();
            }

            if (AvailableFuelTypes != null && AvailableFuelTypes.Count > 0)
            {
                SelectedFuelType = AvailableFuelTypes.First();
            }

            IsActive = true;
            EventAggregationProvider.EventAggregator.Subscribe(this);
        }