20230724_MBJC_upperpc/Common/ConnectConvert.cs

54 lines
1.5 KiB
C#
Raw Normal View History

2023-12-16 03:58:14 +00:00
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;
namespace _20230724_MBJC_upperpc.Common
{
2024-01-17 01:24:32 +00:00
public class ConnectColorConvert : IValueConverter
2023-12-16 03:58:14 +00:00
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Brush TxtForeground = null;
if (value.ToString() == "True")
{
TxtForeground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
}
else
{
TxtForeground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
return TxtForeground;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
2024-01-17 01:24:32 +00:00
public class ConnectTextConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value.ToString() == "True")
{
return "已连接";
}
else
{
return "未连接";
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
2023-12-16 03:58:14 +00:00
}