I tried to figure this out for several days, with no luck.
I am trying to use [ImportMany] to import from a directory, a complete DLL, with an export of type IEditorSystem, which have custom metadata like IEditorSystemMetadata. First, I would like to get metadata and push it onto some text fields, etc., so that the user can choose which Editor system to use, and when selected, load this system ...
I follow the examples as best as possible, that's what I still have.
[ImportMany]
public ObservableCollection<Lazy<IEditorSystem, IEditorSystemMetadata>> EditorSystemList
This is what it should import:
[Export(typeof(IEditorSystem))]
[SignalSystemData("Very Very Long Name", "Short Name")]
public class MyEditorSystem: IEditorSystem
{
public MyEditorSystem()
{
}
}
and launch:
AggregateCatalog Catalog = new AggregateCatalog(
new DirectoryCatalog(@".\EditorSystems"),
new AssemblyCatalog(Assembly.GetExecutingAssembly()));
CompositionContainer Container = new CompositionContainer(Catalog);
Container.ComposeParts(this);
I can see in the catalog. Displays both MyEditorSystem and viewmodel with ImportMany, but EditorSystemList is never populated. I get no layout errors.
, - Lazy < > ,
public ObservableCollection<IEditorSystem> EditorSystemList
.
, , , Cinch, MEFedMVVM, MEF. , , .
, , - ?
Update:
IComposer, .
ImportMany , . - , , , .
: IEditorSystem DLL, .
dll .
- dll.
, MEF, :)