mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-16 12:39:16 +08:00
40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using Wox.Core.UserSettings;
|
|
|
|
namespace Wox.Converters
|
|
{
|
|
public class OpacityModeConverter : ConvertorBase<OpacityModeConverter>
|
|
{
|
|
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (!(value is OpacityMode)) return value.ToString();
|
|
var mode = (OpacityMode) value;
|
|
switch (mode)
|
|
{
|
|
case OpacityMode.Normal:
|
|
return "Normal Window";
|
|
case OpacityMode.LayeredWindow:
|
|
{
|
|
if (Environment.OSVersion.Version.Major < 5)
|
|
return "Layered Window (not supported by your Windows)";
|
|
if (Environment.OSVersion.Version.Major == 5)
|
|
return "Layered Window (not recommended on your Windows)";
|
|
return "Layered Window";
|
|
}
|
|
case OpacityMode.DWM:
|
|
{
|
|
if (Environment.OSVersion.Version.Major < 6)
|
|
return "DWM-Enabled Window (not supported by your Windows)";
|
|
return "DWM-Enabled Window";
|
|
}
|
|
}
|
|
return value.ToString();
|
|
}
|
|
|
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
{
|
|
return this;
|
|
}
|
|
}
|
|
} |