Aug 9, 2011 at 9:11 AM
Edited Aug 9, 2011 at 9:18 AM
|
Using the Caliburn.Micro version 1.2, I'm trying to navigate to a page which lives inside an another assembly. The navigation is done like this:
navigation.Navigate(new
Uri("/Module1;component/MyPage.xaml"
, UriKind.Relative));
Where the navigation-field is type of INavigationService.
I'm having some problems with the ViewModelLocator though, because by default it seems to only try to locate the view models which live inside the
executing assembly. I've tried to go around this problem but WP7's platform seems to have restricted access to all the required functions. So my question is, is it possible to get the ViewModelLocator to work for a page which isn't inside the executing assembly?
At the moment
I first tried to override the SelectAssemblies, but the following code doesn't work, because we're not permitted to access the Assembly.Load:
protected
override
IEnumerable<Assembly
> SelectAssemblies() {
return
new[]
{ Application.Current.GetType().Assembly,
Assembly.LoadFrom("Module1.dll"
)}; }
I then thought about modifying the code in LocateTypeForViewType so that it goes through all the assemblies inside the current AppDomain instead of
AssemblySource, but WP7 version of .NET is missing the GetAssemblies-method.
I found all the assemblies from the Deployment.Current.Parts but the assemblies there aren't of
type Assembly but something called AssemblyPart. And I suppose there's no way to transform an AssemblyPart into an Assembly.
Without modifying anything and just using the base Caliburn.Micro 1.2, I'm getting the following log-messages:
View Model not found. Searched: Module1.MyPageViewModel, .
View Model not found. Searched: Module1.MyPageViewModel, Module1.IMyPageViewModel.
I'm using the SimpleContainer and I have registered the view models like this:
container.PerRequest<MainPageViewModel>();
container.PerRequest<MyPageViewModel>();
Btw. Thanks for the framework. It's just an excellent piece of code.
|