blob: 222af81726c0c22f6f9e33f94be8496a890cef21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
using System;
using Xamarin.PropertyEditing.ViewModels;
namespace Xamarin.PropertyEditing.Mac
{
internal class TimeSpanEditorControl
: EntryPropertyEditor<TimeSpan>
{
public TimeSpanEditorControl (IHostResourceProvider hostResources)
: base (hostResources)
{
}
protected override EntryPropertyEditorDelegate<TimeSpan> CreateDelegate (PropertyViewModel<TimeSpan> viewModel)
{
return new TimeSpanDelegate (viewModel);
}
protected override void UpdateAccessibilityValues ()
{
base.UpdateAccessibilityValues ();
Entry.AccessibilityTitle = string.Format (Properties.Resources.AccessibilityTimeSpan, ViewModel.Property.Name);
}
private class TimeSpanDelegate
: EntryPropertyEditorDelegate<TimeSpan>
{
public TimeSpanDelegate (PropertyViewModel<TimeSpan> viewModel)
: base (viewModel)
{
}
protected override TimeSpan GetValue (string value)
{
return TimeSpan.Parse (value);
}
protected override bool CanGetValue (string value)
{
return TimeSpan.TryParse (value, out _);
}
}
}
}
|