diff --git a/Wox.Infrastructure/StringEmptyConverter.cs b/Wox.Infrastructure/StringEmptyConverter.cs new file mode 100644 index 0000000000..f553695737 --- /dev/null +++ b/Wox.Infrastructure/StringEmptyConverter.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Wox.Infrastructure +{ + public class StringEmptyConverter : MarkupExtension, IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return string.IsNullOrEmpty((string)value) ? parameter : value; + } + + public object ConvertBack( + object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotSupportedException(); + } + + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } + } +} diff --git a/Wox.Infrastructure/StringNullOrEmptyToVisibilityConverter.cs b/Wox.Infrastructure/StringNullOrEmptyToVisibilityConverter.cs new file mode 100644 index 0000000000..841b446a51 --- /dev/null +++ b/Wox.Infrastructure/StringNullOrEmptyToVisibilityConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Wox.Infrastructure +{ + public class StringNullOrEmptyToVisibilityConverter : MarkupExtension, IValueConverter + { + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + } +} \ No newline at end of file diff --git a/Wox.Infrastructure/Wox.Infrastructure.csproj b/Wox.Infrastructure/Wox.Infrastructure.csproj index 435388f399..33d9868d26 100644 --- a/Wox.Infrastructure/Wox.Infrastructure.csproj +++ b/Wox.Infrastructure/Wox.Infrastructure.csproj @@ -37,6 +37,7 @@ ..\packages\Newtonsoft.Json.5.0.8\lib\net35\Newtonsoft.Json.dll + @@ -60,6 +61,8 @@ + + diff --git a/Wox.Plugin.System/ProgramSetting.xaml b/Wox.Plugin.System/ProgramSetting.xaml new file mode 100644 index 0000000000..ffb082efa3 --- /dev/null +++ b/Wox.Plugin.System/ProgramSetting.xaml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +