Catel 的纪念品示例
Memento Example From Catel
希望这不会是一个如此笼统的问题,但它涉及 Catel Examples 在 Github 上提供的纪念示例。
由于某些原因,MainWindow 没有将其数据上下文设置为 MainWindowViewModel。该示例本身不起作用。我之前已经显示过日志,但有些消息让我感到困惑(我猜是缺乏理解)。感谢帮助。
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
纪念品服务似乎还没有注册。这是因为您可能只使用了界面。接口不是 .NET 加载程序集的原因。
有几件事可以解决这个问题:
- 使用Fody.LoadAssembliesOnStartup
- 在启动时添加一个 typeof(MementoService)(以便 .NET 加载程序集)
您当然也可以创建一个 PR 来解决这个问题,以帮助其他人也使用这些示例。
希望这不会是一个如此笼统的问题,但它涉及 Catel Examples 在 Github 上提供的纪念示例。
由于某些原因,MainWindow 没有将其数据上下文设置为 MainWindowViewModel。该示例本身不起作用。我之前已经显示过日志,但有些消息让我感到困惑(我猜是缺乏理解)。感谢帮助。
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
纪念品服务似乎还没有注册。这是因为您可能只使用了界面。接口不是 .NET 加载程序集的原因。
有几件事可以解决这个问题:
- 使用Fody.LoadAssembliesOnStartup
- 在启动时添加一个 typeof(MementoService)(以便 .NET 加载程序集)
您当然也可以创建一个 PR 来解决这个问题,以帮助其他人也使用这些示例。