Надеюсь, это не будет таким общим вопросом, но он включает в себя пример из примера, приведенный в примерах Catel на Github.Memento Example from Catel
По какой-то причине 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
Yup, который исправил его. IServiceLocator serviceLocator = ServiceLocator.Default; serviceLocator.RegisterType(); –
Здесь я создаю PR? Большое спасибо, кстати. –
Не здесь, ищите в Интернете о том, как делать PR (тянуть запрос) –