74 lines
2.6 KiB
C#
74 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
using System.Windows.Interactivity;
|
|
using System.Windows.Media;
|
|
|
|
namespace MECF.Framework.UI.Client.CenterViews.Maintain
|
|
{
|
|
public class Booleans2MaintainStatusConverter : Behavior<Booleans2MaintainStatusConverter>, IMultiValueConverter
|
|
{
|
|
public ImageSource UnMaintainImage
|
|
{
|
|
get { return (ImageSource)GetValue(UnMaintainImageProperty); }
|
|
set { SetValue(UnMaintainImageProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty UnMaintainImageProperty =
|
|
DependencyProperty.Register("UnMaintainImage", typeof(ImageSource), typeof(Booleans2MaintainStatusConverter), new PropertyMetadata(null));
|
|
|
|
public ImageSource UnMaintainButTimeOutImage
|
|
{
|
|
get { return (ImageSource)GetValue(UnMaintainButTimeOutImageProperty); }
|
|
set { SetValue(UnMaintainButTimeOutImageProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty UnMaintainButTimeOutImageProperty =
|
|
DependencyProperty.Register("UnMaintainButTimeOutImage", typeof(ImageSource), typeof(Booleans2MaintainStatusConverter), new PropertyMetadata(null));
|
|
|
|
public ImageSource MaintainImage
|
|
{
|
|
get { return (ImageSource)GetValue(MaintainImageProperty); }
|
|
set { SetValue(MaintainImageProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty MaintainImageProperty =
|
|
DependencyProperty.Register("MaintainImage", typeof(ImageSource), typeof(Booleans2MaintainStatusConverter), new PropertyMetadata(null));
|
|
|
|
public object Convert(object[] values, Type targetType, object parameter,
|
|
CultureInfo culture)
|
|
{
|
|
if (values != null && values.Length == 2)
|
|
{
|
|
bool ismaintained = (bool)values[0];
|
|
bool timeout = (bool)values[1];
|
|
if (!ismaintained)
|
|
{
|
|
if (!timeout)
|
|
{
|
|
return UnMaintainImage;
|
|
}
|
|
else return UnMaintainButTimeOutImage;
|
|
}
|
|
else
|
|
return MaintainImage;
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter,
|
|
CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|