private void BrowseForAssemblyButton_Click(object sender, RoutedEventArgs e) { var dlg = new winforms.OpenFileDialog(); dlg.Title = "Select Assembly"; dlg.DefaultExt = "*.dll"; dlg.Filter = "Assemblies (*.dll) | *.dll"; if (winforms.DialogResult.Cancel == dlg.ShowDialog()) { return; } var assembly = Assembly.LoadFile(dlg.FileName); AppDomain.CurrentDomain.AssemblyResolve += CreateResolver(new FileInfo(dlg.FileName).Directory.FullName); var query = from type in assembly.GetExportedTypes() select type; var model = new ComponentSelectorViewModel(); model.Types.AddRange<Type>(query); model.ContainsTypes = query.Count() > 0; DataContext = model; }
public ComponentSelectorWindow(Type componentType) { InitializeComponent(); _componentType = componentType; DataContext = new ComponentSelectorViewModel(); }