mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +08:00
[Launcher] Fix Copying of calculator value (#2929)
This commit is contained in:
parent
ce96e34d25
commit
688fefc4dd
@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Mages.Core;
|
using Mages.Core;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
@ -56,16 +57,23 @@ namespace Microsoft.Plugin.Caculator
|
|||||||
SubTitle = Context.API.GetTranslation("wox_plugin_calculator_copy_number_to_clipboard"),
|
SubTitle = Context.API.GetTranslation("wox_plugin_calculator_copy_number_to_clipboard"),
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
try
|
var ret = false;
|
||||||
|
var thread = new Thread(() =>
|
||||||
{
|
{
|
||||||
Clipboard.SetText(result.ToString());
|
try
|
||||||
return true;
|
{
|
||||||
}
|
Clipboard.SetText(result.ToString());
|
||||||
catch (ExternalException)
|
ret = true;
|
||||||
{
|
}
|
||||||
MessageBox.Show("Copy failed, please try later");
|
catch (ExternalException)
|
||||||
return false;
|
{
|
||||||
}
|
MessageBox.Show("Copy failed, please try later");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
thread.SetApartmentState(ApartmentState.STA);
|
||||||
|
thread.Start();
|
||||||
|
thread.Join();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user