Permalink
Browse files

Various sample fixes

  • Loading branch information...
1 parent 3efba9a commit c7cb53ec9b019f4c2ee4bf86ebd1a3625b9031dd @paulcbetts paulcbetts committed Feb 26, 2013
@@ -66,7 +66,13 @@ public AppBootstrapper()
Router = new RoutingState();
Kernel = new StandardKernel();
+ Kernel.Bind<TestPage1ViewModel>().ToSelf();
+ Kernel.Bind<TestPage2ViewModel>().ToSelf();
+ Kernel.Bind<TestPage3ViewModel>().ToSelf();
+
Kernel.Bind<IViewFor<TestPage1ViewModel>>().To<TestPage1View>();
+ Kernel.Bind<IViewFor<TestPage2ViewModel>>().To<TestPage2View>();
+ Kernel.Bind<IViewFor<TestPage3ViewModel>>().To<TestPage3View>();
Kernel.Bind<IApplicationRootState>().ToConstant(this);
Kernel.Bind<IViewFor>().To<MainPage>().Named("InitialPage");
@@ -13,8 +13,8 @@ public class TestPage1ViewModel : ReactiveObject, IRoutableViewModel
public string UrlPathSegment { get { return "test1"; } }
public IScreen HostScreen { get; private set; }
- public ReactiveCommand NavPage2 { get; protected set; }
- public ReactiveCommand NavPage3 { get; protected set; }
+ public IReactiveCommand NavPage2 { get; protected set; }
+ public IReactiveCommand NavPage3 { get; protected set; }
[DataMember]
Guid _RandomGuid;
@@ -25,15 +25,11 @@ public class TestPage1ViewModel : ReactiveObject, IRoutableViewModel
public TestPage1ViewModel(IScreen screen = null)
{
- HostScreen = screen;
+ HostScreen = screen ?? RxApp.GetService<IScreen>();
RandomGuid = Guid.NewGuid();
- // XXX: This is hella jank
- NavPage2 = new ReactiveCommand(screen.Router.Navigate.CanExecuteObservable);
- NavPage2.Select(_ => new TestPage2ViewModel(screen)).InvokeCommand(screen.Router.Navigate);
-
- NavPage3 = new ReactiveCommand(screen.Router.Navigate.CanExecuteObservable);
- NavPage3.Select(_ => new TestPage3ViewModel(screen)).InvokeCommand(screen.Router.Navigate);
+ NavPage2 = HostScreen.Router.NavigateCommandFor<TestPage2ViewModel>();
+ NavPage3 = HostScreen.Router.NavigateCommandFor<TestPage3ViewModel>();
}
}
}
@@ -21,7 +21,7 @@ public class TestPage2ViewModel : ReactiveObject, IRoutableViewModel
public TestPage2ViewModel(IScreen screen = null)
{
- HostScreen = screen;
+ HostScreen = screen ?? RxApp.GetService<IScreen>();
RandomGuid = Guid.NewGuid();
}
}
@@ -20,7 +20,7 @@ public class TestPage3ViewModel : ReactiveObject, IRoutableViewModel
public TestPage3ViewModel(IScreen screen = null)
{
- HostScreen = screen;
+ HostScreen = screen ?? RxApp.GetService<IScreen>();
RandomGuid = Guid.NewGuid();
}
}

0 comments on commit c7cb53e

Please sign in to comment.