You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Data;
|
|
|
|
namespace XGLFinishPro.Tools
|
|
{
|
|
public class NetStatusToColorConvert : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
|
|
int second = 0;
|
|
if (value != null)
|
|
{
|
|
if (int.TryParse(value.ToString(), out second))
|
|
{
|
|
if (second > 0 && second <= 20)
|
|
{
|
|
return Brushes.Green;
|
|
//System.Windows.Media.ColorConverter.ConvertFromString("#FF4FEE4F");
|
|
}
|
|
else if (second > 20 && second <= 40)
|
|
{
|
|
return Brushes.Orange;
|
|
}
|
|
else
|
|
{
|
|
return Brushes.Red;
|
|
}
|
|
}
|
|
}
|
|
|
|
return Brushes.Red;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
}
|