public static MainViewModel GetComposedMainViewModel( IFilePathGetter filePathGetter) { MainViewModel mainViewModel = new MainViewModel(filePathGetter, new AssemblyManager()); //in order to force exception List <AssemblyCatalog> catalogs = new List <AssemblyCatalog>(); List <ComposablePartDefinition[]> parts = new List <ComposablePartDefinition[]>(); string path = Directory.GetParent(Assembly.GetEntryAssembly().Location).FullName; foreach (string dll in Directory.GetFiles(path, "*.dll")) { AssemblyCatalog assemblyCatalog = new AssemblyCatalog(Assembly.LoadFile(dll)); parts.Add(assemblyCatalog.Parts.ToArray()); } AggregateCatalog catalog = new AggregateCatalog(); catalog.Catalogs.Add(new DirectoryCatalog(path)); CompositionContainer = new CompositionContainer(catalog); try { CompositionContainer.ComposeParts(mainViewModel); mainViewModel.AssemblyManager = AssemblyManager.GetComposed(CompositionContainer); } catch (CompositionException compositionException) { throw new ApplicationException("Could not compose application successfully. ", compositionException); } return(mainViewModel); }
public ImageHandler(IFilePathGetter filePathHandler, IModel model) { // INSTANTIATE the local '_filePathHandler' with the passed reference _filePathHandler = filePathHandler; // INSTANTIATE the local 'imgIndex' to 0 _imgIndex = 0; // INSTANTIATE the local '_model' with the passed reference _model = model; }
public bool Start() { _filePathGetter = _filePathGetterFactory.GetFilePathGetter(_filePath); // nothing needed to be done return(true); }
public bool Start() { _filePathGetter = _filePathGetterFactory.GetFilePathGetter(_filePath); // nothing needed to be done return true; }