private void OnNotSelectedFloorDoubleClickCommand() { var floor = SelectedNotSelectedFloor; if (floor == null) { return; } NotSelectedFloors.Remove(floor); SelectedFloors.Add(floor); RaisePropertyChanged(() => SelectedFloors); RaisePropertyChanged(() => NotSelectedFloors); }
/// <summary> /// sets the returnparameter before closing /// </summary> /// <param name="window"></param> private void OnApplyCommand(Window window) { ReturnParameter = Parameter; ReturnParameter.Buildings = SelectedBuildings.ToList(); ReturnParameter.Departments = SelectedDepartments.ToList(); ReturnParameter.ItemStates = SelectedItemStates.ToList(); ReturnParameter.ItemNatures = SelectedItemNatures.ToList(); ReturnParameter.ItemTypes = SelectedItemTypes.ToList(); ReturnParameter.Locations = SelectedLocations.ToList(); ReturnParameter.Sections = SelectedSections.ToList(); ReturnParameter.Floors = SelectedFloors.ToList(); window.DialogResult = true; window.Close(); }
/// <summary> /// Initialization /// </summary> /// <returns></returns> protected override async Task InitializeAsync() { try { IsLoading = true; if (Parameter != null) { SelectedBuildings = new ObservableCollection <BuildingDto>(Parameter.Buildings); SelectedDepartments = new ObservableCollection <DepartmentDto>(Parameter.Departments); SelectedFloors = new ObservableCollection <FloorDto>(Parameter.Floors); SelectedItemNatures = new ObservableCollection <ItemNatureDto>(Parameter.ItemNatures); SelectedItemStates = new ObservableCollection <ItemStateDto>(Parameter.ItemStates); SelectedItemTypes = new ObservableCollection <ItemTypeDto>(Parameter.ItemTypes); SelectedLocations = new ObservableCollection <LocationDto>(Parameter.Locations); SelectedSections = new ObservableCollection <SectionDto>(Parameter.Sections); } else { SelectedBuildings = new ObservableCollection <BuildingDto>(); SelectedDepartments = new ObservableCollection <DepartmentDto>(); SelectedFloors = new ObservableCollection <FloorDto>(); SelectedItemNatures = new ObservableCollection <ItemNatureDto>(); SelectedItemStates = new ObservableCollection <ItemStateDto>(); SelectedItemTypes = new ObservableCollection <ItemTypeDto>(); SelectedLocations = new ObservableCollection <LocationDto>(); SelectedSections = new ObservableCollection <SectionDto>(); } var buildingList = await _buildingApiService.GetAll(); var departmentList = await _departmentApiService.GetAll(); var floorList = await _floorApiService.GetAll(); var itemNatureList = await _itemNatureApiService.GetAll(); var itemStateList = await _itemStateApiService.GetAll(); var itemTypeList = await _itemTypeApiService.GetAll(); var locationList = await _locationApiService.GetAll(); var sectionList = await _sectionApiService.GetAll(); if (buildingList != null) { var buildings = buildingList.Where(building => SelectedBuildings.FirstOrDefault(building2 => building.Id == building2.Id) == null).ToList(); NotSelectedBuildings = new ObservableCollection <BuildingDto>(buildings); } if (departmentList != null) { var departments = departmentList.Where(department => SelectedDepartments.FirstOrDefault(department2 => department.Id == department2.Id) == null).ToList(); NotSelectedDepartments = new ObservableCollection <DepartmentDto>(departments); } if (floorList != null) { var floors = floorList.Where(floor => !SelectedFloors.Contains(floor)).ToList(); NotSelectedFloors = new ObservableCollection <FloorDto>(floors); } if (itemNatureList != null) { var itemNatures = itemNatureList.Where(itemNature => SelectedItemNatures.FirstOrDefault(itemNature2 => itemNature.Id == itemNature2.Id) == null).ToList(); NotSelectedItemNatures = new ObservableCollection <ItemNatureDto>(itemNatures); } if (itemStateList != null) { var itemStates = itemStateList.Where(itemState => SelectedItemStates.FirstOrDefault(itemState2 => itemState.Id == itemState2.Id) == null).ToList(); NotSelectedItemStates = new ObservableCollection <ItemStateDto>(itemStates); } if (itemTypeList != null) { var itemTypes = itemTypeList.Where(itemType => SelectedItemTypes.FirstOrDefault(itemType2 => itemType.Id == itemType2.Id) == null).ToList(); NotSelectedItemTypes = new ObservableCollection <ItemTypeDto>(itemTypes); } if (locationList != null) { var locations = locationList.Where(location => SelectedLocations.FirstOrDefault(location2 => location.Id == location2.Id) == null).ToList(); NotSelectedLocations = new ObservableCollection <LocationDto>(locations); } if (sectionList != null) { var sections = sectionList.Where(section => SelectedSections.FirstOrDefault(section2 => section.Id == section2.Id) == null).ToList(); NotSelectedSections = new ObservableCollection <SectionDto>(sections); } } catch (Exception e) { _loggingService.LogFatal("Error during Initalization!", e); _dialogService.ShowError(e.Message); } finally { IsLoading = false; } }