-
-
Save atsushieno/4e66da6e492dfb6c1dd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using Android.Runtime; | |
public static class ResourceIdManager | |
{ | |
static bool id_initialized; | |
public static void UpdateIdValues () | |
{ | |
if (id_initialized) | |
return; | |
var eass = Assembly.GetExecutingAssembly (); | |
Func<Assembly,Type> f = ass => | |
ass.GetCustomAttributes (typeof (ResourceDesignerAttribute), true) | |
.Select (ca => ca as ResourceDesignerAttribute) | |
.Where (ca => ca != null && ca.IsApplication) | |
.Select (ca => ass.GetType (ca.FullName)) | |
.Where (ty => ty != null) | |
.FirstOrDefault (); | |
var t = f (eass); | |
if (t == null) | |
t = AppDomain.CurrentDomain.GetAssemblies ().Select (ass => f (ass)).Where (ty => ty != null).FirstOrDefault (); | |
if (t != null) | |
t.GetMethod ("UpdateIdValues").Invoke (null, new object [0]); | |
id_initialized = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment