Push Changes from Techcrafters Repo
This commit is contained in:
@@ -2,32 +2,31 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace InfineonHMI
|
||||
{
|
||||
public class DateTimeToEventTimeConverter : IValueConverter
|
||||
{
|
||||
// 599264352000000000 ticks is a date used by beckhoff for events that didnt happen up to this point
|
||||
public const long NoTime = 599264352000000000;
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is DateTime dt)
|
||||
{
|
||||
|
||||
if (dt.Ticks == NoTime)
|
||||
return "";
|
||||
else
|
||||
{
|
||||
CultureInfo cultureInfo = CultureInfo.CurrentCulture;
|
||||
return dt.ToString("G", cultureInfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new InvalidOperationException("Target must be of type DateTime");
|
||||
}
|
||||
namespace InfineonHMI;
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return DependencyProperty.UnsetValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
public class DateTimeToEventTimeConverter : IValueConverter
|
||||
{
|
||||
// 599264352000000000 ticks is a date used by beckhoff for events that didnt happen up to this point
|
||||
public const long NoTime = 599264352000000000;
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is DateTime dt)
|
||||
{
|
||||
|
||||
if (dt.Ticks == NoTime)
|
||||
return "";
|
||||
else
|
||||
{
|
||||
CultureInfo cultureInfo = CultureInfo.CurrentCulture;
|
||||
return dt.ToString("G", cultureInfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new InvalidOperationException("Target must be of type DateTime");
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return DependencyProperty.UnsetValue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user