Permalink
Browse files

Fix method search in helpers

  • Loading branch information...
1 parent 11684a1 commit 1af06064e90b965ce2ba94e351f7013fb4a934c9 @paulcbetts paulcbetts committed Mar 30, 2013
Showing with 7 additions and 4 deletions.
  1. +3 −2 ReactiveUI.Android/ActivityRoutedViewHost.cs
  2. +4 −2 ReactiveUI.Mobile/AutoSuspendActivityHelper.cs
@@ -23,9 +23,10 @@ public sealed class ActivityRoutedViewHost : IDisposable
public ActivityRoutedViewHost(Activity hostActivity)
{
- _hostScreen = RxApp.GetService<IScreen>();
+ var keyUp = hostActivity.GetType()
+ .GetMethods(BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance)
+ .FirstOrDefault(x => x.Name == "OnKeyUp");
- var keyUp = hostActivity.GetType().GetMethods(BindingFlags.Public).First(x => x.Name == "OnKeyUp");
if (keyUp == null) {
throw new Exception("You must override OnKeyUp and call theRoutedViewHost.OnKeyUp");
}
@@ -66,8 +66,10 @@ public AutoSuspendActivityHelper(Activity hostActivity)
};
var missingMethod = methodsToCheck
- .Select(x =>
- Tuple.Create(x, hostActivity.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance).FirstOrDefault(y => y.Name == x)))
+ .Select(x => {
+ var methods = hostActivity.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
+ return Tuple.Create(x, methods.FirstOrDefault(y => y.Name == x));
+ })
.FirstOrDefault(x => x.Item2 == null);
if (missingMethod != null) {

0 comments on commit 1af0606

Please sign in to comment.