From f3fcc49085f080ad5f075da4a87bbaff47f92572 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 13 Jan 2013 17:51:42 +0000 Subject: WinGui: Options screen refactoring. Help -> Check for updates now takes the user to the options screen update tab. Help -> About now takes the user to the options screen about tab. Saves popping up annoying window. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5169 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Converters/Options/OptionsTabConverter.cs | 27 ++++---- .../Converters/Options/OptionsTabNameConverter.cs | 71 ++++++++++++++++++++++ 2 files changed, 87 insertions(+), 11 deletions(-) create mode 100644 win/CS/HandBrakeWPF/Converters/Options/OptionsTabNameConverter.cs (limited to 'win/CS/HandBrakeWPF/Converters') diff --git a/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs index 9c561e549..128596f3f 100644 --- a/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs @@ -15,6 +15,8 @@ namespace HandBrakeWPF.Converters.Options using System.Windows; using System.Windows.Data; + using HandBrakeWPF.Model; + /// /// The Options Tab Converter. Controls which tab is dispalyed. /// @@ -31,22 +33,25 @@ namespace HandBrakeWPF.Converters.Options { if (value != null && parameter != null) { - switch (value.ToString()) + switch ((OptionsTab)value) { - case "General": - if (parameter.ToString() == "General") return Visibility.Visible; + case OptionsTab.General: + if ((OptionsTab)parameter == OptionsTab.General) return Visibility.Visible; + break; + case OptionsTab.OutputFiles: + if ((OptionsTab)parameter == OptionsTab.OutputFiles) return Visibility.Visible; break; - case "Output Files": - if (parameter.ToString() == "Output Files") return Visibility.Visible; + case OptionsTab.AudioAndSubtitles: + if ((OptionsTab)parameter == OptionsTab.AudioAndSubtitles) return Visibility.Visible; break; - case "Audio and Subtitles": - if (parameter.ToString() == "Audio and Subtitles") return Visibility.Visible; + case OptionsTab.Advanced: + if ((OptionsTab)parameter == OptionsTab.Advanced) return Visibility.Visible; break; - case "Advanced": - if (parameter.ToString() == "Advanced") return Visibility.Visible; + case OptionsTab.Updates: + if ((OptionsTab)parameter == OptionsTab.Updates) return Visibility.Visible; break; - case "Updates": - if (parameter.ToString() == "Updates") return Visibility.Visible; + case OptionsTab.About: + if ((OptionsTab)parameter == OptionsTab.About) return Visibility.Visible; break; } } diff --git a/win/CS/HandBrakeWPF/Converters/Options/OptionsTabNameConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabNameConverter.cs new file mode 100644 index 000000000..beddd18be --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabNameConverter.cs @@ -0,0 +1,71 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// A Converter to get the Display Name of each options tab. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters.Options +{ + using System; + using System.Globalization; + using System.Windows.Data; + + using HandBrake.ApplicationServices.Utilities; + + using HandBrakeWPF.Model; + + /// + /// A Converter to get the Display Name of each options tab. + /// + public class OptionsTabNameConverter : IValueConverter + { + /// + /// The convert. + /// + /// + /// The value. + /// + /// + /// The target type. + /// + /// + /// The parameter. + /// + /// + /// The culture. + /// + /// + /// The . + /// + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return EnumHelper.GetDisplay((OptionsTab)value); + } + + /// + /// The convert back. + /// + /// + /// The value. + /// + /// + /// The target type. + /// + /// + /// The parameter. + /// + /// + /// The culture. + /// + /// + /// The . + /// + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return EnumHelper.GetValue(value.ToString()); + } + } +} \ No newline at end of file -- cgit v1.2.3