Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minimum boilerplate to get Routing going
- Loading branch information
1 parent
b3f7c2d
commit 02b0364
Showing
4 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
<Window x:Class="AkavacheExplorer.MainWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:Routing="clr-namespace:ReactiveUI.Routing;assembly=ReactiveUI.Routing" x:Name="theWindow" | ||
Title="MainWindow" Height="350" Width="525"> | ||
<Grid> | ||
|
||
</Grid> | ||
<Routing:RoutedViewHost Router="{Binding Path=ViewModel.Router, ElementName=theWindow}" /> | ||
</Window> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Ninject; | ||
using ReactiveUI; | ||
using ReactiveUI.Routing; | ||
|
||
namespace AkavacheExplorer.ViewModels | ||
{ | ||
public class AppBootstrapper : ReactiveObject, IScreen | ||
{ | ||
public IRoutingState Router { get; protected set; } | ||
|
||
public AppBootstrapper(IKernel kernel = null, IRoutingState router = null) | ||
{ | ||
kernel = kernel ?? createStandardKernel(); | ||
router = router ?? new RoutingState(); | ||
|
||
RxApp.ConfigureServiceLocator( | ||
(t, s) => kernel.Get(t, s), (t, s) => kernel.GetAll(t, s)); | ||
} | ||
|
||
IKernel createStandardKernel() | ||
{ | ||
var ret = new StandardKernel(); | ||
return ret; | ||
} | ||
} | ||
} |