mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 20:57:22 +02:00
[PTRun][Calculator]Replace input with result with '=' key (#31391)
* replace input with result * fix and add test * add options and use result property
This commit is contained in:
committed by
GitHub
parent
e573b7a1b1
commit
92c85630a9
@@ -12,12 +12,12 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
||||
{
|
||||
public static class ResultHelper
|
||||
{
|
||||
public static Result CreateResult(CalculateResult result, string iconPath, CultureInfo culture)
|
||||
public static Result CreateResult(CalculateResult result, string iconPath, CultureInfo inputCulture, CultureInfo outputCulture)
|
||||
{
|
||||
return CreateResult(result.RoundedResult, iconPath, culture);
|
||||
return CreateResult(result.RoundedResult, iconPath, inputCulture, outputCulture);
|
||||
}
|
||||
|
||||
public static Result CreateResult(decimal? roundedResult, string iconPath, CultureInfo culture)
|
||||
public static Result CreateResult(decimal? roundedResult, string iconPath, CultureInfo inputCulture, CultureInfo outputCulture)
|
||||
{
|
||||
// Return null when the expression is not a valid calculator query.
|
||||
if (roundedResult == null)
|
||||
@@ -28,11 +28,12 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
||||
return new Result
|
||||
{
|
||||
// Using CurrentCulture since this is user facing
|
||||
Title = roundedResult?.ToString(culture),
|
||||
Title = roundedResult?.ToString(outputCulture),
|
||||
IcoPath = iconPath,
|
||||
Score = 300,
|
||||
SubTitle = Properties.Resources.wox_plugin_calculator_copy_number_to_clipboard,
|
||||
Action = c => Action(roundedResult, culture),
|
||||
Action = c => Action(roundedResult, outputCulture),
|
||||
QueryTextDisplay = roundedResult?.ToString(inputCulture),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user