chore: 设置剪切板前先清空

This commit is contained in:
uye
2025-07-06 22:45:52 +08:00
parent 650a48b8a5
commit 38ca800031
3 changed files with 5 additions and 0 deletions

View File

@@ -469,6 +469,7 @@ namespace MaaWpfGui.ViewModels.UI
// ReSharper disable once UnusedMember.Global
public void ExportToArkplanner()
{
System.Windows.Forms.Clipboard.Clear();
System.Windows.Forms.Clipboard.SetDataObject(ArkPlannerResult);
DepotInfo = LocalizationHelper.GetString("CopiedToClipboard");
}
@@ -480,6 +481,7 @@ namespace MaaWpfGui.ViewModels.UI
// ReSharper disable once UnusedMember.Global
public void ExportToLolicon()
{
System.Windows.Forms.Clipboard.Clear();
System.Windows.Forms.Clipboard.SetDataObject(LoliconResult);
DepotInfo = LocalizationHelper.GetString("CopiedToClipboard");
}
@@ -724,6 +726,7 @@ namespace MaaWpfGui.ViewModels.UI
return;
}
System.Windows.Forms.Clipboard.Clear();
System.Windows.Forms.Clipboard.SetDataObject(JsonConvert.SerializeObject(OperBoxHaveList.Concat(OperBoxNotHaveList), Formatting.Indented));
OperBoxInfo = LocalizationHelper.GetString("CopiedToClipboard");
}

View File

@@ -166,6 +166,7 @@ namespace MaaWpfGui.Views.UI
try
{
System.Windows.Forms.Clipboard.Clear();
System.Windows.Forms.Clipboard.SetDataObject(data, true);
}
catch

View File

@@ -88,6 +88,7 @@ namespace MaaWpfGui.Views.UserControl.Settings
{
try
{
System.Windows.Forms.Clipboard.Clear();
System.Windows.Forms.Clipboard.SetDataObject(text, true);
}
catch (Exception e)