首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Catel的纪念品示例

Catel的纪念品示例
EN

Stack Overflow用户
提问于 2015-02-12 15:29:33
回答 1查看 222关注 0票数 0

希望这不会是一个一般性的问题,但它涉及到Catel示例提供的关于Github的纪念品示例。

由于某些原因,MainWindow没有将其数据上下文设置为MainWindowViewModel。这个例子本身并没有发挥作用。我以前看过日志,但有些信息让我感到困惑(我猜是缺乏理解)。我们很感激你的帮助。

代码语言:javascript
复制
09:21:00:182 => [DEBUG] [Catel.IoC.ServiceLocator] Registered type 'Catel.MVVM.IViewModelFactory' to instance of type 'Catel.MVVM.ViewModelFactory'
09:21:00:182 => [DEBUG] [Catel.MVVM.Providers.LogicBase] Using IViewModelFactory 'Catel.MVVM.ViewModelFactory' to instantiate the view model
09:21:00:183 => [DEBUG] [Catel.IoC.TypeFactory] Creating instance of type 'MomentoProject.ViewModels.MainWindowViewModel' using specific parameters. No constructor found in the cache, so searching for the right one
'MomentoProject.vshost.exe' (CLR v4.0.30319: MomentoProject.vshost.exe): Loaded 'C:\Users\Haytham\Documents\Visual Studio 2013\Projects\Catel\Catel2\App2\output\Debug\Catel.Extensions.Memento.dll'. Symbols loaded.
09:21:00:191 => [DEBUG] [Catel.IoC.TypeFactory] Checking if constructor 'public ctor(IUIVisualizerService uiVisualizerService, IMessageService messageService, IMementoService mementoService)' can be used
09:21:00:191 => [DEBUG] [Catel.IoC.TypeFactory] Constructor is not valid because parameter 'mementoService' cannot be resolved from the dependency resolver
09:21:00:192 => [DEBUG] [Catel.IoC.TypeFactory] The constructor is valid and can be used
09:21:00:192 => [DEBUG] [Catel.IoC.TypeFactory] No constructor could be used, cannot construct type 'MomentoProject.ViewModels.MainWindowViewModel' with the specified parameters
09:21:00:193 => [DEBUG] [Catel.MVVM.ViewModelFactory] Could not construct view model 'MomentoProject.ViewModels.MainWindowViewModel' using injection of data context 'null'
09:21:00:193 => [DEBUG] [Catel.MVVM.Providers.LogicBase] Used IViewModelFactory to instantiate view model, the factory did NOT return a valid view model
09:21:00:195 => [DEBUG] [Catel.MVVM.Views.ViewToViewModelMappingHelper] Initializing view model container to manage ViewToViewModel mappings
09:21:00:216 => [DEBUG] [Catel.MVVM.Views.ViewToViewModelMappingHelper] Initializing view model 'null'
09:21:00:217 => [DEBUG] [Catel.MVVM.Views.ViewToViewModelMappingHelper] Initialized view model 'null'
09:21:00:217 => [DEBUG] [Catel.MVVM.Views.ViewToViewModelMappingHelper] Initialized view model container 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-02-12 15:57:04

看来纪念品服务还没有注册。这是因为您可能只使用该接口。接口不是.NET加载程序集的原因。

有几件事可以解决:

  1. 使用Fody.LoadAssembliesOnStartup
  2. 在启动时添加类型(MementoService)(因此.NET将加载程序集)

当然,您也可以创建一个解决这个问题的PR来帮助其他人使用这些例子。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28481375

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档