private void AddManuallyDeployedVehicle(string resourceName)
        {
            var vehicle = _configuration.Vehicles.FirstOrDefault(v => v.Name == resourceName);
            if (vehicle == null)
            {
                return;
            }

            // Otherwise set a new resource as deployed
            ResourceViewModel rvm = new ResourceViewModel();
            rvm.VehicleName = vehicle.Name;
            rvm.SetImage(vehicle.Image);

            _manuallyDeployedVehicles.Add(rvm);
        }
        private IEnumerable<ResourceViewModel> GetResources()
        {
            List<ResourceViewModel> resources = new List<ResourceViewModel>();

            if (_operation != null && _operation.Resources != null)
            {
                foreach (OperationResource resource in _operation.Resources)
                {
                    // Check if the filter matches
                    var vehicle = _configuration.FindMatchingResource(resource.FullName);
                    if (vehicle == null)
                    {
                        continue;
                    }

                    ResourceViewModel rvm = resources.FirstOrDefault(t => t.VehicleName == vehicle.Name);
                    if (rvm == null)
                    {
                        // Sometimes the vehicles get requested multiple times and it differs only in the equipment needed
                        // So we just create the vehicle once and add the equipment to that
                        rvm = new ResourceViewModel();
                        rvm.VehicleName = vehicle.Name;
                        rvm.SetImage(vehicle.Image);
                        resources.Add(rvm);
                    }

                    if (rvm.RequestedEquipment != null)
                    {
                        // Add newline when adding equipment to already existing vehicle
                        rvm.RequestedEquipment += "\n";
                    }
                    rvm.RequestedEquipment += string.Join("\n", resource.RequestedEquipment);

                }
            }

            return resources.OrderBy(r => r.VehicleName);
        }
        /// <summary>
        /// Adds a new manually deployed vehicle to the list.
        /// </summary>
        internal void ToggleManuallyDeployedVehicles(string resourceName)
        {
            if (_operation != null && _operation.Resources != null)
            {
                OperationResourceCollection dataSource = _operation.Resources;

                // Get resource by its name
                var vehicle = _configuration.Vehicles.FirstOrDefault(v => v.Name == resourceName);
                if (vehicle != null)
                {
                    ResourceViewModel rvm = ManuallyDeployedVehicles.FirstOrDefault(r => r.VehicleName == vehicle.Name);
                    if (rvm != null)
                    {
                        // If this resource is already manually deployed, "undeploy" it.

                        // Require confirmation of this action
                        if (!ServiceProvider.Instance.GetService<ICredentialConfirmationDialogService>().Invoke("Eingesetztes Fahrzeug entfernen", AuthorizationMode.SimpleConfirmation))
                        {
                            return;
                        }

                        _manuallyDeployedVehicles.Remove(rvm);
                        _operationLibrary.RemoveFromInfoEntry(_operation.OperationNumber, vehicle.Name);
                    }
                    else
                    {
                        // Otherwise set a new resource as deployed
                        rvm = new ResourceViewModel();
                        rvm.VehicleName = vehicle.Name;
                        rvm.SetImage(vehicle.Image);

                        _manuallyDeployedVehicles.Add(rvm);
                        _operationLibrary.AddToInfoEntry(_operation.OperationNumber, vehicle.Name);
                    }
                }
            }
        }