95 lines
3.6 KiB
C#
95 lines
3.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.Data;
|
|
using System.Windows.Media;
|
|
using System.Windows;
|
|
using Aurora;
|
|
using AuroraChiller;
|
|
|
|
namespace AuroraChiller.SMC
|
|
{
|
|
class ChillerConverter_ChillerStatus : IValueConverter {
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
|
|
if (value is bool) {
|
|
if ((bool)value == false) {
|
|
var tokenStopped = Application.Current.FindStrToken("Stopped");
|
|
return tokenStopped;
|
|
} else if ((bool)value == true) {
|
|
var tokenInOperation = Application.Current.FindStrToken("InOperation");
|
|
return tokenInOperation;
|
|
} else {
|
|
return "Unknown";
|
|
}
|
|
}
|
|
return "Unknown";
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
|
|
class ChillerConverter_ChillerStatusColor : IValueConverter {
|
|
private SolidColorBrush _LightGreen = new SolidColorBrush(Colors.LightGreen);
|
|
private SolidColorBrush _Red = new SolidColorBrush(Colors.Red);
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
|
|
if (value is bool) {
|
|
if ((bool)value == true) {
|
|
return _LightGreen;
|
|
} else {
|
|
return _Red;
|
|
}
|
|
}
|
|
return _Red;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
|
|
class ChillerConverter_TemperatureStatus : IValueConverter {
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
|
|
if (value is eTemperatureStatus) {
|
|
return ((eTemperatureStatus)value).ToString();
|
|
}
|
|
return "Unknown";
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
|
|
class ChillerConverter_TemperatureStatusColor : IValueConverter {
|
|
private SolidColorBrush _LightGreen = new SolidColorBrush(Colors.LightGreen);
|
|
private SolidColorBrush _Yellow = new SolidColorBrush(Colors.Yellow);
|
|
private SolidColorBrush _Red = new SolidColorBrush(Colors.Red);
|
|
private SolidColorBrush _White = new SolidColorBrush(Colors.White);
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
|
|
if (value is eTemperatureStatus) {
|
|
if ((eTemperatureStatus)value == eTemperatureStatus.OK) {
|
|
return _LightGreen;
|
|
} else if ((eTemperatureStatus)value == eTemperatureStatus.WARNING_HIGH
|
|
|| (eTemperatureStatus)value == eTemperatureStatus.WARNING_LOW) {
|
|
return _Yellow;
|
|
} else if ((eTemperatureStatus)value == eTemperatureStatus.ERROR_HIGH
|
|
|| (eTemperatureStatus)value == eTemperatureStatus.ERROR_LOW) {
|
|
return _Red;
|
|
}
|
|
}
|
|
return _White;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|