/// <summary> /// Initializes the view model. /// </summary> protected ViewModelBase() { if (CatelEnvironment.IsInDesignMode) { return; } UniqueIdentifier = UniqueIdentifierHelper.GetUniqueIdentifier(GetType()); ViewModelConstructionTime = DateTime.Now; AuditingHelper.RegisterViewModel(this); _viewModelCommandManager = ViewModelCommandManager.Create(this); _viewModelCommandManager.AddHandler((viewModel, propertyName, command, commandParameter) => _catelCommandExecuted.SafeInvoke(this, new CommandExecutedEventArgs((ICatelCommand)command, commandParameter, propertyName))); ViewModelManager.RegisterViewModelInstance(this); }
/// <summary> /// Initializes the view model. /// </summary> protected ViewModelBase() { if (Catel.Environment.IsInDesignMode) { return; } UniqueIdentifier = UniqueIdentifierHelper.GetUniqueIdentifier(GetType()); ViewModelConstructionTime = DateTime.Now; AuditingHelper.RegisterViewModel(this); _viewModelCommandManager = ViewModelCommandManager.Create(this); _viewModelCommandManager.AddHandler((viewModel, propertyName, command, commandParameter) => _catelCommandExecuted.SafeInvoke(this, new CommandExecutedEventArgs((ICatelCommand)command, commandParameter, propertyName))); ServiceLocator = IoCConfiguration.DefaultServiceLocator; DependencyResolver = ServiceLocator.ResolveType <IDependencyResolver>(); RegisterViewModelServices(ServiceLocator); ViewModelManager.RegisterViewModelInstance(this); }