36 lines
942 B
C#
36 lines
942 B
C#
/*
|
|
* Copyright (c) 2025 LG Electronics Inc.
|
|
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
|
|
*/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Data;
|
|
|
|
namespace AuroraUIComponent.UIConverter
|
|
{
|
|
public class TimeConverter : IValueConverter
|
|
{
|
|
public string StrFormat { get; } = "MM/dd HH:mm:ss.fff";
|
|
public string UnsetValue { get; } = "-";
|
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if ((DateTime)value == default(DateTime)) {
|
|
return UnsetValue;
|
|
}
|
|
|
|
return ((DateTime)value).ToString(StrFormat);
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return parameter;
|
|
}
|
|
}
|
|
}
|