diff options
author | Jose Medrano <josmed@microsoft.com> | 2019-03-20 21:16:55 +0300 |
---|---|---|
committer | Eric Maupin <me@ermau.com> | 2019-03-20 21:16:55 +0300 |
commit | 0fa606c1688a86119d1b147cc1c9493b56f26940 (patch) | |
tree | 4d87012c41885030673b9a9830c495d0e2d4953d /Xamarin.PropertyEditing | |
parent | e91bb3664d8264045b3c04aaa74fe2eafc027799 (diff) |
[Mac] Adds implementation of FilePathEditorControl (#479)
Fixes VSTS #732636 - Implement FilePath editor
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/732636
Diffstat (limited to 'Xamarin.PropertyEditing')
-rw-r--r-- | Xamarin.PropertyEditing/Common/FilePath.cs | 44 | ||||
-rw-r--r-- | Xamarin.PropertyEditing/ViewModels/PropertiesViewModel.cs | 2 | ||||
-rw-r--r-- | Xamarin.PropertyEditing/Xamarin.PropertyEditing.csproj | 1 |
3 files changed, 47 insertions, 0 deletions
diff --git a/Xamarin.PropertyEditing/Common/FilePath.cs b/Xamarin.PropertyEditing/Common/FilePath.cs new file mode 100644 index 0000000..bf351b9 --- /dev/null +++ b/Xamarin.PropertyEditing/Common/FilePath.cs @@ -0,0 +1,44 @@ +using System; + +namespace Xamarin.PropertyEditing.Common +{ + public class FilePath : IEquatable<FilePath> + { + public string Source { get; } + + public FilePath (string source) + { + if (source == null) { + throw new ArgumentNullException (nameof (source)); + } + Source = source; + } + + public override string ToString () + { + return Source; + } + + public override bool Equals (object obj) + { + if (obj == null) return false; + if (!(obj is FilePath)) return false; + return Equals ((FilePath)obj); + } + + public bool Equals (FilePath other) + { + if (other == null) return false; + return Source.Equals (other.Source, StringComparison.InvariantCultureIgnoreCase); + } + + public override int GetHashCode () + { + var hashCode = 1861433795; + unchecked { + hashCode = hashCode * -1521134295 + Source.GetHashCode (); + } + return hashCode; + } + } +}
\ No newline at end of file diff --git a/Xamarin.PropertyEditing/ViewModels/PropertiesViewModel.cs b/Xamarin.PropertyEditing/ViewModels/PropertiesViewModel.cs index 7ddae70..794e2a2 100644 --- a/Xamarin.PropertyEditing/ViewModels/PropertiesViewModel.cs +++ b/Xamarin.PropertyEditing/ViewModels/PropertiesViewModel.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Cadenza.Collections; +using Xamarin.PropertyEditing.Common; using Xamarin.PropertyEditing.Drawing; namespace Xamarin.PropertyEditing.ViewModels @@ -613,6 +614,7 @@ namespace Xamarin.PropertyEditing.ViewModels { typeof(IList), (tp,p,e,v) => new CollectionPropertyViewModel (tp, p ,e, v) }, { typeof(BindingSource), (tp,p,e,v) => new PropertyViewModel<BindingSource> (tp, p, e, v) }, { typeof(Resource), (tp,p,e,v) => new PropertyViewModel<Resource> (tp, p, e, v) }, + { typeof(FilePath), (tp,p,e,v) => new PropertyViewModel<FilePath> (tp, p, e, v) }, { typeof(object), (tp,p,e,v) => new ObjectPropertyViewModel (tp, p, e, v) }, { typeof(ITypeInfo), (tp,p,e,v) => new TypePropertyViewModel (tp, p, e, v) }, { typeof(CommonRatio), (tp, p, e, v) => new RatioViewModel (tp, p, e, v) }, diff --git a/Xamarin.PropertyEditing/Xamarin.PropertyEditing.csproj b/Xamarin.PropertyEditing/Xamarin.PropertyEditing.csproj index b638f30..330eeeb 100644 --- a/Xamarin.PropertyEditing/Xamarin.PropertyEditing.csproj +++ b/Xamarin.PropertyEditing/Xamarin.PropertyEditing.csproj @@ -172,6 +172,7 @@ <Compile Include="IReadOnlyOrderedDictionary.cs" /> <Compile Include="ViewModels\CreateVariationEventArgs.cs" /> <Compile Include="ViewModels\IPropertyValue.cs" /> + <Compile Include="Common\FilePath.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Properties\Resources.resx"> |