diff options
author | sr55 <[email protected]> | 2019-10-13 18:03:58 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2019-10-13 18:03:58 +0100 |
commit | 4a75f67486474b024d2264481cbe9e172a3e98f4 (patch) | |
tree | ab820962a0721273049cdee018ab5b15f4fa8c36 /win/CS/HandBrakeWPF/Converters | |
parent | d6658751f5694e60df5d74481120098c50dff5d5 (diff) |
WinGui: Catchup some remaining strings that were not localisable. #2345
Diffstat (limited to 'win/CS/HandBrakeWPF/Converters')
4 files changed, 156 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/Options/Mp4BehaviourConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/Mp4BehaviourConverter.cs new file mode 100644 index 000000000..2ef6ad204 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Options/Mp4BehaviourConverter.cs @@ -0,0 +1,24 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="Mp4BehaviourConverter.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Process Priority Converter +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters.Options +{ + using System; + using System.ComponentModel; + using System.Globalization; + using System.Linq; + using System.Windows.Data; + + using HandBrakeWPF.Model.Options; + using HandBrakeWPF.Utilities; + + public class Mp4BehaviourConverter : ResourceConverterBase<Mp4Behaviour>, IValueConverter + { + } +} diff --git a/win/CS/HandBrakeWPF/Converters/Options/ProcessPriorityConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/ProcessPriorityConverter.cs new file mode 100644 index 000000000..2ab2bac66 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Options/ProcessPriorityConverter.cs @@ -0,0 +1,24 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="ProcessPriorityConverter.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Process Priority Converter +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters.Options +{ + using System; + using System.ComponentModel; + using System.Globalization; + using System.Linq; + using System.Windows.Data; + + using HandBrakeWPF.Model.Options; + using HandBrakeWPF.Utilities; + + public class ProcessPriorityConverter : ResourceConverterBase<ProcessPriority>, IValueConverter + { + } +} diff --git a/win/CS/HandBrakeWPF/Converters/Options/UpdateCheckConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/UpdateCheckConverter.cs new file mode 100644 index 000000000..3f4de9df7 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Options/UpdateCheckConverter.cs @@ -0,0 +1,19 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="UpdateCheckConverter.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the UpdateCheckConverter type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters.Options +{ + using System.Windows.Data; + + using HandBrakeWPF.Model.Options; + + public class UpdateCheckConverter : ResourceConverterBase<UpdateCheck>, IValueConverter + { + } +} diff --git a/win/CS/HandBrakeWPF/Converters/ResourceConverterBase.cs b/win/CS/HandBrakeWPF/Converters/ResourceConverterBase.cs new file mode 100644 index 000000000..36a588f59 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/ResourceConverterBase.cs @@ -0,0 +1,89 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="ResourceConverterBase.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the ResourceConverterBase type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters +{ + using System; + using System.Collections.Generic; + using System.ComponentModel; + using System.Globalization; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + + using HandBrakeWPF.Model.Options; + using HandBrakeWPF.Utilities; + + public class ResourceConverterBase<T> + { + /// <summary> + /// The convert. + /// </summary> + /// <param name="value"> + /// The value. + /// </param> + /// <param name="targetType"> + /// The target type. + /// </param> + /// <param name="parameter"> + /// The parameter. + /// </param> + /// <param name="culture"> + /// The culture. + /// </param> + /// <returns> + /// The <see cref="object"/>. + /// </returns> + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null && value.GetType() == typeof(BindingList<T>)) + { + return + new BindingList<string>( + EnumHelper<T>.GetEnumDisplayValues(typeof(T)).ToList()); + } + + if (value != null && value.GetType() == typeof(T)) + { + return EnumHelper<T>.GetDisplay((T)value); + } + + return null; + } + + /// <summary> + /// The convert back. + /// </summary> + /// <param name="value"> + /// The value. + /// </param> + /// <param name="targetType"> + /// The target type. + /// </param> + /// <param name="parameter"> + /// The parameter. + /// </param> + /// <param name="culture"> + /// The culture. + /// </param> + /// <returns> + /// The <see cref="object"/>. + /// </returns> + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + string name = value as string; + if (!string.IsNullOrEmpty(name)) + { + return EnumHelper<T>.GetValue(name); + } + + return null; + } + } +} |