mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-10 21:41:51 +02:00
Extract all converters into separate folder
This commit is contained in:
40
Wox/Converters/OpacityModeConverter.cs
Normal file
40
Wox/Converters/OpacityModeConverter.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Wox.Infrastructure.Storage.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user