diff --git a/src/modules/launcher/PowerLauncher/Converters/NegativeValueConverter.cs b/src/modules/launcher/PowerLauncher/Converters/NegativeValueConverter.cs new file mode 100644 index 00000000000..9e03d627002 --- /dev/null +++ b/src/modules/launcher/PowerLauncher/Converters/NegativeValueConverter.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Globalization; +using System.Windows.Data; + +namespace PowerLauncher.Converters +{ + public class NegativeValueConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is double doubleValue) + { + return -doubleValue; + } + + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/modules/launcher/PowerLauncher/Converters/SumConverter.cs b/src/modules/launcher/PowerLauncher/Converters/SumConverter.cs new file mode 100644 index 00000000000..2dec99a7aa5 --- /dev/null +++ b/src/modules/launcher/PowerLauncher/Converters/SumConverter.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Globalization; +using System.Windows.Data; + +namespace PowerLauncher.Converters +{ + public class SumConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + var sum = 0.0d; + + foreach (var value in values) + { + if (value is double number) + { + sum += number; + } + else if (value is string strNumber) + { + sum += double.Parse(strNumber, NumberStyles.Any, CultureInfo.InvariantCulture); + } + else + { + throw new NotImplementedException(); + } + } + + return sum; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/modules/launcher/PowerLauncher/ResultList.xaml b/src/modules/launcher/PowerLauncher/ResultList.xaml index 7eda85a709f..f27d7346d02 100644 --- a/src/modules/launcher/PowerLauncher/ResultList.xaml +++ b/src/modules/launcher/PowerLauncher/ResultList.xaml @@ -8,7 +8,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:p="clr-namespace:PowerLauncher.Properties" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" - xmlns:viewmodel="clr-namespace:PowerLauncher.ViewModel" + xmlns:viewmodel="clr-namespace:PowerLauncher.ViewModel" xmlns:sys="clr-namespace:System;assembly=mscorlib" d:DesignHeight="300" d:DesignWidth="720" mc:Ignorable="d"> @@ -16,6 +16,8 @@ + + + + + + + +