1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00
Artemis/src/Artemis.UI/Screens/ProfileEditor/Dialogs/ProfileExportViewModel.cs
Robert 87dce788d7 UI - Added --disable-forced-shutdown which does just that
UI - Don't kill new instances of Artemis launched within 8 seconds after shutdown
UI - Updated About tab
2021-05-19 17:31:36 +02:00

49 lines
1.4 KiB
C#

using System.Windows;
using System.Windows.Navigation;
using Artemis.Core;
using Artemis.Core.Services;
using Artemis.UI.Shared.Services;
namespace Artemis.UI.Screens.ProfileEditor.Dialogs
{
public class ProfileExportViewModel : DialogViewModelBase
{
private readonly IProfileService _profileService;
private readonly IMessageService _messageService;
public ProfileExportViewModel(ProfileDescriptor profileDescriptor, IProfileService profileService, IMessageService messageService)
{
ProfileDescriptor = profileDescriptor;
_profileService = profileService;
_messageService = messageService;
}
public ProfileDescriptor ProfileDescriptor { get; }
#region Overrides of Screen
/// <inheritdoc />
protected override void OnActivate()
{
// TODO: If the profile has hints on all layers, call Accept
base.OnActivate();
}
#endregion
public void OpenHyperlink(object sender, RequestNavigateEventArgs e)
{
Core.Utilities.OpenUrl(e.Uri.AbsoluteUri);
}
public void Accept()
{
string encoded = _profileService.ExportProfile(ProfileDescriptor);
Clipboard.SetText(encoded);
_messageService.ShowMessage("Profile contents exported to clipboard.");
Session.Close();
}
}
}