Esempio n. 1
0
 /// <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();
 }
Esempio n. 2
0
        public async Task RemoveSelectedLocations()
        {
            if (SelectedLocations.Count == 0)
            {
                await _dialogService.ShowAsync("Please select at least one location.");

                return;
            }

            var response = await _dialogService.ShowConfirmationAsync("Do you really want to remove the selected locations?");

            if (response == ConfirmationAnswer.Cancel)
            {
                return;
            }

            IsBusy = true;
            var selectedLocations = SelectedLocations.ToList();

            foreach (var selLoc in selectedLocations)
            {
                var snapshots = await _locationSnapshotDataService.GetSnapshotsByLocationIdAsync(selLoc.Id);

                var deletionTasks = snapshots.Select(async _ =>
                {
                    await _locationSnapshotDataService.RemoveSnapshotAsync(_.Id);
                    await _pictureService.RemoveSnapshotContentAsync(_);
                });
                await Task.WhenAll(deletionTasks);

                var removedLocation = await _locationDataService.RemoveLocationAsync(selLoc.Id);

                Locations.Remove(Locations.First(_ => _.Id == removedLocation.Id));
            }
            ;
            SetDefaultView();
            IsBusy = false;
        }