diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls')
12 files changed, 9 insertions, 161 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs index e53a850..7a8b24f 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs @@ -78,21 +78,6 @@ namespace Xamarin.PropertyEditing.Mac YLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor); } - protected override void HandleErrorsChanged (object sender, System.ComponentModel.DataErrorsChangedEventArgs e) - { - UpdateErrorsDisplayed (ViewModel.GetErrors (ViewModel.Property.Name)); - } - - protected override void UpdateErrorsDisplayed (IEnumerable errors) - { - if (ViewModel.HasErrors) { - SetErrors (errors); - } else { - SetErrors (null); - SetEnabled (); - } - } - protected override void SetEnabled () { XEditor.Enabled = ViewModel.Property.CanWrite; diff --git a/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs index 2936016..b7a68e4 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs @@ -133,21 +133,6 @@ namespace Xamarin.PropertyEditing.Mac ViewModel.Value = (T)Activator.CreateInstance (typeof(T), XEditor.Value, YEditor.Value, WidthEditor.Value, HeightEditor.Value); } - protected override void HandleErrorsChanged (object sender, System.ComponentModel.DataErrorsChangedEventArgs e) - { - UpdateErrorsDisplayed (ViewModel.GetErrors (ViewModel.Property.Name)); - } - - protected override void UpdateErrorsDisplayed (IEnumerable errors) - { - if (ViewModel.HasErrors) { - SetErrors (errors); - } else { - SetErrors (null); - SetEnabled (); - } - } - protected override void SetEnabled () { XEditor.Enabled = ViewModel.Property.CanWrite; diff --git a/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs index 1df39dd..3112680 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs @@ -59,21 +59,6 @@ namespace Xamarin.PropertyEditing.Mac } } - protected override void UpdateErrorsDisplayed (IEnumerable errors) - { - if (ViewModel.HasErrors) { - SetErrors (errors); - } else { - SetErrors (null); - SetEnabled (); - } - } - - protected override void HandleErrorsChanged (object sender, System.ComponentModel.DataErrorsChangedEventArgs e) - { - UpdateErrorsDisplayed (ViewModel.GetErrors (ViewModel.Property.Name)); - } - protected override void SetEnabled () { BooleanEditor.Enabled = ViewModel.Property.CanWrite; diff --git a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs index b1caa5e..cab556d 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs @@ -90,23 +90,11 @@ namespace Xamarin.PropertyEditing.Mac public override NSView FirstKeyView => this.popUpButton; public override NSView LastKeyView => this.popUpButton; - protected override void HandleErrorsChanged (object sender, DataErrorsChangedEventArgs e) - { - } - protected override void SetEnabled () { this.popUpButton.Enabled = this.ViewModel?.Property.CanWrite ?? false; } - protected override void UpdateAccessibilityValues () - { - } - - protected override void UpdateErrorsDisplayed (IEnumerable errors) - { - } - string GetTitle () { var title = LocalizationResources.CommonBrushTitleUnknown; diff --git a/Xamarin.PropertyEditing.Mac/Controls/CombinablePropertyEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/CombinablePropertyEditor.cs index 7300514..c0feeab 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/CombinablePropertyEditor.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/CombinablePropertyEditor.cs @@ -34,11 +34,6 @@ namespace Xamarin.PropertyEditing.Mac return subrowHeight * realVm.Choices.Count + 6; } - protected override void HandleErrorsChanged (object sender, DataErrorsChangedEventArgs e) - { - UpdateErrorsDisplayed (ViewModel.GetErrors (e.PropertyName)); - } - protected override void SetEnabled () { foreach (var item in this.combinableList) { @@ -46,16 +41,6 @@ namespace Xamarin.PropertyEditing.Mac } } - protected override void UpdateErrorsDisplayed (IEnumerable errors) - { - if (ViewModel.HasErrors) { - SetErrors (errors); - } else { - SetErrors (null); - SetEnabled (); - } - } - protected override void OnViewModelChanged (PropertyViewModel oldModel) { base.OnViewModelChanged (oldModel); diff --git a/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs index c049c42..8290d2d 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs @@ -71,21 +71,6 @@ namespace Xamarin.PropertyEditing.Mac } } - protected override void UpdateErrorsDisplayed (IEnumerable errors) - { - if (ViewModel.HasErrors) { - SetErrors (errors); - } else { - SetErrors (null); - SetEnabled (); - } - } - - protected override void HandleErrorsChanged (object sender, System.ComponentModel.DataErrorsChangedEventArgs e) - { - UpdateErrorsDisplayed (ViewModel.GetErrors (ViewModel.Property.Name)); - } - protected override void SetEnabled () { NumericEditor.Enabled = CanEnable; diff --git a/Xamarin.PropertyEditing.Mac/Controls/ObjectEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/ObjectEditorControl.cs index eaf70e8..a98a6b3 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/ObjectEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/ObjectEditorControl.cs @@ -47,14 +47,6 @@ namespace Xamarin.PropertyEditing.Mac { } - protected override void UpdateErrorsDisplayed (IEnumerable errors) - { - } - - protected override void HandleErrorsChanged (object sender, DataErrorsChangedEventArgs e) - { - } - protected override void SetEnabled () { this.createObject.Enabled = ViewModel.Property.CanWrite; diff --git a/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs index d62524a..f284c8a 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs @@ -65,11 +65,6 @@ namespace Xamarin.PropertyEditing.Mac private NSView firstKeyView; private NSView lastKeyView; - protected override void HandleErrorsChanged (object sender, DataErrorsChangedEventArgs e) - { - UpdateErrorsDisplayed (ViewModel.GetErrors (e.PropertyName)); - } - protected override void SetEnabled () { if (ViewModel.IsConstrainedToPredefined) { @@ -79,16 +74,6 @@ namespace Xamarin.PropertyEditing.Mac } } - protected override void UpdateErrorsDisplayed (IEnumerable errors) - { - if (ViewModel.HasErrors) { - SetErrors (errors); - } else { - SetErrors (null); - SetEnabled (); - } - } - protected override void OnViewModelChanged (PropertyViewModel oldModel) { base.OnViewModelChanged (oldModel); diff --git a/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs index 0434f66..acd208c 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs @@ -47,14 +47,12 @@ namespace Xamarin.PropertyEditing.Mac PropertyViewModel oldModel = this.viewModel; if (oldModel != null) { oldModel.PropertyChanged -= OnPropertyChanged; - oldModel.ErrorsChanged -= HandleErrorsChanged; } this.viewModel = value; OnViewModelChanged (oldModel); if (this.viewModel != null) { this.viewModel.PropertyChanged += OnPropertyChanged; - this.viewModel.ErrorsChanged += HandleErrorsChanged; } } } @@ -105,7 +103,9 @@ namespace Xamarin.PropertyEditing.Mac return 24; } - protected abstract void UpdateValue (); + protected virtual void UpdateValue () + { + } protected virtual void OnViewModelChanged (PropertyViewModel oldModel) { @@ -123,17 +123,13 @@ namespace Xamarin.PropertyEditing.Mac } } - /// <summary> - /// Update the display with any errors we need to show or remove - /// </summary> - /// <param name="errors">The error messages to display to the user</param> - protected abstract void UpdateErrorsDisplayed (IEnumerable errors); - - protected abstract void HandleErrorsChanged (object sender, System.ComponentModel.DataErrorsChangedEventArgs e); - - protected abstract void SetEnabled (); + protected virtual void SetEnabled () + { + } - protected abstract void UpdateAccessibilityValues (); + protected virtual void UpdateAccessibilityValues () + { + } } internal abstract class PropertyEditorControl<TViewModel> diff --git a/Xamarin.PropertyEditing.Mac/Controls/RatioEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/RatioEditorControl.cs index a899306..7cd49f4 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/RatioEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/RatioEditorControl.cs @@ -42,11 +42,6 @@ namespace Xamarin.PropertyEditing.Mac public override NSView FirstKeyView => ratioEditor.NumericEditor; public override NSView LastKeyView => ratioEditor.DecrementButton; - protected override void HandleErrorsChanged (object sender, DataErrorsChangedEventArgs e) - { - UpdateErrorsDisplayed (ViewModel.GetErrors (ViewModel.Property.Name)); - } - protected override void SetEnabled () { this.ratioEditor.Enabled = ViewModel.Property.CanWrite; @@ -58,16 +53,6 @@ namespace Xamarin.PropertyEditing.Mac this.ratioEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityNumeric, ViewModel.Property.Name); } - protected override void UpdateErrorsDisplayed (IEnumerable errors) - { - if (ViewModel.HasErrors) { - SetErrors (errors); - } else { - SetErrors (null); - SetEnabled (); - } - } - protected override void UpdateValue () { this.ratioEditor.StringValue = ViewModel.ValueString; diff --git a/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs index 3aeae5f..0b2933a 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs @@ -52,11 +52,6 @@ namespace Xamarin.PropertyEditing.Mac this.inputModePopup.SelectItem ((ViewModel.InputMode == null) ? string.Empty : ViewModel.InputMode.Identifier); } - protected override void HandleErrorsChanged (object sender, System.ComponentModel.DataErrorsChangedEventArgs e) - { - UpdateErrorsDisplayed (ViewModel.GetErrors (ViewModel.Property.Name)); - } - protected override void OnViewModelChanged (PropertyViewModel oldModel) { base.OnViewModelChanged (oldModel); @@ -110,16 +105,6 @@ namespace Xamarin.PropertyEditing.Mac SetEnabled (); } - protected override void UpdateErrorsDisplayed (IEnumerable errors) - { - if (ViewModel.HasErrors) { - SetErrors (errors); - } else { - SetErrors (null); - SetEnabled (); - } - } - protected override void SetEnabled () { this.stringEditor.Enabled = CanEnable; diff --git a/Xamarin.PropertyEditing.Mac/Controls/TypeEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/TypeEditorControl.cs index 082faf2..b7e68d3 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/TypeEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/TypeEditorControl.cs @@ -47,14 +47,6 @@ namespace Xamarin.PropertyEditing.Mac { } - protected override void UpdateErrorsDisplayed (IEnumerable errors) - { - } - - protected override void HandleErrorsChanged (object sender, DataErrorsChangedEventArgs e) - { - } - protected override void SetEnabled () { this.selectType.Enabled = ViewModel.Property.CanWrite; |