Refactor to have individual Date and Time Controls for better mapping… (#756)
* Refactor to have individual Date and Time Controls for better mapping for .Forms * Add default control mapping to the TypeMap * Call our initialise value method. * Use custom controls and converters for our custom Date/Time * Let's return the 'broken' string, if an error occurs, until they correct it.
This commit is contained in:
Родитель
322d6c8f82
Коммит
d820cccf8b
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using AppKit;
|
||||
using Xamarin.PropertyEditing.ViewModels;
|
||||
|
||||
namespace Xamarin.PropertyEditing.Mac
|
||||
{
|
||||
internal abstract class BaseDateTimeEditorControl<T> : PropertyEditorControl<PropertyViewModel<T>>
|
||||
{
|
||||
public NSDatePicker DatePicker { get; }
|
||||
|
||||
public BaseDateTimeEditorControl (IHostResourceProvider hostResources)
|
||||
: base (hostResources)
|
||||
{
|
||||
DatePicker = new NSDatePicker {
|
||||
ControlSize = NSControlSize.Small,
|
||||
DatePickerElements = NSDatePickerElementFlags.HourMinuteSecond | NSDatePickerElementFlags.YearMonthDateDay,
|
||||
DatePickerStyle = NSDatePickerStyle.TextFieldAndStepper,
|
||||
Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)),
|
||||
TimeZone = Foundation.NSTimeZone.FromAbbreviation ("UTC"),
|
||||
TranslatesAutoresizingMaskIntoConstraints = false,
|
||||
};
|
||||
|
||||
// update the value on keypress
|
||||
DatePicker.Activated += Editor_Activated;
|
||||
|
||||
AddSubview (DatePicker);
|
||||
|
||||
AddConstraints (new[] {
|
||||
NSLayoutConstraint.Create (DatePicker, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f),
|
||||
NSLayoutConstraint.Create (DatePicker, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1f, 0f),
|
||||
NSLayoutConstraint.Create (DatePicker, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, 0),
|
||||
NSLayoutConstraint.Create (DatePicker, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1f, -6f),
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract void Editor_Activated (object sender, EventArgs e);
|
||||
|
||||
public override NSView FirstKeyView => DatePicker;
|
||||
public override NSView LastKeyView => DatePicker;
|
||||
|
||||
protected override void SetEnabled ()
|
||||
{
|
||||
DatePicker.Enabled = ViewModel.Property.CanWrite;
|
||||
}
|
||||
|
||||
protected override void UpdateAccessibilityValues ()
|
||||
{
|
||||
DatePicker.AccessibilityTitle = string.Format (Properties.Resources.AccessibilityDateTime, ViewModel.Property.Name);
|
||||
DatePicker.Enabled = DatePicker.Enabled;
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
DatePicker.Activated -= Editor_Activated;
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using AppKit;
|
||||
using Xamarin.PropertyEditing.Common;
|
||||
|
||||
namespace Xamarin.PropertyEditing.Mac
|
||||
{
|
||||
internal class DateEditorControl : BaseDateTimeEditorControl<Date>
|
||||
{
|
||||
|
||||
public DateEditorControl (IHostResourceProvider hostResources)
|
||||
: base (hostResources)
|
||||
{
|
||||
DatePicker.DatePickerElements = NSDatePickerElementFlags.YearMonthDateDay;
|
||||
}
|
||||
|
||||
protected override void Editor_Activated (object sender, EventArgs e)
|
||||
{
|
||||
ViewModel.Value = new Date (DatePicker.DateValue.ToDateTime ());
|
||||
}
|
||||
|
||||
protected override void UpdateValue ()
|
||||
{
|
||||
if (ViewModel.Value != null)
|
||||
DatePicker.DateValue = ViewModel.Value.DateTime.ToNSDate ();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,65 +1,22 @@
|
|||
using System;
|
||||
using AppKit;
|
||||
using Xamarin.PropertyEditing.ViewModels;
|
||||
|
||||
namespace Xamarin.PropertyEditing.Mac
|
||||
{
|
||||
internal class DateTimeEditorControl : PropertyEditorControl<PropertyViewModel<DateTime>>
|
||||
internal class DateTimeEditorControl : BaseDateTimeEditorControl<DateTime>
|
||||
{
|
||||
private readonly NSDatePicker datePicker;
|
||||
|
||||
public DateTimeEditorControl (IHostResourceProvider hostResources)
|
||||
: base (hostResources)
|
||||
{
|
||||
this.datePicker = new NSDatePicker {
|
||||
ControlSize = NSControlSize.Small,
|
||||
DatePickerElements = NSDatePickerElementFlags.HourMinuteSecond | NSDatePickerElementFlags.YearMonthDateDay,
|
||||
DatePickerStyle = NSDatePickerStyle.TextFieldAndStepper,
|
||||
Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)),
|
||||
TranslatesAutoresizingMaskIntoConstraints = false
|
||||
};
|
||||
|
||||
// update the value on keypress
|
||||
this.datePicker.Activated += Editor_Activated;
|
||||
|
||||
AddSubview (this.datePicker);
|
||||
|
||||
AddConstraints (new[] {
|
||||
NSLayoutConstraint.Create (this.datePicker, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f),
|
||||
NSLayoutConstraint.Create (this.datePicker, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1f, 0f),
|
||||
NSLayoutConstraint.Create (this.datePicker, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, 0),
|
||||
NSLayoutConstraint.Create (this.datePicker, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1f, -6f),
|
||||
});
|
||||
}
|
||||
|
||||
private void Editor_Activated (object sender, EventArgs e)
|
||||
protected override void Editor_Activated (object sender, EventArgs e)
|
||||
{
|
||||
ViewModel.Value = this.datePicker.DateValue.ToDateTime ();
|
||||
ViewModel.Value = DatePicker.DateValue.ToDateTime ();
|
||||
}
|
||||
|
||||
public override NSView FirstKeyView => this.datePicker;
|
||||
public override NSView LastKeyView => this.datePicker;
|
||||
|
||||
protected override void UpdateValue ()
|
||||
{
|
||||
this.datePicker.DateValue = ViewModel.Value.ToNSDate ();
|
||||
}
|
||||
|
||||
protected override void SetEnabled ()
|
||||
{
|
||||
this.datePicker.Enabled = ViewModel.Property.CanWrite;
|
||||
}
|
||||
|
||||
protected override void UpdateAccessibilityValues ()
|
||||
{
|
||||
this.datePicker.AccessibilityTitle = string.Format (Properties.Resources.AccessibilityDateTime, ViewModel.Property.Name);
|
||||
this.datePicker.Enabled = this.datePicker.Enabled;
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
this.datePicker.Activated -= Editor_Activated;
|
||||
base.Dispose (disposing);
|
||||
DatePicker.DateValue = ViewModel.Value.ToNSDate ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using AppKit;
|
||||
using Xamarin.PropertyEditing.Common;
|
||||
|
||||
namespace Xamarin.PropertyEditing.Mac
|
||||
{
|
||||
internal class TimeEditorControl : BaseDateTimeEditorControl<Time>
|
||||
{
|
||||
public TimeEditorControl (IHostResourceProvider hostResources)
|
||||
: base (hostResources)
|
||||
{
|
||||
DatePicker.DatePickerElements = NSDatePickerElementFlags.HourMinuteSecond;
|
||||
}
|
||||
|
||||
protected override void Editor_Activated (object sender, EventArgs e)
|
||||
{
|
||||
ViewModel.Value = new Time (DatePicker.DateValue.ToDateTime ());
|
||||
}
|
||||
|
||||
|
||||
protected override void UpdateValue ()
|
||||
{
|
||||
if (ViewModel.Value != null)
|
||||
DatePicker.DateValue = ViewModel.Value.DateTime.ToNSDate ();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -61,7 +61,8 @@ namespace Xamarin.PropertyEditing.Mac
|
|||
{typeof (ObjectPropertyViewModel), typeof (ObjectEditorControl)},
|
||||
{typeof (TypePropertyViewModel), typeof (TypeEditorControl)},
|
||||
{typeof (CollectionPropertyViewModel), typeof (CollectionInlineEditorControl)},
|
||||
|
||||
{typeof (PropertyViewModel<Date>), typeof (DateEditorControl)},
|
||||
{typeof (PropertyViewModel<Time>), typeof (TimeEditorControl)},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,11 @@ namespace Xamarin.PropertyEditing.Tests.MockControls
|
|||
AddProperty<FilePath> ("FilePath", ReadWrite, valueSources: ValueSources.Local | ValueSources.Resource | ValueSources.Binding);
|
||||
AddReadOnlyProperty<FilePath> ("ReadOnlyFilePath", ReadOnly);
|
||||
AddProperty<DateTime> ("DateTime", ReadWrite, valueSources: ValueSources.Local | ValueSources.Resource | ValueSources.Binding);
|
||||
AddReadOnlyProperty<DateTime> ("ReadDateTime", ReadOnly);
|
||||
AddReadOnlyProperty<DateTime> ("ReadOnlyDateTime", ReadOnly);
|
||||
AddProperty<Date> ("Date", ReadWrite, valueSources: ValueSources.Local | ValueSources.Resource | ValueSources.Binding);
|
||||
AddReadOnlyProperty<Date> ("ReadOnlyDate", ReadOnly);
|
||||
AddProperty<Time> ("Time", ReadWrite, valueSources: ValueSources.Local | ValueSources.Resource | ValueSources.Binding);
|
||||
AddReadOnlyProperty<Time> ("ReadOnlyTime", ReadOnly);
|
||||
|
||||
AddEvents ("Click", "Hover", "Focus");
|
||||
|
||||
|
@ -140,6 +144,9 @@ namespace Xamarin.PropertyEditing.Tests.MockControls
|
|||
public async Task SetInitialValuesAsync (IObjectEditor editor)
|
||||
{
|
||||
await editor.SetValueAsync (Properties["FilePath"], new ValueInfo<FilePath> { Value = new FilePath ("/Desktop/MyTestFile") });
|
||||
await editor.SetValueAsync (Properties["DateTime"], new ValueInfo<DateTime> { Value = DateTime.Now });
|
||||
await editor.SetValueAsync (Properties["Date"], new ValueInfo<Date> { Value = new Date (DateTime.Now) });
|
||||
await editor.SetValueAsync (Properties["Time"], new ValueInfo<Time> { Value = new Time (DateTime.Now) });
|
||||
}
|
||||
|
||||
public async Task SetBrushInitialValueAsync (IObjectEditor editor, CommonBrush brush)
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace Xamarin.PropertyEditing.Windows.Standalone
|
|||
inspectedObject = mockedControl.MockedControl;
|
||||
if (mockedControl is MockedSampleControlButton mockedButton) {
|
||||
IObjectEditor editor = await this.panel.TargetPlatform.EditorProvider.GetObjectEditorAsync (inspectedObject);
|
||||
await mockedButton.MockedControl.SetInitialValuesAsync (editor);
|
||||
await mockedButton.MockedControl.SetBrushInitialValueAsync (editor, new CommonSolidBrush (20, 120, 220, 240, "sRGB"));
|
||||
await mockedButton.MockedControl.SetMaterialDesignBrushInitialValueAsync (editor, new CommonSolidBrush (0x65, 0x1F, 0xFF, 200));
|
||||
await mockedButton.MockedControl.SetReadOnlyBrushInitialValueAsync (editor, new CommonSolidBrush (240, 220, 15, 190));
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Xamarin.PropertyEditing.Windows
|
||||
{
|
||||
class DateEditorControl : PropertyEditorControl
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
using Xamarin.PropertyEditing.Common;
|
||||
|
||||
namespace Xamarin.PropertyEditing.Windows
|
||||
{
|
||||
[ValueConversion (typeof (Date), typeof (string))]
|
||||
internal class DateToTextConverter : MarkupExtension, IValueConverter
|
||||
{
|
||||
public object Convert (object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> !(value is Date dateValue) ? DependencyProperty.UnsetValue
|
||||
: dateValue.ToString ();
|
||||
|
||||
public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is string dateValue) {
|
||||
var parsedValue = Date.Parse (dateValue);
|
||||
if (parsedValue != null)
|
||||
return parsedValue;
|
||||
else
|
||||
return value;
|
||||
} else {
|
||||
return DependencyProperty.UnsetValue;
|
||||
}
|
||||
}
|
||||
|
||||
public override object ProvideValue (IServiceProvider serviceProvider) => this;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Xamarin.PropertyEditing.Common;
|
||||
using Xamarin.PropertyEditing.Drawing;
|
||||
using Xamarin.PropertyEditing.ViewModels;
|
||||
|
||||
|
@ -113,7 +114,11 @@ namespace Xamarin.PropertyEditing.Windows
|
|||
{ typeof(TypePropertyViewModel), typeof(TypeEditorControl) },
|
||||
{ typeof(CollectionPropertyViewModel), typeof(CollectionEditor) },
|
||||
{ typeof(RatioViewModel), typeof(RatioEditorControl) },
|
||||
{ typeof(AutoResizingPropertyViewModel), typeof(AutoResizingMaskEditorControl) }
|
||||
{ typeof(AutoResizingPropertyViewModel), typeof(AutoResizingMaskEditorControl) },
|
||||
{ typeof(PropertyViewModel<char>), typeof(StringEditorControl) },
|
||||
{ typeof(PropertyViewModel<FilePath>), typeof(StringEditorControl) },
|
||||
{ typeof(PropertyViewModel<Date>), typeof(DateEditorControl) },
|
||||
{ typeof(PropertyViewModel<Time>), typeof(TimeEditorControl) },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
<local:NegativeThicknessConverter x:Key="NegativeThicknessConverter" />
|
||||
<local:GroupedEditorPropertySelector x:Key="GroupedEditorSelector" />
|
||||
<local:MultiplierConverter x:Key="MultiplierConverter" />
|
||||
<local:DateToTextConverter x:Key="DateToTextConverter" />
|
||||
<local:TimeToTextConverter x:Key="TimeToTextConverter" />
|
||||
|
||||
<Style TargetType="local:CombinablePredefinedValuesEditor">
|
||||
<Setter Property="Template">
|
||||
|
@ -301,6 +303,38 @@
|
|||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="local:DateEditorControl">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="local:DateEditorControl">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<local:TextBoxEx x:Name="TextBox" Grid.Column="0" FocusSelectsAll="True" AutomationProperties.Name="{Binding Property.Name,Mode=OneTime}" Text="{Binding Value,UpdateSourceTrigger=Explicit,Converter={StaticResource DateToTextConverter}}" VerticalContentAlignment="Center" IsEnabled="{Binding IsInputEnabled}" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="local:TimeEditorControl">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="local:TimeEditorControl">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<local:TextBoxEx x:Name="TextBox" Grid.Column="0" FocusSelectsAll="True" AutomationProperties.Name="{Binding Property.Name,Mode=OneTime}" Text="{Binding Value,UpdateSourceTrigger=Explicit,Converter={StaticResource TimeToTextConverter}}" VerticalContentAlignment="Center" IsEnabled="{Binding IsInputEnabled}" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="local:BoolEditorControl">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Xamarin.PropertyEditing.Windows
|
||||
{
|
||||
class TimeEditorControl : PropertyEditorControl
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
using Xamarin.PropertyEditing.Common;
|
||||
|
||||
namespace Xamarin.PropertyEditing.Windows
|
||||
{
|
||||
[ValueConversion (typeof (Time), typeof (string))]
|
||||
internal class TimeToTextConverter : MarkupExtension, IValueConverter
|
||||
{
|
||||
public object Convert (object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> !(value is Time timeValue) ? DependencyProperty.UnsetValue
|
||||
: timeValue.ToString ();
|
||||
|
||||
public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is string dateValue) {
|
||||
var parsedValue = Time.Parse (dateValue);
|
||||
if (parsedValue != null)
|
||||
return parsedValue;
|
||||
else
|
||||
return value;
|
||||
} else {
|
||||
return DependencyProperty.UnsetValue;
|
||||
}
|
||||
}
|
||||
|
||||
public override object ProvideValue (IServiceProvider serviceProvider) => this;
|
||||
}
|
||||
}
|
|
@ -89,6 +89,8 @@
|
|||
<Compile Include="CreateVariantWindow.xaml.cs">
|
||||
<DependentUpon>CreateVariantWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DateEditorControl.cs" />
|
||||
<Compile Include="DateToTextConverter.cs" />
|
||||
<Compile Include="DoubleToAngleConverter.cs" />
|
||||
<Compile Include="CreateValueConverterWindow.xaml.cs">
|
||||
<DependentUpon>CreateValueConverterWindow.xaml</DependentUpon>
|
||||
|
@ -115,6 +117,8 @@
|
|||
</Compile>
|
||||
<Compile Include="Spinner.cs" />
|
||||
<Compile Include="TextBoxEx.cs" />
|
||||
<Compile Include="TimeEditorControl.cs" />
|
||||
<Compile Include="TimeToTextConverter.cs" />
|
||||
<Compile Include="ToggleButtonEx.cs" />
|
||||
<Compile Include="EditorPropertySelector.cs" />
|
||||
<Compile Include="EnumEditorControl.cs" />
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
|
||||
namespace Xamarin.PropertyEditing.Common
|
||||
{
|
||||
public class Date : IEquatable<Date>
|
||||
{
|
||||
private readonly DateTime dateTime;
|
||||
|
||||
public Date (DateTime dateTime)
|
||||
{
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
public DateTime DateTime {
|
||||
get{
|
||||
return this.dateTime;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals (object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return false;
|
||||
if ((obj is Date d))
|
||||
return Equals (d);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Equals (Date other)
|
||||
{
|
||||
if (other == null)
|
||||
return false;
|
||||
return this.dateTime.Equals (other);
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
var hashCode = 1861433795;
|
||||
unchecked {
|
||||
hashCode = hashCode * -1521134295 + this.dateTime.GetHashCode ();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return this.dateTime.ToShortDateString ();
|
||||
}
|
||||
|
||||
public static Date Parse (string value)
|
||||
{
|
||||
try {
|
||||
return new Date (DateTime.Parse (value));
|
||||
} catch (Exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
|
||||
namespace Xamarin.PropertyEditing.Common
|
||||
{
|
||||
public class Time : IEquatable<Time>
|
||||
{
|
||||
private readonly DateTime dateTime;
|
||||
|
||||
public DateTime DateTime {
|
||||
get {
|
||||
return this.dateTime;
|
||||
}
|
||||
}
|
||||
|
||||
public Time (DateTime dateTime)
|
||||
{
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
public override bool Equals (object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return false;
|
||||
if ((obj is Time d))
|
||||
return Equals (d);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Equals (Time other)
|
||||
{
|
||||
if (other == null)
|
||||
return false;
|
||||
return this.dateTime.Equals (other.DateTime);
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
var hashCode = 1861433795;
|
||||
unchecked {
|
||||
hashCode = hashCode * -1521134295 + this.dateTime.GetHashCode ();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
public override string ToString ()
|
||||
{
|
||||
return this.dateTime.ToLongTimeString ();
|
||||
}
|
||||
|
||||
public static Time Parse(string value)
|
||||
{
|
||||
try {
|
||||
return new Time (DateTime.Parse (value));
|
||||
} catch (Exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -656,6 +656,8 @@ namespace Xamarin.PropertyEditing.ViewModels
|
|||
{ typeof(ITypeInfo), (tp,p,e,v) => new TypePropertyViewModel (tp, p, e, v) },
|
||||
{ typeof(CommonRatio), (tp, p, e, v) => new RatioViewModel (tp, p, e, v) },
|
||||
{ typeof(AutoResizingFlags), (tp, p, e, v) => new AutoResizingPropertyViewModel (tp, p, e, v) },
|
||||
{ typeof(Date), (tp, p, e, v) => new PropertyViewModel<Date> (tp, p, e, v) },
|
||||
{ typeof(Time), (tp, p, e, v) => new PropertyViewModel<Time> (tp, p, e, v) },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче