public void InitialiseInterfaces() { mBindings.Clear(); string folder = Path.GetDirectoryName(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); folder = Path.GetFullPath(Path.Combine(folder, "../")); var assemblies = ConfigurationFolderPanel.LoadAssemblies(folder); Console.WriteLine("\n\n\nProcessing " + Path.GetDirectoryName(mFile) + "."); //Iterate through every assembly in the folder where the tool is running foreach (var assembly in assemblies) { ListViewGroup g = null; string assemblyName = assembly.FullName.Split(',')[0]; //Iterate through every class which implements one of the interfaces on the interfaces list var types = LoadTypes(assembly); Console.WriteLine("Loading {1,3} interface implementations from {0}.", assemblyName, types.Count()); //Iterate through every class which implements one of the interfaces on the interfaces list foreach (var clazz in types) { var intrface = clazz.GetInterfaces().Intersect(mInterfaces, sInterfaceComparer).First(); Invoke(new Action(() => { if (g == null) { g = new ListViewGroup(assemblyName); BindingsList.Groups.Add(g); mBindings.Add(assemblyName, new List <Binding>()); } ListViewItem it = new ListViewItem(g); it.SubItems.Add(new ListViewItem.ListViewSubItem(it, clazz.Name)); it.SubItems.Add(new ListViewItem.ListViewSubItem(it, intrface.Name)); var fields = clazz.GetFields(); FieldInfo details = clazz.GetFields().FirstOrDefault(f => f.Name == "Details"); if (details != null) { it.SubItems.Add(new ListViewItem.ListViewSubItem(it, details.GetValue(null).ToString())); } Binding binding = new Binding(assemblyName, clazz, intrface, it); mBindings[assemblyName].Add(binding); mBindingsByItem.Add(it, binding); BindingsList.Items.Add(it); })); } } }
private ConfigurationFolderPanel AddFolder(string folder) { TabPage page = new TabPage(folder); ConfigurationFolderPanel panel = new ConfigurationFolderPanel(folder, mSetter); mPanels.Add(panel); panel.Dock = DockStyle.Fill; page.Controls.Add(panel); FoldersTab.TabPages.Add(page); return(panel); }