JD2022-TU1/main/tools/modules/JD.AssetBrowser/Actions/Asset/CopyLocalPathAction.cs

34 lines
982 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using JD.AssetBrowser.ViewModel;
using Plume.Interfaces.WPF.Actions;
namespace JD.AssetBrowser.Actions.Asset
{
class CopyLocalPathAction : Plume.Interfaces.WPF.Actions.Action<AssetViewModel>
{
/// <inheritdoc />
public CopyLocalPathAction() :
base("Copy Local Path", "Copy Local Path", null, null, null)
{
}
/// <inheritdoc />
public override void Execute(IActionContext context, AssetViewModel asset)
{
Clipboard.SetText(asset.Model.Path.RelativeUri);
context.NotificationManager.ShowSuccess($"Path '{asset.Model.Path.RelativeUri}' copied in clipboard.");
}
/// <inheritdoc />
public override bool CanExecute(IActionContext context, AssetViewModel parameter)
{
return true;
}
}
}