2025-10-11 18:25:59 +08:00

28 lines
750 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Globalization;
namespace XiaoZhiSharp_MauiApp.Converters
{
public class IntToSecondsConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is int frames)
{
// 每帧60ms转换为秒
return frames * 0.06;
}
return 0.0;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double seconds)
{
// 秒转换为帧数
return (int)(seconds / 0.06);
}
return 0;
}
}
}