Skip to content

Instantly share code, notes, and snippets.

@NoobInTraining
Created March 6, 2018 15:18
Show Gist options
  • Save NoobInTraining/d43650fc49036960a565c3f3e4ca06e3 to your computer and use it in GitHub Desktop.
Save NoobInTraining/d43650fc49036960a565c3f3e4ca06e3 to your computer and use it in GitHub Desktop.
using System;
using System.Globalization;
using DatafoxTSLibrary.Terminals;
using System.Windows.Data;
namespace AdminClientv03.Converters
{
class DtTermToTimeDiffernce : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var term = value as DatafoxTerminal;
if (value == null)
return 0;
if (term.AskedAt.HasValue && term.CurrentTimeOnTerminal.HasValue)
return (term.AskedAt.Value - term.CurrentTimeOnTerminal.Value).TotalSeconds;
else
return 0;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException("Only one way conversion supported");
}
}
}
<conv:DtTermToTimeDiffernce x:Key="DtConv"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment