using Aitex.Core.Common.DeviceData.IoDevice;
using System.Globalization;
using System;
using System.Windows.Controls;
using System.Windows.Data;
using MECF.Framework.Common.Aitex.Core.Common.DeviceData;

namespace MECF.Framework.UI.Client.Ctrlib.Controls
{
    /// <summary>
    /// CoolingWaterResPresenter.xaml 的交互逻辑
    /// </summary>
    public partial class CoolingWaterDataPresenter : UserControl
    {
        public CoolingWaterDataPresenter()
        {
            InitializeComponent();
        }
    }


    internal class CoolingWaterAlarmTipsConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is AITWaterFlowData data)
            {
                return $"Realtime: {data.Value:F1}℃" +
                       $"\r\nWarning: {(data.IsWarning?"Yes" : "No")}" +
                       $"\r\nAlarm: {(data.IsAlarm?"Yes" : "No")}" +
                       $"\r\nWarning Range: {data.WarningLimitLow:F1}℃ - {data.WarningLimitHigh:F1}℃" +
                       $"\r\nAlarm Range: {data.AlarmLimitLow:F1}℃ - {data.AlarmLimitHigh:F1}℃" +
                       $"\r\nWater Flow:  {(data.IsFlowSW ? "Normal" : "Fault")}";
            }
            else
            {
                return "";
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
