1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using ExtendedGrid.Microsoft.Windows.Controls;
- using SciChart.Core.Extensions;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Runtime.Remoting.Metadata.W3cXsd2001;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Data;
- namespace MECF.Framework.UI.Client.Converter
- {
- public class SecondsToHourMinConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- return "";
- if (value is float floatResult)
- {
- var secondAll = Math.Round(floatResult, 1, MidpointRounding.AwayFromZero);
- // 将总秒数转换为时间跨度
- TimeSpan timeSpan = TimeSpan.FromSeconds(secondAll);
- // 格式化为 HH:mm:ss
- string formattedTime = $"{timeSpan.Hours:D2}:{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}";
- return formattedTime;
- }
- return "";
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return "";
- }
- }
- }
|