mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
Adjusting to force all instances to use rounded vs result due to Mage's quirks (#7164)
This commit is contained in:
@@ -14,10 +14,10 @@ namespace Microsoft.Plugin.Calculator
|
||||
{
|
||||
public static Result CreateResult(CalculateResult result, string iconPath)
|
||||
{
|
||||
return CreateResult(result.Result, result.RoundedResult, iconPath);
|
||||
return CreateResult(result.RoundedResult, iconPath);
|
||||
}
|
||||
|
||||
public static Result CreateResult(decimal result, decimal roundedResult, string iconPath)
|
||||
public static Result CreateResult(decimal roundedResult, string iconPath)
|
||||
{
|
||||
return new Result
|
||||
{
|
||||
@@ -25,18 +25,19 @@ namespace Microsoft.Plugin.Calculator
|
||||
IcoPath = iconPath,
|
||||
Score = 300,
|
||||
SubTitle = Properties.Resources.wox_plugin_calculator_copy_number_to_clipboard,
|
||||
Action = c => Action(result),
|
||||
Action = c => Action(roundedResult),
|
||||
};
|
||||
}
|
||||
|
||||
public static bool Action(decimal result)
|
||||
public static bool Action(decimal roundedResult)
|
||||
{
|
||||
var ret = false;
|
||||
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Clipboard.SetText(result.ToString(CultureInfo.CurrentUICulture.NumberFormat));
|
||||
Clipboard.SetText(roundedResult.ToString(CultureInfo.CurrentUICulture.NumberFormat));
|
||||
ret = true;
|
||||
}
|
||||
catch (ExternalException)
|
||||
@@ -44,9 +45,11 @@ namespace Microsoft.Plugin.Calculator
|
||||
MessageBox.Show(Properties.Resources.wox_plugin_calculator_copy_failed);
|
||||
}
|
||||
});
|
||||
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
thread.Join();
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user