mirror of
https://github.com/k1tbyte/Wand-Enhancer.git
synced 2026-08-31 23:01:26 +00:00
e04e313fa3
Introduce IShellView and IFileDialogs so MainWindowVm no longer holds the concrete window or reaches through MainWindow.Instance, and file pickers are injectable. Run Restore off the UI thread like Patch and gate both buttons on IsBusy. Gate the log commands on a non-empty log. Move runtime log messages into the locale dictionaries and add the 14 new keys to all 12 languages. Track the injected locale dictionary so switching language replaces it instead of appending a new one each time. Remove the unused InfoItem control, ToVisibilityInvertedConverter, mw_title and the popup placeholder title.
29 lines
872 B
C#
29 lines
872 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
|
|
namespace WandEnhancer.Converters
|
|
{
|
|
public abstract class BaseBooleanConverter<T> : IValueConverter
|
|
{
|
|
protected BaseBooleanConverter(T trueValue, T falseValue)
|
|
{
|
|
True = trueValue;
|
|
False = falseValue;
|
|
}
|
|
|
|
protected T True { get; set; }
|
|
protected T False { get; set; }
|
|
|
|
public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return value is bool booleanValue && booleanValue ? True : False;
|
|
}
|
|
|
|
public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return value is T t && EqualityComparer<T>.Default.Equals(t, True);
|
|
}
|
|
}
|
|
} |