1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 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 FurnaceUI.Converter
- {
- public class TempModeConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is string)
- {
- if (((string)value).Contains("(") && ((string)value).Contains(")"))
- {
- var tempStr = (string)value;
- var newTempStr = new string(tempStr.Skip(tempStr.IndexOf('(')+1).Take(tempStr.IndexOf(')') - tempStr.IndexOf('(')-1).ToArray());
- string[] listStr = newTempStr.Split(',');
- if (listStr.Length != 3)
- { return value; }
- else
- {
- string tttt = $"{new string(tempStr.Take(tempStr.IndexOf('(')).ToArray())}({listStr[1]}:{listStr[2]})";
- return tttt;
- }
- }
- else
- {
- return value;
- }
- }
- else
- return value;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|