Example #1
0
        /// <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);
        }
Example #2
0
        /// <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);
        }