mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Added folder/layer renaming
Implemented profile saving
This commit is contained in:
1 parent
d8b0b2d4b6
commit
75e932edb1
20 files changed
+253
-62
No files matched your search
@@ -18,16 +18,15 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||
{
|
||||
public class ProfileEditorViewModel : Conductor<ProfileEditorPanelViewModel>.Collection.AllActive
|
||||
{
|
||||
private readonly IDialogService _dialogService;
|
||||
private readonly IProfileService _profileService;
|
||||
|
||||
public ProfileEditorViewModel(ProfileModule module, ICollection<ProfileEditorPanelViewModel> viewModels, IProfileService profileService, IDialogService dialogService)
|
||||
{
|
||||
_profileService = profileService;
|
||||
_dialogService = dialogService;
|
||||
|
||||
DisplayName = "Profile editor";
|
||||
Module = module;
|
||||
DialogService = dialogService;
|
||||
|
||||
DisplayConditionsViewModel = (DisplayConditionsViewModel) viewModels.First(vm => vm is DisplayConditionsViewModel);
|
||||
ElementPropertiesViewModel = (ElementPropertiesViewModel) viewModels.First(vm => vm is ElementPropertiesViewModel);
|
||||
@@ -42,6 +41,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||
}
|
||||
|
||||
public ProfileModule Module { get; }
|
||||
public IDialogService DialogService { get; }
|
||||
public DisplayConditionsViewModel DisplayConditionsViewModel { get; }
|
||||
public ElementPropertiesViewModel ElementPropertiesViewModel { get; }
|
||||
public LayerElementsViewModel LayerElementsViewModel { get; }
|
||||
@@ -68,8 +68,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||
|
||||
foreach (var panelViewModel in Items)
|
||||
{
|
||||
panelViewModel.Profile = profile;
|
||||
panelViewModel.OnProfileChanged();
|
||||
panelViewModel.ProfileEditorViewModel = this;
|
||||
panelViewModel.ActiveProfileChanged();
|
||||
}
|
||||
|
||||
if (oldProfile != null)
|
||||
@@ -87,14 +87,14 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||
|
||||
public async Task AddProfile()
|
||||
{
|
||||
var result = await _dialogService.ShowDialog<ProfileCreateViewModel>();
|
||||
var result = await DialogService.ShowDialog<ProfileCreateViewModel>();
|
||||
if (result is string name)
|
||||
CreateProfile(name);
|
||||
}
|
||||
|
||||
public async Task DeleteActiveProfile()
|
||||
{
|
||||
var result = await _dialogService.ShowConfirmDialog(
|
||||
var result = await DialogService.ShowConfirmDialog(
|
||||
"Delete active profile",
|
||||
"Are you sure you want to delete your currently active profile? This cannot be undone."
|
||||
);
|
||||
@@ -154,5 +154,15 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||
if (!activeProfile.IsActivated)
|
||||
Module.ChangeActiveProfile(activeProfile);
|
||||
}
|
||||
|
||||
public void OnProfileUpdated()
|
||||
{
|
||||
_profileService.UpdateProfile(SelectedProfile, true);
|
||||
|
||||
foreach (var panelViewModel in Items)
|
||||
{
|
||||
panelViewModel.ActiveProfileUpdated();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user