2020-08-07 02:16:25 +08:00
|
|
|
|
// 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.
|
|
|
|
|
|
2020-07-25 06:46:29 +08:00
|
|
|
|
using System;
|
2020-07-25 03:02:56 +08:00
|
|
|
|
using Windows.UI.Xaml;
|
|
|
|
|
using Windows.UI.Xaml.Data;
|
|
|
|
|
using Windows.UI.Xaml.Media;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Converters
|
|
|
|
|
{
|
|
|
|
|
public sealed class ModuleEnabledToForegroundConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, string language)
|
|
|
|
|
{
|
|
|
|
|
bool isEnabled = (bool)value;
|
2020-07-30 02:38:03 +08:00
|
|
|
|
|
2021-02-26 19:21:58 +08:00
|
|
|
|
if (App.IsDarkTheme())
|
2020-07-25 03:02:56 +08:00
|
|
|
|
{
|
2020-07-30 02:38:03 +08:00
|
|
|
|
// DARK
|
|
|
|
|
if (isEnabled)
|
|
|
|
|
{
|
|
|
|
|
return (SolidColorBrush)Application.Current.Resources["DarkForegroundBrush"];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return (SolidColorBrush)Application.Current.Resources["DarkForegroundDisabledBrush"];
|
|
|
|
|
}
|
2020-07-25 03:02:56 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-07-30 02:38:03 +08:00
|
|
|
|
// LIGHT
|
|
|
|
|
if (isEnabled)
|
|
|
|
|
{
|
|
|
|
|
return (SolidColorBrush)Application.Current.Resources["LightForegroundBrush"];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return (SolidColorBrush)Application.Current.Resources["LightForegroundDisabledBrush"];
|
|
|
|
|
}
|
2020-07-25 03:02:56 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
|
|
|
|
{
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-25 06:46:29 +08:00
|
|
|
|
}
|