Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Maupin <me@ermau.com>2019-01-26 01:13:21 +0300
committerGitHub <noreply@github.com>2019-01-26 01:13:21 +0300
commit2d588719dc709e63e5d80bc295eaceeb29307224 (patch)
tree99253688b01e8e276bb97250e95a06a823f7c3a3 /Xamarin.PropertyEditing
parent43caf8c1dadcb29993b8c25f4b399fbbcb590402 (diff)
parent0acb05e1d21a7d86f467fe02be5e941809cb2d3f (diff)
Merge pull request #493 from xamarin/ermau-mac-theming
Revamp Mac theming
Diffstat (limited to 'Xamarin.PropertyEditing')
-rw-r--r--Xamarin.PropertyEditing/Extensions.cs19
-rw-r--r--Xamarin.PropertyEditing/Reflection/ReflectionObjectEditor.cs8
-rw-r--r--Xamarin.PropertyEditing/Themes/BaseThemeManager.cs38
-rw-r--r--Xamarin.PropertyEditing/Themes/PropertyEditorTheme.cs9
-rw-r--r--Xamarin.PropertyEditing/Xamarin.PropertyEditing.csproj4
5 files changed, 26 insertions, 52 deletions
diff --git a/Xamarin.PropertyEditing/Extensions.cs b/Xamarin.PropertyEditing/Extensions.cs
index 5f62257..333f0e8 100644
--- a/Xamarin.PropertyEditing/Extensions.cs
+++ b/Xamarin.PropertyEditing/Extensions.cs
@@ -31,6 +31,25 @@ namespace Xamarin.PropertyEditing
self.Add (item);
}
+ public static int IndexOf<T> (this IEnumerable<T> self, T element)
+ {
+ if (self == null)
+ throw new ArgumentNullException (nameof (self));
+
+ if (self is IList list)
+ return list.IndexOf (element);
+
+ int i = 0;
+ foreach (T current in self) {
+ if (Equals (current, element))
+ return i;
+
+ i++;
+ }
+
+ return -1;
+ }
+
public static object ElementAt (this IEnumerable self, int index)
{
if (self == null)
diff --git a/Xamarin.PropertyEditing/Reflection/ReflectionObjectEditor.cs b/Xamarin.PropertyEditing/Reflection/ReflectionObjectEditor.cs
index e656668..3ea7209 100644
--- a/Xamarin.PropertyEditing/Reflection/ReflectionObjectEditor.cs
+++ b/Xamarin.PropertyEditing/Reflection/ReflectionObjectEditor.cs
@@ -141,7 +141,13 @@ namespace Xamarin.PropertyEditing.Reflection
{
return Task.Run (() => {
var types = AppDomain.CurrentDomain.GetAssemblies ().SelectMany (a => a.GetTypes ()).AsParallel ()
- .Where (t => t.Namespace != null && !t.IsAbstract && !t.IsInterface && t.IsPublic && t.GetConstructor (Type.EmptyTypes) != null);
+ .Where (t => {
+ try {
+ return t.Namespace != null && !t.IsAbstract && !t.IsInterface && t.IsPublic && t.GetConstructor (Type.EmptyTypes) != null;
+ } catch (TypeLoadException) {
+ return false;
+ }
+ });
Type realType = ReflectionEditorProvider.GetRealType (type);
if (childTypes) {
diff --git a/Xamarin.PropertyEditing/Themes/BaseThemeManager.cs b/Xamarin.PropertyEditing/Themes/BaseThemeManager.cs
deleted file mode 100644
index 1431591..0000000
--- a/Xamarin.PropertyEditing/Themes/BaseThemeManager.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System;
-
-namespace Xamarin.PropertyEditing.Themes
-{
- public abstract class BaseThemeManager
- {
- PropertyEditorTheme theme;
-
- public BaseThemeManager ()
- {
- NotifyThemeChanged ();
- }
-
- protected abstract void SetTheme ();
-
- public PropertyEditorTheme Theme
- {
- get {
- return theme;
- }
-
- set {
- if (theme != value) {
- theme = value;
- NotifyThemeChanged ();
- }
- }
- }
-
- void NotifyThemeChanged ()
- {
- SetTheme ();
- ThemeChanged?.Invoke (null, EventArgs.Empty);
- }
-
- public event EventHandler ThemeChanged;
- }
-}
diff --git a/Xamarin.PropertyEditing/Themes/PropertyEditorTheme.cs b/Xamarin.PropertyEditing/Themes/PropertyEditorTheme.cs
deleted file mode 100644
index efe9ac5..0000000
--- a/Xamarin.PropertyEditing/Themes/PropertyEditorTheme.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Xamarin.PropertyEditing.Themes
-{
- public enum PropertyEditorTheme
- {
- Dark,
- Light,
- None,
- }
-}
diff --git a/Xamarin.PropertyEditing/Xamarin.PropertyEditing.csproj b/Xamarin.PropertyEditing/Xamarin.PropertyEditing.csproj
index 39ba238..35df7c9 100644
--- a/Xamarin.PropertyEditing/Xamarin.PropertyEditing.csproj
+++ b/Xamarin.PropertyEditing/Xamarin.PropertyEditing.csproj
@@ -173,10 +173,6 @@
<Compile Include="ViewModels\IPropertyValue.cs" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Themes\BaseThemeManager.cs" />
- <Compile Include="Themes\PropertyEditorTheme.cs" />
- </ItemGroup>
- <ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>