mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Updating - Added UI for updating (actual update not yet implemented)
Shared UI - Added message service for easy access to the snackbar 🍟
This commit is contained in:
1 parent
45fef11a67
commit
883fccef7b
21 files changed
+777
-54
No files matched your search
@@ -8,16 +8,15 @@ namespace Artemis.UI.Screens.ProfileEditor.Dialogs
|
||||
{
|
||||
public class ProfileExportViewModel : DialogViewModelBase
|
||||
{
|
||||
private readonly ISnackbarMessageQueue _mainMessageQueue;
|
||||
|
||||
private readonly IProfileService _profileService;
|
||||
private readonly IMessageService _messageService;
|
||||
|
||||
public ProfileExportViewModel(ProfileDescriptor profileDescriptor, IProfileService profileService, ISnackbarMessageQueue mainMessageQueue)
|
||||
public ProfileExportViewModel(ProfileDescriptor profileDescriptor, IProfileService profileService, IMessageService messageService)
|
||||
{
|
||||
ProfileDescriptor = profileDescriptor;
|
||||
|
||||
_profileService = profileService;
|
||||
_mainMessageQueue = mainMessageQueue;
|
||||
_messageService = messageService;
|
||||
}
|
||||
|
||||
public ProfileDescriptor ProfileDescriptor { get; }
|
||||
@@ -26,7 +25,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Dialogs
|
||||
{
|
||||
string encoded = _profileService.ExportProfile(ProfileDescriptor);
|
||||
Clipboard.SetText(encoded);
|
||||
_mainMessageQueue.Enqueue("Profile contents exported to clipboard.");
|
||||
_messageService.ShowMessage("Profile contents exported to clipboard.");
|
||||
|
||||
Session.Close();
|
||||
}
|
||||
|
||||
@@ -11,15 +11,16 @@ namespace Artemis.UI.Screens.ProfileEditor.Dialogs
|
||||
{
|
||||
private readonly ISnackbarMessageQueue _mainMessageQueue;
|
||||
private readonly IProfileService _profileService;
|
||||
private readonly IMessageService _messageService;
|
||||
private string _profileJson;
|
||||
|
||||
public ProfileImportViewModel(ProfileModule profileModule, IProfileService profileService, ISnackbarMessageQueue mainMessageQueue)
|
||||
public ProfileImportViewModel(ProfileModule profileModule, IProfileService profileService, IMessageService messageService)
|
||||
{
|
||||
ProfileModule = profileModule;
|
||||
Document = new TextDocument();
|
||||
|
||||
_profileService = profileService;
|
||||
_mainMessageQueue = mainMessageQueue;
|
||||
_messageService = messageService;
|
||||
}
|
||||
|
||||
public ProfileModule ProfileModule { get; }
|
||||
@@ -34,7 +35,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Dialogs
|
||||
public void Accept()
|
||||
{
|
||||
ProfileDescriptor descriptor = _profileService.ImportProfile(Document.Text, ProfileModule);
|
||||
_mainMessageQueue.Enqueue("Profile imported.");
|
||||
_messageService.ShowMessage("Profile imported.");
|
||||
Session.Close(descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
public class ProfileEditorViewModel : Screen
|
||||
{
|
||||
private readonly IModuleService _moduleService;
|
||||
private readonly IMessageService _messageService;
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private readonly IProfileService _profileService;
|
||||
private readonly ISettingsService _settingsService;
|
||||
private readonly ISnackbarMessageQueue _snackbarMessageQueue;
|
||||
private PluginSetting<GridLength> _bottomPanelsHeight;
|
||||
private PluginSetting<GridLength> _dataModelConditionsHeight;
|
||||
private DisplayConditionsViewModel _displayConditionsViewModel;
|
||||
@@ -47,13 +47,13 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
IDialogService dialogService,
|
||||
ISettingsService settingsService,
|
||||
IModuleService moduleService,
|
||||
ISnackbarMessageQueue snackbarMessageQueue)
|
||||
IMessageService messageService)
|
||||
{
|
||||
_profileEditorService = profileEditorService;
|
||||
_profileService = profileService;
|
||||
_settingsService = settingsService;
|
||||
_moduleService = moduleService;
|
||||
_snackbarMessageQueue = snackbarMessageQueue;
|
||||
_messageService = messageService;
|
||||
|
||||
DisplayName = "PROFILE EDITOR";
|
||||
Module = module;
|
||||
@@ -242,7 +242,7 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
|
||||
if (!_profileEditorService.UndoUpdateProfile())
|
||||
{
|
||||
_snackbarMessageQueue.Enqueue("Nothing to undo");
|
||||
_messageService.ShowMessage("Nothing to undo");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
focusedElement?.Focus();
|
||||
});
|
||||
|
||||
_snackbarMessageQueue.Enqueue("Undid profile update", "REDO", Redo);
|
||||
_messageService.ShowMessage("Undid profile update", "REDO", Redo);
|
||||
}
|
||||
|
||||
public void Redo()
|
||||
@@ -269,7 +269,7 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
|
||||
if (!_profileEditorService.RedoUpdateProfile())
|
||||
{
|
||||
_snackbarMessageQueue.Enqueue("Nothing to redo");
|
||||
_messageService.ShowMessage("Nothing to redo");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
focusedElement?.Focus();
|
||||
});
|
||||
|
||||
_snackbarMessageQueue.Enqueue("Redid profile update", "UNDO", Undo);
|
||||
_messageService.ShowMessage("Redid profile update", "UNDO", Undo);
|
||||
}
|
||||
|
||||
protected override void OnInitialActivate()
|
||||
|
||||
Reference in new issue
Block a user