diff --git a/BrickController2/BrickController2/BusinessLogic/IPlayLogic.cs b/BrickController2/BrickController2/BusinessLogic/IPlayLogic.cs index d07140ab..14c8e849 100644 --- a/BrickController2/BrickController2/BusinessLogic/IPlayLogic.cs +++ b/BrickController2/BrickController2/BusinessLogic/IPlayLogic.cs @@ -1,6 +1,6 @@ using BrickController2.CreationManagement; using BrickController2.PlatformServices.InputDevice; -using System.Threading.Tasks; +using System.Collections.Generic; namespace BrickController2.BusinessLogic { @@ -11,6 +11,8 @@ public interface IPlayLogic CreationValidationResult ValidateCreation(Creation creation); bool ValidateControllerAction(ControllerAction controllerAction); + IEnumerable GetMissingDevices(Creation creation); + void StartPlay(); void StopPlay(); diff --git a/BrickController2/BrickController2/BusinessLogic/PlayLogic.cs b/BrickController2/BrickController2/BusinessLogic/PlayLogic.cs index c0161598..2b3ffc34 100644 --- a/BrickController2/BrickController2/BusinessLogic/PlayLogic.cs +++ b/BrickController2/BrickController2/BusinessLogic/PlayLogic.cs @@ -1,9 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using BrickController2.CreationManagement; +using BrickController2.CreationManagement; using BrickController2.DeviceManagement; using BrickController2.PlatformServices.InputDevice; +using System; +using System.Collections.Generic; +using System.Linq; namespace BrickController2.BusinessLogic { @@ -35,7 +35,7 @@ public CreationValidationResult ValidateCreation(Creation creation) var deviceIds = creation.GetDeviceIds(); var sequenceNames = creation.GetSequenceNames(); - if (deviceIds == null || deviceIds.Count() == 0) + if (deviceIds.Count == 0) { return CreationValidationResult.MissingControllerAction; } @@ -59,6 +59,11 @@ public bool ValidateControllerAction(ControllerAction controllerAction) return device != null && (controllerAction.ButtonType != ControllerButtonType.Sequence || sequence != null); } + public IEnumerable GetMissingDevices(Creation creation) + { + return creation.GetDeviceIds().Where(d => _deviceManager.GetDeviceById(d) == null); + } + public void StartPlay() { _sequencePlayer.StartPlayer(); diff --git a/BrickController2/BrickController2/CreationManagement/ControllerAction.cs b/BrickController2/BrickController2/CreationManagement/ControllerAction.cs index 9b6404a3..43ca7ac7 100644 --- a/BrickController2/BrickController2/CreationManagement/ControllerAction.cs +++ b/BrickController2/BrickController2/CreationManagement/ControllerAction.cs @@ -122,5 +122,17 @@ public override string ToString() { return $"{DeviceId} - {Channel}"; } + + public bool RemapDevice(string sourceDeviceId, string newDeviceId) + { + // check action to remap the device ID + if (DeviceId == sourceDeviceId) + { + DeviceId = newDeviceId; + return true; + } + + return false; + } } } diff --git a/BrickController2/BrickController2/CreationManagement/Creation.cs b/BrickController2/BrickController2/CreationManagement/Creation.cs index 9ecb6101..725caaba 100644 --- a/BrickController2/BrickController2/CreationManagement/Creation.cs +++ b/BrickController2/BrickController2/CreationManagement/Creation.cs @@ -38,9 +38,9 @@ public override string ToString() return Name; } - public IEnumerable GetDeviceIds() + public IReadOnlySet GetDeviceIds() { - var deviceIds = new List(); + var deviceIds = new HashSet(); foreach (var profile in ControllerProfiles) { @@ -48,11 +48,7 @@ public IEnumerable GetDeviceIds() { foreach (var controllerAction in controllerEvent.ControllerActions) { - var deviceId = controllerAction.DeviceId; - if (!deviceIds.Contains(deviceId)) - { - deviceIds.Add(deviceId); - } + deviceIds.Add(controllerAction.DeviceId); } } } diff --git a/BrickController2/BrickController2/CreationManagement/CreationManager.cs b/BrickController2/BrickController2/CreationManagement/CreationManager.cs index 6ac7bec6..52d43358 100644 --- a/BrickController2/BrickController2/CreationManagement/CreationManager.cs +++ b/BrickController2/BrickController2/CreationManagement/CreationManager.cs @@ -128,6 +128,30 @@ public async Task RenameCreationAsync(Creation creation, string newName) } } + public async Task RemapDevice(Creation creation, string sourceDeviceId, string newDeviceId) + { + using (await _asyncLock.LockAsync()) + { + var counter = 0; + foreach (var profile in creation.ControllerProfiles) + { + foreach (var controllerEvent in profile.ControllerEvents) + { + foreach (var controllerAction in controllerEvent.ControllerActions) + { + // if remapping is applied, persist the change + if (controllerAction.RemapDevice(sourceDeviceId, newDeviceId)) + { + await _creationRepository.UpdateControllerActionAsync(controllerAction); + counter++; + } + } + } + } + return counter; + } + } + public async Task IsControllerProfileNameAvailableAsync(Creation creation, string controllerProfileName) { using (await _asyncLock.LockAsync()) diff --git a/BrickController2/BrickController2/CreationManagement/ICreationManager.cs b/BrickController2/BrickController2/CreationManagement/ICreationManager.cs index 98200db6..f7ee96e1 100644 --- a/BrickController2/BrickController2/CreationManagement/ICreationManager.cs +++ b/BrickController2/BrickController2/CreationManagement/ICreationManager.cs @@ -18,6 +18,7 @@ public interface ICreationManager Task AddCreationAsync(string creationName); Task DeleteCreationAsync(Creation creation); Task RenameCreationAsync(Creation creation, string newName); + Task RemapDevice(Creation creation, string sourceDeviceId, string newDeviceId); Task ImportControllerProfileAsync(Creation creation, string controllerProfileFilename); Task ImportControllerProfileAsync(Creation creation, ControllerProfile controllerProfile); diff --git a/BrickController2/BrickController2/UI/Commands/CreationCommandFactory.cs b/BrickController2/BrickController2/UI/Commands/CreationCommandFactory.cs index eee2a32c..33f79a3c 100644 --- a/BrickController2/BrickController2/UI/Commands/CreationCommandFactory.cs +++ b/BrickController2/BrickController2/UI/Commands/CreationCommandFactory.cs @@ -1,17 +1,25 @@ -using BrickController2.CreationManagement; +using BrickController2.BusinessLogic; +using BrickController2.CreationManagement; using BrickController2.CreationManagement.Sharing; +using BrickController2.DeviceManagement; using BrickController2.PlatformServices.SharedFileStorage; using BrickController2.UI.Services.Dialog; using BrickController2.UI.Services.Navigation; using BrickController2.UI.Services.Translation; +using BrickController2.UI.ViewModels; using System; +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; +using System.Windows.Input; namespace BrickController2.UI.Commands; -internal class CreationCommandFactory : ItemCommandFactoryBase, ICommandFactory +internal class CreationCommandFactory : ItemCommandFactoryBase, ICommandFactory, ICreationCommandFactory { private readonly ICreationManager _creationManager; + private readonly IDeviceManager _deviceManager; + private readonly IPlayLogic _playLogic; public CreationCommandFactory ( @@ -20,12 +28,28 @@ public CreationCommandFactory ISharingManager sharingManager, ISharedFileStorageService sharedFileStorageService, INavigationService navigationService, - ICreationManager creationManager + ICreationManager creationManager, + IDeviceManager deviceManager, + IPlayLogic playLogic ) : base(dialogService, translationService, sharingManager, sharedFileStorageService, navigationService) { _creationManager = creationManager; + _deviceManager = deviceManager; + _playLogic = playLogic; } + public ICommand PlayCommand(PageViewModelBase viewModel, Creation creation, ControllerProfile? controllerProfile = default!) + => new SafeCommand(() => PlayAsync(viewModel, creation, controllerProfile)); + + public ICommand PlayCreationCommand(PageViewModelBase viewModel) + => new SafeCommand((creation) => PlayAsync(viewModel, creation)); + + public ICommand PlayControllerProfileCommand(PageViewModelBase viewModel) + => new SafeCommand((profile) => PlayAsync(viewModel, profile.Creation, profile)); + + public ICommand RemapDeviceCommand(PageViewModelBase viewModel, Creation creation) + => new SafeCommand(() => RemapDeviceAsync(viewModel, creation)); + protected override string ItemsTitle => Translate("Creations"); protected override string ItemNameHint => Translate("CreationName"); protected override string NoItemToImportMessage => Translate("NoCreationsToImport"); @@ -37,4 +61,171 @@ protected override Task ExportItemAsync(Creation model, string fileName) protected override Task ImportItemAsync(Creation model) => _creationManager.ImportCreationAsync(model); + + private async Task PlayAsync(PageViewModelBase viewModel, Creation creation, ControllerProfile? controllerProfile = default!) + { + try + { + var validationResult = _playLogic.ValidateCreation(creation); + + string warning = string.Empty; + switch (validationResult) + { + case CreationValidationResult.MissingControllerAction: + warning = Translate("NoControllerActions"); + break; + + case CreationValidationResult.MissingDevice: + warning = Translate("MissingDevices"); + break; + + case CreationValidationResult.MissingSequence: + warning = Translate("MissingSequence"); + break; + } + + if (validationResult == CreationValidationResult.Ok) + { + await NavigationService.NavigateToAsync(new NavigationParameters( + ("creation", creation), + ("profile", controllerProfile))); + } + else + { + await DialogService.ShowMessageBoxAsync( + Translate("Warning"), + warning, + Translate("Ok"), + viewModel.DisappearingToken); + } + } + catch (OperationCanceledException) + { + } + } + + private async Task RemapDeviceAsync(PageViewModelBase viewModel, Creation creation) + { + try + { + await RemapDevicesAsync(viewModel, creation); + } + catch (OperationCanceledException) + { + } + } + + private async Task RemapDevicesAsync(PageViewModelBase viewModel, Creation creation) + { + // get source device IDs + var sourceDeviceIds = creation.GetDeviceIds() + .Select(id => + { + DeviceId.TryParse(id, out var deviceType, out var deviceAddress); + return (DeviceType: deviceType, Address: deviceAddress); + }) + .Where(x => x.DeviceType != DeviceType.Unknown && x.Address != null) + .ToList(); + + // get source types + var sourceTypes = sourceDeviceIds.Select(x => x.DeviceType).ToHashSet(); + var addresses = sourceDeviceIds.Select(x => x.Address!).ToHashSet(); + // source types that have some existing device of such type present, but not used in creation + var suitableTypes = sourceTypes.Where(x => _deviceManager.Devices + .Any(d => d.DeviceType == x && !addresses.Contains(d.Address))) + .ToHashSet(); + + if (sourceTypes.Count == 0 || suitableTypes.Count == 0) + { + // report error - no suitable device to replace + await DialogService.ShowMessageBoxAsync( + Translate("Information"), + Translate("No suitable device found to remap a device."), + Translate("Ok"), + viewModel.DisappearingToken); + return false; + } + + var sourceType = await ChooseDeviceTypeToRemapAsync(viewModel, suitableTypes); + if (sourceType is null) + { + // user cancelled + return false; + } + + // have source device type, get addresses of such type + var sourceDeviceAddresses = sourceDeviceIds + .Where(x => x.DeviceType == sourceType.Value) + .Select(x => x.Address!) + .ToList(); + + var sourceDeviceAddress = await ChooseDeviceAddressToRemapAsync(viewModel, sourceDeviceAddresses); + if (sourceDeviceAddress is null) + { + // user cancelled + return false; + } + + // choose target device by name but avoid the source one + var suitableDevices = _deviceManager.Devices + .Where(d => d.DeviceType == sourceType.Value && d.Address != sourceDeviceAddress) + .OrderBy(x => x.Name) + .ToList(); + + var targetDevice = await DialogService.ShowSelectionDialogAsync( + suitableDevices, + Translate("Target device"), + Translate("Cancel"), + viewModel.DisappearingToken); + + if (targetDevice.IsOk) + { + // replace all source device IDs with the selected one + var sourceDeviceId = DeviceId.Get(sourceType.Value, sourceDeviceAddress); + var newDeviceId = targetDevice.SelectedItem!.Id; + var count = await _creationManager.RemapDevice(creation, sourceDeviceId, newDeviceId); + + await DialogService.ShowMessageBoxAsync( + Translate("Information"), + Translate($"Remapped {count} controller actions from device '{sourceDeviceId}' to '{newDeviceId}'"), + Translate("Ok"), + viewModel.DisappearingToken); + } + + return true; + } + + private async Task ChooseDeviceAddressToRemapAsync(PageViewModelBase viewModel, List missingDeviceAddresses) + { + if (missingDeviceAddresses.Count == 1) + { + return missingDeviceAddresses[0]; + } + + // choose address to remap + var sourceDevice = await DialogService.ShowSelectionDialogAsync( + missingDeviceAddresses.Order(), + Translate("Source device"), + Translate("Cancel"), + viewModel.DisappearingToken); + + return sourceDevice.IsOk ? sourceDevice.SelectedItem : default; + } + + private async Task ChooseDeviceTypeToRemapAsync(PageViewModelBase viewModel, HashSet suitableTypes) + { + if (suitableTypes.Count == 1) + { + return suitableTypes.First(); + } + + // choose device type to remap + var deviceType = await DialogService.ShowSelectionDialogAsync( + suitableTypes.OrderBy(x => x.ToString()), + Translate("Source device type"), + Translate("Cancel"), + viewModel.DisappearingToken); + + return deviceType.IsOk ? deviceType.SelectedItem : default; + } } diff --git a/BrickController2/BrickController2/UI/Commands/ICreationCommandFactory.cs b/BrickController2/BrickController2/UI/Commands/ICreationCommandFactory.cs new file mode 100644 index 00000000..76eafc01 --- /dev/null +++ b/BrickController2/BrickController2/UI/Commands/ICreationCommandFactory.cs @@ -0,0 +1,16 @@ +using BrickController2.CreationManagement; +using BrickController2.UI.ViewModels; +using System.Windows.Input; + +namespace BrickController2.UI.Commands; + +public interface ICreationCommandFactory : ICommandFactory +{ + ICommand PlayCommand(PageViewModelBase viewModel, Creation creation, ControllerProfile? controllerProfile = default!); + + ICommand PlayCreationCommand(PageViewModelBase viewModel); + + ICommand PlayControllerProfileCommand(PageViewModelBase viewModel); + + ICommand RemapDeviceCommand(PageViewModelBase viewModel, Creation creation); +} diff --git a/BrickController2/BrickController2/UI/DI/UiModule.cs b/BrickController2/BrickController2/UI/DI/UiModule.cs index bfbf4792..be087fa2 100644 --- a/BrickController2/BrickController2/UI/DI/UiModule.cs +++ b/BrickController2/BrickController2/UI/DI/UiModule.cs @@ -62,7 +62,7 @@ protected override void Load(ContainerBuilder builder) }); // command related registration - builder.RegisterType().As>().SingleInstance(); + builder.RegisterType().As>().As().SingleInstance(); builder.RegisterType().As>().SingleInstance(); // Xamarin forms related diff --git a/BrickController2/BrickController2/UI/Pages/CreationPage.xaml b/BrickController2/BrickController2/UI/Pages/CreationPage.xaml index 5cf82571..21c921cd 100644 --- a/BrickController2/BrickController2/UI/Pages/CreationPage.xaml +++ b/BrickController2/BrickController2/UI/Pages/CreationPage.xaml @@ -3,6 +3,7 @@ xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:controls="clr-namespace:BrickController2.UI.Controls" + xmlns:converters="clr-namespace:BrickController2.UI.Converters" xmlns:extensions="clr-namespace:BrickController2.UI.MarkupExtensions" xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls" xmlns:local="clr-namespace:BrickController2.UI.Pages" @@ -19,6 +20,7 @@ + diff --git a/BrickController2/BrickController2/UI/ViewModels/ControllerProfilePageViewModel.cs b/BrickController2/BrickController2/UI/ViewModels/ControllerProfilePageViewModel.cs index d1b32e5d..b1798f11 100644 --- a/BrickController2/BrickController2/UI/ViewModels/ControllerProfilePageViewModel.cs +++ b/BrickController2/BrickController2/UI/ViewModels/ControllerProfilePageViewModel.cs @@ -39,6 +39,8 @@ public ControllerProfilePageViewModel( IDialogService dialogService, ISharedFileStorageService sharedFileStorageService, IPlayLogic playLogic, + IInputDeviceEventService gameControllerService, + ICreationCommandFactory commandFactory, NavigationParameters parameters) : base(navigationService, translationService) { @@ -56,7 +58,7 @@ public ControllerProfilePageViewModel( RenameProfileCommand = new SafeCommand(async () => await RenameControllerProfileAsync()); AddControllerEventCommand = new SafeCommand(async () => await AddControllerEventAsync(false)); AddControllerEventForSpecificControllerIdCommand = new SafeCommand(async () => await AddControllerEventAsync(true)); - PlayCommand = new SafeCommand(async () => await PlayAsync()); + PlayCommand = commandFactory.PlayCommand(this, ControllerProfile.Creation!, ControllerProfile); ControllerActionTappedCommand = new SafeCommand(ShowActionAsync); DeleteControllerEventCommand = new SafeCommand(async controllerEvent => await DeleteControllerEventAsync(controllerEvent)); AddAnotherActionCommand = new SafeCommand(AddAnotherActionAsync); @@ -262,41 +264,6 @@ await _dialogService.ShowMessageBoxAsync( } } - private async Task PlayAsync() - { - var validationResult = _playLogic.ValidateCreation(ControllerProfile.Creation!); - - string warning = string.Empty; - switch (validationResult) - { - case CreationValidationResult.MissingControllerAction: - warning = Translate("NoControllerActions"); - break; - - case CreationValidationResult.MissingDevice: - warning = Translate("MissingDevices"); - break; - - case CreationValidationResult.MissingSequence: - warning = Translate("MissingSequence"); - break; - } - - if (validationResult == CreationValidationResult.Ok) - { - await NavigationService.NavigateToAsync(new NavigationParameters( - ("creation", ControllerProfile.Creation!), - ("profile", ControllerProfile))); - } - else - { - await _dialogService.ShowMessageBoxAsync( - Translate("Warning"), - warning, - Translate("Ok"), - DisappearingToken); - } - } private async Task AddAnotherActionAsync(ControllerEvent controllerEvent) { try diff --git a/BrickController2/BrickController2/UI/ViewModels/CreationListPageViewModel.cs b/BrickController2/BrickController2/UI/ViewModels/CreationListPageViewModel.cs index afca64f4..35c0fe41 100644 --- a/BrickController2/BrickController2/UI/ViewModels/CreationListPageViewModel.cs +++ b/BrickController2/BrickController2/UI/ViewModels/CreationListPageViewModel.cs @@ -41,7 +41,7 @@ public CreationListPageViewModel( IPlayLogic playLogic, IDialogService dialogService, ISharedFileStorageService sharedFileStorageService, - ICommandFactory commandFactory, + ICreationCommandFactory commandFactory, IBluetoothPermission bluetoothPermission, IReadWriteExternalStoragePermission readWriteExternalStoragePermission) : base(navigationService, translationService) @@ -62,7 +62,7 @@ public CreationListPageViewModel( AddCreationCommand = new SafeCommand(async () => await AddCreationAsync()); CreationTappedCommand = new SafeCommand(async creation => await NavigationService.NavigateToAsync(new NavigationParameters(("creation", creation)))); DeleteCreationCommand = new SafeCommand(async creation => await DeleteCreationAsync(creation)); - PlayCreationCommand = new SafeCommand(PlayAsync); + PlayCreationCommand = commandFactory.PlayCreationCommand(this); ShareCreationCommand = new SafeCommand(async creation => await NavigationService.NavigateToAsync(new NavigationParameters(("item", creation)))); NavigateToDevicesCommand = new SafeCommand(async () => await NavigationService.NavigateToAsync()); NavigateToInputDeviceTesterCommand = new SafeCommand(async () => await NavigationService.NavigateToAsync()); @@ -260,45 +260,5 @@ await _dialogService.ShowProgressDialogAsync( { } } - - private async Task PlayAsync(Creation creation) - { - try - { - var validationResult = _playLogic.ValidateCreation(creation); - - string warning = string.Empty; - switch (validationResult) - { - case CreationValidationResult.MissingControllerAction: - warning = Translate("NoControllerActions"); - break; - - case CreationValidationResult.MissingDevice: - warning = Translate("MissingDevices"); - break; - - case CreationValidationResult.MissingSequence: - warning = Translate("MissingSequence"); - break; - } - - if (validationResult == CreationValidationResult.Ok) - { - await NavigationService.NavigateToAsync(new NavigationParameters(("creation", creation))); - } - else - { - await _dialogService.ShowMessageBoxAsync( - Translate("Warning"), - Translate("Play") + $" '{creation.Name}': {warning}", - Translate("Ok"), - DisappearingToken); - } - } - catch (OperationCanceledException) - { - } - } } } \ No newline at end of file diff --git a/BrickController2/BrickController2/UI/ViewModels/CreationPageViewModel.cs b/BrickController2/BrickController2/UI/ViewModels/CreationPageViewModel.cs index 6ffe3140..a2a8cbb4 100644 --- a/BrickController2/BrickController2/UI/ViewModels/CreationPageViewModel.cs +++ b/BrickController2/BrickController2/UI/ViewModels/CreationPageViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Input; -using BrickController2.BusinessLogic; +using BrickController2.BusinessLogic; using BrickController2.CreationManagement; using BrickController2.CreationManagement.Sharing; using BrickController2.Helpers; @@ -11,6 +7,12 @@ using BrickController2.UI.Services.Dialog; using BrickController2.UI.Services.Navigation; using BrickController2.UI.Services.Translation; +using System; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Input; namespace BrickController2.UI.ViewModels { @@ -29,7 +31,7 @@ public CreationPageViewModel( ISharedFileStorageService sharedFileStorageService, IPlayLogic playLogic, ISharingManager sharingManagerProfile, - ICommandFactory commandFactory, + ICreationCommandFactory commandFactory, NavigationParameters parameters) : base(navigationService, translationService) { @@ -48,11 +50,12 @@ public CreationPageViewModel( RenameCreationCommand = new SafeCommand(async () => await RenameCreationAsync()); ShareCreationCommand = new SafeCommand(ShareCreationAsync); ShareCreationAsFileCommand = commandFactory.ShareAsJsonFileCommand(this, Creation); - PlayCommand = new SafeCommand(async () => await PlayAsync()); + PlayCommand = commandFactory.PlayCommand(this, Creation); + RemapDeviceCommand = commandFactory.RemapDeviceCommand(this, Creation); AddControllerProfileCommand = new SafeCommand(async () => await AddControllerProfileAsync()); ControllerProfileTappedCommand = new SafeCommand(async controllerProfile => await NavigationService.NavigateToAsync(new NavigationParameters(("controllerprofile", controllerProfile)))); DeleteControllerProfileCommand = new SafeCommand(async controllerProfile => await DeleteControllerProfileAsync(controllerProfile)); - PlayControllerProfileCommand = new SafeCommand(PlayAsync); + PlayControllerProfileCommand = commandFactory.PlayControllerProfileCommand(this); } public Creation Creation { get; } @@ -69,6 +72,7 @@ public CreationPageViewModel( public ICommand ShareCreationAsFileCommand { get; } public ICommand RenameCreationCommand { get; } public ICommand PlayCommand { get; } + public ICommand RemapDeviceCommand { get; } public ICommand AddControllerProfileCommand { get; } public ICommand ControllerProfileTappedCommand { get; } public ICommand DeleteControllerProfileCommand { get; } @@ -110,48 +114,6 @@ await _dialogService.ShowProgressDialogAsync( } } - private async Task PlayAsync(ControllerProfile? controllerProfile = default!) - { - try - { - var validationResult = _playLogic.ValidateCreation(Creation); - - string warning = string.Empty; - switch (validationResult) - { - case CreationValidationResult.MissingControllerAction: - warning = Translate("NoControllerActions"); - break; - - case CreationValidationResult.MissingDevice: - warning = Translate("MissingDevices"); - break; - - case CreationValidationResult.MissingSequence: - warning = Translate("MissingSequence"); - break; - } - - if (validationResult == CreationValidationResult.Ok) - { - await NavigationService.NavigateToAsync(new NavigationParameters( - ("creation", Creation), - ("profile", controllerProfile!))); - } - else - { - await _dialogService.ShowMessageBoxAsync( - Translate("Warning"), - warning, - Translate("Ok"), - DisappearingToken); - } - } - catch (OperationCanceledException) - { - } - } - private async Task AddControllerProfileAsync() { try @@ -184,8 +146,6 @@ await _dialogService.ShowProgressDialogAsync( async (progressDialog, token) => controllerProfile = await _creationManager.AddControllerProfileAsync(Creation, result.Result), Translate("Creating"), token: DisappearingToken); - // notify profile count change - RaisePropertyChanged(nameof(HasMultipleControllerProfiles)); await NavigationService.NavigateToAsync(new NavigationParameters(("controllerprofile", controllerProfile!))); } @@ -211,8 +171,6 @@ await _dialogService.ShowProgressDialogAsync( async (progressDialog, token) => await _creationManager.DeleteControllerProfileAsync(controllerProfile), Translate("Deleting"), token: DisappearingToken); - // notify profile count change - RaisePropertyChanged(nameof(HasMultipleControllerProfiles)); } } catch (OperationCanceledException)