// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // Defines the QueueStatusToVisibilityConverter type. // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Converters { using System.Globalization; using System.Windows; using System.Windows.Data; using System; using HandBrake.ApplicationServices.Model; using HandBrakeWPF.Services.Queue.Model; /// /// Boolean to Visibility Converter /// public sealed class QueueStatusToVisibilityConverter : IValueConverter { /// /// Convert a boolean to visibility property. /// /// /// The value. /// /// /// The target type. /// /// /// The parameter. (A boolean which inverts the output) /// /// /// The culture. /// /// /// Visibility property /// public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { QueueItemStatus status = (QueueItemStatus)value; switch (status) { case QueueItemStatus.Waiting: case QueueItemStatus.InProgress: return Visibility.Collapsed; default: return Visibility.Visible; } } return Visibility.Collapsed; } /// /// Convert Back for the IValueConverter Interface. Not used! /// /// /// The value. /// /// /// The target type. /// /// /// The parameter. /// /// /// The culture. /// /// /// Nothing /// /// /// This method is not used! /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }