source: trunk/CrypPlugins/P2PEditor/Converters/UtcDateTimeToLocalConverter.cs @ 1727

Last change on this file since 1727 was 1727, checked in by Paul Lelgemann, 11 years ago

+ P2PEditor can display the status of jobs, if available; Participating displays overlay while loading workspace data
+ KeySearcher can upload status for P2PEditor display

File size: 826 bytes
Line 
1using System;
2using System.Globalization;
3using System.Threading;
4using System.Windows.Data;
5
6namespace Cryptool.P2PEditor.Converters
7{
8    public class UtcDateTimeToLocalConverter : IValueConverter
9    {
10        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11        {
12            var startTimeUtc = DateTime.SpecifyKind((DateTime) value, DateTimeKind.Utc);
13            var localTime = startTimeUtc.ToLocalTime();
14
15            if (startTimeUtc == DateTime.MinValue) return "-";
16
17            return localTime.ToString("g", Thread.CurrentThread.CurrentCulture);
18        }
19
20        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
21        {
22            throw new NotImplementedException();
23        }
24    }
25}
Note: See TracBrowser for help on using the repository browser.