You've already forked linux-packaging-mono
Imported Upstream version 3.8.0
Former-commit-id: 6a76a29bd07d86e57c6c8da45c65ed5447d38a61
This commit is contained in:
@ -27,6 +27,7 @@
|
||||
//
|
||||
|
||||
#if MONODROID
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
namespace System {
|
||||
@ -35,20 +36,26 @@ namespace System {
|
||||
|
||||
static readonly Func<SynchronizationContext> getDefaultSyncContext;
|
||||
static readonly Func<string> getDefaultTimeZone;
|
||||
static readonly Func<TimeZone> getCurrentSystemTimeZone;
|
||||
|
||||
static AndroidPlatform ()
|
||||
{
|
||||
Type androidRuntime = Type.GetType ("Android.Runtime.AndroidEnvironment, Mono.Android", true);
|
||||
|
||||
getDefaultSyncContext = (Func<SynchronizationContext>)
|
||||
Delegate.CreateDelegate (typeof(Func<SynchronizationContext>),
|
||||
Type.GetType ("Android.Runtime.AndroidEnvironment, Mono.Android", true)
|
||||
.GetMethod ("GetDefaultSyncContext",
|
||||
androidRuntime.GetMethod ("GetDefaultSyncContext",
|
||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic));
|
||||
|
||||
getDefaultTimeZone = (Func<string>)
|
||||
Delegate.CreateDelegate (typeof(Func<string>),
|
||||
Type.GetType ("Android.Runtime.AndroidEnvironment, Mono.Android", true)
|
||||
.GetMethod ("GetDefaultTimeZone",
|
||||
androidRuntime.GetMethod ("GetDefaultTimeZone",
|
||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic));
|
||||
|
||||
MethodInfo mi = androidRuntime.GetMethod ("GetCurrentSystemTimeZone",
|
||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
|
||||
if (mi != null)
|
||||
getCurrentSystemTimeZone = (Func<TimeZone>) Delegate.CreateDelegate (typeof(Func<TimeZone>), mi);
|
||||
}
|
||||
|
||||
internal static SynchronizationContext GetDefaultSyncContext ()
|
||||
@ -60,6 +67,13 @@ namespace System {
|
||||
{
|
||||
return getDefaultTimeZone ();
|
||||
}
|
||||
|
||||
internal static TimeZone GetCurrentSystemTimeZone ()
|
||||
{
|
||||
if (getCurrentSystemTimeZone == null)
|
||||
return null;
|
||||
return getCurrentSystemTimeZone ();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user