Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DurationToXmlString.cs
1using System;
2using System.Globalization;
3using System.Windows.Data;
4using System.Windows.Markup;
5using Waher.Content;
6
8{
12 public class DurationToXmlString : MarkupExtension, IValueConverter
13 {
15 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 {
17 return value?.ToString();
18 }
19
21 public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
22 {
23 if (value is string s && Duration.TryParse(s, out Duration TS))
24 return TS;
25 else
26 return value;
27 }
28
30 public override object ProvideValue(IServiceProvider serviceProvider)
31 {
32 return this;
33 }
34 }
35}
Represents a duration value, as defined by the xsd:duration data type: http://www....
Definition: Duration.cs:13
static bool TryParse(string s, out Duration Result)
Tries to parse a duration value.
Definition: Duration.cs:85