public ThingDialogNavigationService([ImportMany] IEnumerable <Lazy <IThingDialogView, IClassKindMetaData> > dialogViews, [ImportMany] IEnumerable <Lazy <IThingDialogViewModel, IClassKindMetaData> > dialogViewModels, [Import] ISpellDictionaryService spellDictionaryService, [Import] ISpecialTermsService specialTermsService) { var sw = new Stopwatch(); sw.Start(); logger.Debug("Instantiating the ThingDialogNavigationService"); this.viewDictionary = new Dictionary <ClassKind, Type>(); foreach (var dialogView in dialogViews) { var classKindView = dialogView.Metadata.ClassKind; var viewType = dialogView.Value.GetType(); this.viewDictionary.Add(classKindView, viewType); Logger.Trace("Add viewType {0} for ClassKind {1}", viewType.Name, classKindView); } this.viewModelDictionary = new Dictionary <ClassKind, Type>(); foreach (var dialogViewModel in dialogViewModels) { var classKindViewModel = dialogViewModel.Metadata.ClassKind; var viewModelType = dialogViewModel.Value.GetType(); this.viewModelDictionary.Add(classKindViewModel, viewModelType); Logger.Trace("Add viewModelType {0} for ClassKind {1}", viewModelType.Name, classKindViewModel); } this.spellDictionaryService = spellDictionaryService; this.specialTermService = specialTermsService; sw.Stop(); logger.Debug("The ThingDialogNavigationService was instantiated in {0} [ms]", sw.ElapsedMilliseconds); }
public void SetUp() { this.session = new Mock <ISession>(); var uri = new Uri("http://rheagroup.com"); var siteDir = new SiteDirectory(Guid.NewGuid(), null, uri); this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(siteDir); this.simpleUnit = new SimpleUnit(Guid.NewGuid(), null, uri); var transactionContext = TransactionContextResolver.ResolveContext(siteDir); this.transaction = new ThingTransaction(transactionContext); this.simpleUnitDialogView = new TestView(); var viewExportAttribute = new ThingDialogViewExportAttribute(ClassKind.SimpleUnit); var lazyview = new Lazy <IThingDialogView, IClassKindMetaData>(() => this.simpleUnitDialogView, viewExportAttribute); this.simpleUnitDialogViewModel = new TestViewModel(this.simpleUnit, this.transaction, this.session.Object, true, ThingDialogKind.Create, null, null); var viewModelExportAttribute = new ThingDialogViewModelExportAttribute(ClassKind.SimpleUnit); var lazyviewmodel = new Lazy <IThingDialogViewModel, IClassKindMetaData>(() => this.simpleUnitDialogViewModel, viewModelExportAttribute); this.lazyviews = new List <Lazy <IThingDialogView, IClassKindMetaData> >(); this.lazyviews.Add(lazyview); this.lazyviewmodels = new List <Lazy <IThingDialogViewModel, IClassKindMetaData> >(); this.lazyviewmodels.Add(lazyviewmodel); this.specialTermService = new SpecialTermsService(); }
/// <summary> /// Initializes the text decorators. /// </summary> private void InitializeDecorators() { try { this.termsService = ServiceLocator.Current.GetInstance <ISpecialTermsService>(); var termDecorator = new MultiRegexWordDecoration(); termDecorator.Brush = new SolidColorBrush(Colors.Blue); termDecorator.Words.AddRange(this.termsService.TermsList); this.Decorations.Add(termDecorator); } catch (Exception ex) { logger.Error(ex, "The ServiceLocator instance is null"); } }