public void MaterialMapperTest() { var usedMaterials = new List <string> { "wood", "plastic", "metan", "C4", "steel" }; var availableSurfaces = new List <Surface> { new Surface { ID = "Surface for plastic" }, new Surface { ID = "Surface for steel" }, new Surface { ID = "Surface for metan" }, new Surface { ID = "Surface for wood" }, new Surface { ID = "Surface for C4" } }; //var materialMapper = new MaterialMapper(usedMaterials, availableSurfaces, new List<MaterialAndSurface>()); //materialMapper.ShowDialog(); //XmlSerializer<List<MaterialAndSurface>>.Serialize(materialMapper.MappingMaterials, @"C:\surface.xml"); var deserialized = XmlSerializer <List <MaterialAndSurface> > .Deserialize(@"C:\surface.xml"); //var dict = deserialized.ToDictionary(); var materialMapper2 = new MaterialMapper(usedMaterials, availableSurfaces, deserialized); materialMapper2.ShowDialog(); }
public void EditMaterialsMappings() { var usedMaterials = AcadInfoProvider.AllSolidsFromCurrentDrawing().GetMaterials(); var surfacesStore = XmlSerializer <List <Surface> > .Deserialize(PluginInfoProvider.PathToSurfacesStore, Log); var mappingMaterials = XmlSerializer <List <MaterialAndSurface> > .Deserialize(PluginInfoProvider.PathToMappingsMaterials, Log); var materialMapper = new MaterialMapper(usedMaterials, surfacesStore, mappingMaterials); var dialogResult = materialMapper.ShowDialog(); if (dialogResult == DialogResult.OK) { XmlSerializer <List <MaterialAndSurface> > .Serialize(materialMapper.MappingMaterials, PluginInfoProvider.PathToMappingsMaterials); } materialMapper.Dispose(); materialMapper = null; }