diff --git a/Project_Periodensystem.Controller/PeriodensystemController.cs b/Project_Periodensystem.Controller/PeriodensystemController.cs index 60d71fd..3c363d7 100644 --- a/Project_Periodensystem.Controller/PeriodensystemController.cs +++ b/Project_Periodensystem.Controller/PeriodensystemController.cs @@ -1,19 +1,17 @@ -using System.Collections.Generic; +using System.Collections.ObjectModel; using Project_Periodensystem.Model; using Project_Periodensystem.Persistence; namespace Project_Periodensystem.Controller { - // Der Controller stellt der View Daten zur Verfügung und verwaltet die Verbindung zur Datenquelle. public class PeriodensystemController { - // Öffentliche Liste aller Elemente, die an die View gebunden werden kann - public List Elements { get; } + public ObservableCollection Elements { get; } - // Konstruktor – lädt beim Start alle Elemente aus der Persistence public PeriodensystemController() { - Elements = PeriodicTableData.Elements; + // Gießt die statische List<> in eine ObservableCollection + Elements = new ObservableCollection(PeriodicTableData.Elements); } } } diff --git a/Project_Periodensystem.Model/Elements.cs b/Project_Periodensystem.Model/Elements.cs index e015c48..b32e2c9 100644 --- a/Project_Periodensystem.Model/Elements.cs +++ b/Project_Periodensystem.Model/Elements.cs @@ -25,10 +25,12 @@ namespace Project_Periodensystem.Model // Serie oder Gruppe, zu der das Element gehört (z. B. "Halogen", "Alkalimetall") public string Series { get; set; } + public int Row { get; set; } + public int Column { get; set; } // Konstruktor: Erzeugt ein neues Element-Objekt mit allen relevanten Eigenschaften. public Element(int atomicNumber, string symbol, string elementname, double atomicWeight, - double electronegativity, double density, string series) + double electronegativity, double density, string series, int row, int column) { // Weist den Eigenschaften beim Erzeugen eines Objekts die übergebenen Werte zu AtomicNumber = atomicNumber; @@ -38,6 +40,8 @@ namespace Project_Periodensystem.Model Electronegativity = electronegativity; Density = density; Series = series; + Row = row; + Column = column; } } } diff --git a/Project_Periodensystem.Persistence/PeriodicTableData.cs b/Project_Periodensystem.Persistence/PeriodicTableData.cs index 747e85f..d5b51af 100644 --- a/Project_Periodensystem.Persistence/PeriodicTableData.cs +++ b/Project_Periodensystem.Persistence/PeriodicTableData.cs @@ -1,132 +1,150 @@ -using System.Collections.Generic; // Importiert die Generics-Bibliothek, die für die Verwendung von Listen und anderen generischen Datentypen erforderlich ist -using Project_Periodensystem.Model; // Importiert das Projektperiodensystem.Model-Namespace +using System.Collections.Generic; +using Project_Periodensystem.Model; -namespace Project_Periodensystem.Persistence // Definiert den Namespace für die Datenpersistenz des Periodensystems +namespace Project_Periodensystem.Persistence { - public static class PeriodicTableData // Definiert eine statische Klasse für die Daten des Periodensystems + public static class PeriodicTableData { - // Eine statische Liste von Elementen, die das Periodensystem repräsentieren public static List Elements { get; } = new List { - // Initialisierung der Elemente mit ihren Eigenschaften (Ordnungszahl, Symbol, Name, Atommasse, Elektronegativität, Dichte, Klassifikation) - new Element(1, "H", "Wasserstoff", 1.008, 2.2, 8.988e-05, "Nichtmetall"), - new Element(2, "He", "Helium", 4.0026, 0.0, 0.0001786, "Edelgas"), - new Element(3, "Li", "Lithium", 6.94, 0.98, 0.534, "Metall"), - new Element(4, "Be", "Beryllium", 9.0122, 1.57, 1.85, "Metall"), - new Element(5, "B", "Bor", 10.81, 2.04, 2.34, "Halbmetall"), - new Element(6, "C", "Kohlenstoff", 12.011, 2.55, 2.267, "Nichtmetall"), - new Element(7, "N", "Stickstoff", 14.007, 3.04, 0.0012506, "Nichtmetall"), - new Element(8, "O", "Sauerstoff", 15.999, 3.44, 0.001429, "Nichtmetall"), - new Element(9, "F", "Fluor", 18.998, 3.98, 0.001696, "Halogen"), - new Element(10, "Ne", "Neon", 20.18, 0.0, 0.0008999, "Edelgas"), - new Element(11, "Na", "Natrium", 22.989, 0.93, 0.971, "Metall"), - new Element(12, "Mg", "Magnesium", 24.305, 1.31, 1.738, "Metall"), - new Element(13, "Al", "Aluminium", 26.982, 1.61, 2.698, "Metall"), - new Element(14, "Si", "Silizium", 28.085, 1.90, 2.329, "Halbmetall"), - new Element(15, "P", "Phosphor", 30.974, 2.19, 1.82, "Nichtmetall"), - new Element(16, "S", "Schwefel", 32.06, 2.58, 2.067, "Nichtmetall"), - new Element(17, "Cl", "Chlor", 35.45, 3.16, 0.003214, "Halogen"), - new Element(18, "Ar", "Argon", 39.948, 0.0, 0.001784, "Edelgas"), - new Element(19, "K", "Kalium", 39.098, 0.82, 0.862, "Metall"), - new Element(20, "Ca", "Calcium", 40.078, 1.0, 1.54, "Metall"), - new Element(21, "Sc", "Scandium", 44.956, 1.36, 2.989, "Metall"), - new Element(22, "Ti", "Titan", 47.867, 1.54, 4.54, "Metall"), - new Element(23, "V", "Vanadium", 50.942, 1.63, 6.11, "Metall"), - new Element(24, "Cr", "Chrom", 51.996, 1.66, 7.15, "Metall"), - new Element(25, "Mn", "Mangan", 54.938, 1.55, 7.44, "Metall"), - new Element(26, "Fe", "Eisen", 55.845, 1.83, 7.874, "Metall"), - new Element(27, "Co", "Cobalt", 58.933, 1.88, 8.86, "Metall"), - new Element(28, "Ni", "Nickel", 58.693, 1.91, 8.912, "Metall"), - new Element(29, "Cu", "Kupfer", 63.546, 1.90, 8.96, "Metall"), - new Element(30, "Zn", "Zink", 65.38, 1.65, 7.14, "Metall"), - new Element(31, "Ga", "Gallium", 69.723, 1.81, 5.91, "Metall"), - new Element(32, "Ge", "Germanium", 72.63, 2.01, 5.323, "Halbmetall"), - new Element(33, "As", "Arsen", 74.922, 2.18, 5.776, "Halbmetall"), - new Element(34, "Se", "Selen", 78.971, 2.55, 4.809, "Nichtmetall"), - new Element(35, "Br", "Brom", 79.904, 2.96, 3.122, "Halogen"), - new Element(36, "Kr", "Krypton", 83.798, 3.0, 0.003733, "Edelgas"), - new Element(37, "Rb", "Rubidium", 85.468, 0.82, 1.532, "Metall"), - new Element(38, "Sr", "Strontium", 87.62, 0.95, 2.64, "Metall"), - new Element(39, "Y", "Yttrium", 88.906, 1.22, 4.472, "Metall"), - new Element(40, "Zr", "Zirconium", 91.224, 1.33, 6.52, "Metall"), - new Element(41, "Nb", "Niob", 92.906, 1.6, 8.57, "Metall"), - new Element(42, "Mo", "Molybdän", 95.95, 2.16, 10.22, "Metall"), - new Element(43, "Tc", "Technetium", 98, 1.9, 11, "Metall"), - new Element(44, "Ru", "Ruthenium", 101.07, 2.2, 12.37, "Metall"), - new Element(45, "Rh", "Rhodium", 102.91, 2.28, 12.41, "Metall"), - new Element(46, "Pd", "Palladium", 106.42, 2.20, 12.02, "Metall"), - new Element(47, "Ag", "Silber", 107.87, 1.93, 10.49, "Metall"), - new Element(48, "Cd", "Cadmium", 112.41, 1.69, 8.65, "Metall"), - new Element(49, "In", "Indium", 114.82, 1.78, 7.31, "Metall"), - new Element(50, "Sn", "Zinn", 118.71, 1.96, 7.287, "Metall"), - new Element(51, "Sb", "Antimon", 121.76, 2.05, 6.685, "Halbmetall"), - new Element(52, "Te", "Tellur", 127.60, 2.1, 6.232, "Halbmetall"), - new Element(53, "I", "Iod", 126.90, 2.66, 4.93, "Halogen"), - new Element(54, "Xe", "Xenon", 131.29, 2.6, 0.005887, "Edelgas"), - new Element(55, "Cs", "Caesium", 132.91, 0.79, 1.93, "Metall"), - new Element(56, "Ba", "Barium", 137.33, 0.89, 3.62, "Metall"), - new Element(57, "La", "Lanthan", 138.91, 1.10, 6.145, "Lanthanoid"), - new Element(58, "Ce", "Cer", 140.12, 1.12, 6.770, "Lanthanoid"), - new Element(59, "Pr", "Praseodym", 140.91, 1.13, 6.773, "Lanthanoid"), - new Element(60, "Nd", "Neodym", 144.24, 1.14, 7.007, "Lanthanoid"), - new Element(61, "Pm", "Promethium", 145, 1.13, 7.26, "Lanthanoid"), - new Element(62, "Sm", "Samarium", 150.36, 1.17, 7.52, "Lanthanoid"), - new Element(63, "Eu", "Europium", 151.96, 1.2, 5.243, "Lanthanoid"), - new Element(64, "Gd", "Gadolinium", 157.25, 1.2, 7.895, "Lanthanoid"), - new Element(65, "Tb", "Terbium", 158.93, 1.1, 8.229, "Lanthanoid"), - new Element(66, "Dy", "Dysprosium", 162.50, 1.22, 8.55, "Lanthanoid"), - new Element(67, "Ho", "Holmium", 164.93, 1.23, 8.795, "Lanthanoid"), - new Element(68, "Er", "Erbium", 167.26, 1.24, 9.066, "Lanthanoid"), - new Element(69, "Tm", "Thulium", 168.93, 1.25, 9.321, "Lanthanoid"), - new Element(70, "Yb", "Ytterbium", 173.04, 1.1, 6.965, "Lanthanoid"), - new Element(71, "Lu", "Lutetium", 174.97, 1.27, 9.84, "Lanthanoid"), - new Element(72, "Hf", "Hafnium", 178.49, 1.3, 13.31, "Metall"), - new Element(73, "Ta", "Tantal", 180.95, 1.5, 16.654, "Metall"), - new Element(74, "W", "Wolfram", 183.84, 2.36, 19.25, "Metall"), - new Element(75, "Re", "Rhenium", 186.21, 1.9, 21.02, "Metall"), - new Element(76, "Os", "Osmium", 190.23, 2.2, 22.59, "Metall"), - new Element(77, "Ir", "Iridium", 192.22, 2.2, 22.56, "Metall"), - new Element(78, "Pt", "Platin", 195.08, 2.28, 21.45, "Metall"), - new Element(79, "Au", "Gold", 196.97, 2.54, 19.32, "Metall"), - new Element(80, "Hg", "Quecksilber", 200.59, 2.0, 13.534, "Metall"), - new Element(81, "Tl", "Thallium", 204.38, 1.62, 11.85, "Metall"), - new Element(82, "Pb", "Blei", 207.2, 2.33, 11.34, "Metall"), - new Element(83, "Bi", "Bismut", 208.98, 2.02, 9.78, "Metall"), - new Element(84, "Po", "Polonium", 209, 2.0, 9.196, "Metall"), - new Element(85, "At", "Astat", 210, 2.2, 7, "Halogen"), - new Element(86, "Rn", "Radon", 222, 0.0, 0.00973, "Edelgas"), - new Element(87, "Fr", "Francium", 223, 0.7, 1.87, "Metall"), - new Element(88, "Ra", "Radium", 226, 0.9, 5.5, "Metall"), - new Element(89, "Ac", "Actinium", 227, 1.1, 10.07, "Actinoid"), - new Element(90, "Th", "Thorium", 232.04, 1.3, 11.72, "Actinoid"), - new Element(91, "Pa", "Protactinium", 231.04, 1.5, 15.37, "Actinoid"), - new Element(92, "U", "Uran", 238.03, 1.38, 18.95, "Actinoid"), - new Element(93, "Np", "Neptunium", 237, 1.36, 20.45, "Actinoid"), - new Element(94, "Pu", "Plutonium", 244, 1.28, 19.84, "Actinoid"), - new Element(95, "Am", "Americium", 243, 1.3, 13.67, "Actinoid"), - new Element(96, "Cm", "Curium", 247, 1.3, 13.51, "Actinoid"), - new Element(97, "Bk", "Berkelium", 247, 1.3, 14.79, "Actinoid"), - new Element(98, "Cf", "Californium", 251, 1.3, 15.1, "Actinoid"), - new Element(99, "Es", "Einsteinium", 252, 1.3, 8.84, "Actinoid"), - new Element(100, "Fm", "Fermium", 257, 1.3, 9.7, "Actinoid"), - new Element(101, "Md", "Mendelevium", 258, 1.3, 10.3, "Actinoid"), - new Element(102, "No", "Nobelium", 259, 1.3, 9.9, "Actinoid"), - new Element(103, "Lr", "Lawrencium", 262, 1.3, 15.6, "Actinoid"), - new Element(104, "Rf", "Rutherfordium", 267, 0.0, 23.2, "Metall"), - new Element(105, "Db", "Dubnium", 270, 0.0, 29.3, "Metall"), - new Element(106, "Sg", "Seaborgium", 271, 0.0, 35.0, "Metall"), - new Element(107, "Bh", "Bohrium", 270, 0.0, 37.1, "Metall"), - new Element(108, "Hs", "Hassium", 270, 0.0, 41.0, "Metall"), - new Element(109, "Mt", "Meitnerium", 278, 0.0, 27.0, "Metall"), - new Element(110, "Ds", "Darmstadtium", 281, 0.0, 28.5, "Metall"), - new Element(111, "Rg", "Roentgenium", 282, 0.0, 32.0, "Metall"), - new Element(112, "Cn", "Copernicium", 285, 0.0, 23.7, "Metall"), - new Element(113, "Nh", "Nihonium", 286, 0.0, 16.0, "Unbekannt"), - new Element(114, "Fl", "Flerovium", 289, 0.0, 14.0, "Unbekannt"), - new Element(115, "Mc", "Moscovium", 290, 0.0, 13.5, "Unbekannt"), - new Element(116, "Lv", "Livermorium", 293, 0.0, 12.9, "Unbekannt"), - new Element(117, "Ts", "Tenness", 294, 0.0, 7.2, "Unbekannt"), - new Element(118, "Og", "Oganesson", 294, 0.0, 4.9, "Unbekannt") + // Erste Periode + new Element(1, "H", "Wasserstoff", 1.008, 2.2, 0.000, "Nichtmetall", 0, 0), + new Element(2, "He", "Helium", 4.003, 0.0, 0.001, "Edelgas", 0, 17), + + // Zweite Periode + new Element(3, "Li", "Lithium", 6.940, 0.98, 0.534, "Metall", 1, 0), + new Element(4, "Be", "Beryllium", 9.012, 1.57, 1.850, "Metall", 1, 1), + new Element(5, "B", "Bor", 10.810, 2.04, 2.340, "Halbmetall", 1, 12), + new Element(6, "C", "Kohlenstoff", 12.011, 2.55, 2.267, "Nichtmetall", 1, 13), + new Element(7, "N", "Stickstoff", 14.007, 3.04, 0.001, "Nichtmetall", 1, 14), + new Element(8, "O", "Sauerstoff", 15.999, 3.44, 0.001, "Nichtmetall", 1, 15), + new Element(9, "F", "Fluor", 18.998, 3.98, 0.002, "Halogen", 1, 16), + new Element(10, "Ne", "Neon", 20.180, 0.0, 0.001, "Edelgas", 1, 17), + + // Dritte Periode + new Element(11, "Na", "Natrium", 22.990, 0.93, 0.971, "Metall", 2, 0), + new Element(12, "Mg", "Magnesium", 24.305, 1.31, 1.738, "Metall", 2, 1), + new Element(13, "Al", "Aluminium", 26.982, 1.61, 2.698, "Metall", 2, 12), + new Element(14, "Si", "Silizium", 28.085, 1.90, 2.329, "Halbmetall", 2, 13), + new Element(15, "P", "Phosphor", 30.974, 2.19, 1.820, "Nichtmetall", 2, 14), + new Element(16, "S", "Schwefel", 32.060, 2.58, 2.067, "Nichtmetall", 2, 15), + new Element(17, "Cl", "Chlor", 35.450, 3.16, 0.003, "Halogen", 2, 16), + new Element(18, "Ar", "Argon", 39.948, 0.0, 0.002, "Edelgas", 2, 17), + + // Vierte Periode + new Element(19, "K", "Kalium", 39.098, 0.82, 0.862, "Metall", 3, 0), + new Element(20, "Ca", "Calcium", 40.078, 1.00, 1.540, "Metall", 3, 1), + new Element(21, "Sc", "Scandium", 44.956, 1.36, 2.989, "Metall", 3, 2), + new Element(22, "Ti", "Titan", 47.867, 1.54, 4.540, "Metall", 3, 3), + new Element(23, "V", "Vanadium", 50.942, 1.63, 6.110, "Metall", 3, 4), + new Element(24, "Cr", "Chrom", 51.996, 1.66, 7.150, "Metall", 3, 5), + new Element(25, "Mn", "Mangan", 54.938, 1.55, 7.440, "Metall", 3, 6), + new Element(26, "Fe", "Eisen", 55.845, 1.83, 7.874, "Metall", 3, 7), + new Element(27, "Co", "Cobalt", 58.933, 1.88, 8.860, "Metall", 3, 8), + new Element(28, "Ni", "Nickel", 58.693, 1.91, 8.912, "Metall", 3, 9), + new Element(29, "Cu", "Kupfer", 63.546, 1.90, 8.960, "Metall", 3, 10), + new Element(30, "Zn", "Zink", 65.380, 1.65, 7.140, "Metall", 3, 11), + new Element(31, "Ga", "Gallium", 69.723, 1.81, 5.910, "Metall", 3, 12), + new Element(32, "Ge", "Germanium", 72.630, 2.01, 5.323, "Halbmetall", 3, 13), + new Element(33, "As", "Arsen", 74.922, 2.18, 5.776, "Halbmetall", 3, 14), + new Element(34, "Se", "Selen", 78.971, 2.55, 4.809, "Nichtmetall", 3, 15), + new Element(35, "Br", "Brom", 79.904, 2.96, 3.122, "Halogen", 3, 16), + new Element(36, "Kr", "Krypton", 83.798, 3.00, 0.004, "Edelgas", 3, 17), + // Fünfte Periode + new Element(37, "Rb", "Rubidium", 85.468, 0.82, 1.532, "Metall", 4, 0), + new Element(38, "Sr", "Strontium", 87.620, 0.95, 2.640, "Metall", 4, 1), + new Element(39, "Y", "Yttrium", 88.906, 1.22, 4.472, "Metall", 4, 2), + new Element(40, "Zr", "Zirconium", 91.224, 1.33, 6.520, "Metall", 4, 3), + new Element(41, "Nb", "Niob", 92.906, 1.60, 8.570, "Metall", 4, 4), + new Element(42, "Mo", "Molybdän", 95.950, 2.16, 10.220, "Metall", 4, 5), + new Element(43, "Tc", "Technetium", 98.000, 1.90, 11.000, "Metall", 4, 6), + new Element(44, "Ru", "Ruthenium", 101.070, 2.20, 12.370, "Metall", 4, 7), + new Element(45, "Rh", "Rhodium", 102.910, 2.28, 12.410, "Metall", 4, 8), + new Element(46, "Pd", "Palladium", 106.420, 2.20, 12.020, "Metall", 4, 9), + new Element(47, "Ag", "Silber", 107.870, 1.93, 10.490, "Metall", 4, 10), + new Element(48, "Cd", "Cadmium", 112.410, 1.69, 8.650, "Metall", 4, 11), + new Element(49, "In", "Indium", 114.820, 1.78, 7.310, "Metall", 4, 12), + new Element(50, "Sn", "Zinn", 118.710, 1.96, 7.287, "Metall", 4, 13), + new Element(51, "Sb", "Antimon", 121.760, 2.05, 6.685, "Halbmetall", 4, 14), + new Element(52, "Te", "Tellur", 127.600, 2.10, 6.232, "Halbmetall", 4, 15), + new Element(53, "I", "Iod", 126.900, 2.66, 4.930, "Halogen", 4, 16), + new Element(54, "Xe", "Xenon", 131.293, 2.60, 0.006, "Edelgas", 4, 17), + + // Sechste Periode + new Element(55, "Cs", "Caesium", 132.910, 0.79, 1.930, "Metall", 5, 0), + new Element(56, "Ba", "Barium", 137.330, 0.89, 3.620, "Metall", 5, 1), + // La-Lu gehört hier dazwischen, aber wir setzen Lanthanoide meist unten + new Element(72, "Hf", "Hafnium", 178.490, 1.30, 13.310, "Metall", 5, 3), + new Element(73, "Ta", "Tantal", 180.950, 1.50, 16.654, "Metall", 5, 4), + new Element(74, "W", "Wolfram", 183.840, 2.36, 19.250, "Metall", 5, 5), + new Element(75, "Re", "Rhenium", 186.210, 1.90, 21.020, "Metall", 5, 6), + new Element(76, "Os", "Osmium", 190.230, 2.20, 22.590, "Metall", 5, 7), + new Element(77, "Ir", "Iridium", 192.220, 2.20, 22.560, "Metall", 5, 8), + new Element(78, "Pt", "Platin", 195.080, 2.28, 21.450, "Metall", 5, 9), + new Element(79, "Au", "Gold", 196.970, 2.54, 19.320, "Metall", 5, 10), + new Element(80, "Hg", "Quecksilber", 200.590, 2.00, 13.534, "Metall", 5, 11), + new Element(81, "Tl", "Thallium", 204.380, 1.62, 11.850, "Metall", 5, 12), + new Element(82, "Pb", "Blei", 207.200, 2.33, 11.340, "Metall", 5, 13), + new Element(83, "Bi", "Bismut", 208.980, 2.02, 9.780, "Metall", 5, 14), + new Element(84, "Po", "Polonium", 209.000, 2.00, 9.196, "Metall", 5, 15), + new Element(85, "At", "Astat", 210.000, 2.20, 7.000, "Halogen", 5, 16), + new Element(86, "Rn", "Radon", 222.000, 0.00, 0.010, "Edelgas", 5, 17), + + // Siebte Periode + new Element(87, "Fr", "Francium", 223.000, 0.70, 1.870, "Metall", 6, 0), + new Element(88, "Ra", "Radium", 226.000, 0.90, 5.500, "Metall", 6, 1), + // Ac-Lr gehört hier dazwischen (Actinoide) + new Element(104, "Rf", "Rutherfordium", 267.000, 0.00, 23.200, "Metall", 6, 3), + new Element(105, "Db", "Dubnium", 270.000, 0.00, 29.300, "Metall", 6, 4), + new Element(106, "Sg", "Seaborgium", 271.000, 0.00, 35.000, "Metall", 6, 5), + new Element(107, "Bh", "Bohrium", 270.000, 0.00, 37.100, "Metall", 6, 6), + new Element(108, "Hs", "Hassium", 270.000, 0.00, 41.000, "Metall", 6, 7), + new Element(109, "Mt", "Meitnerium", 278.000, 0.00, 27.000, "Metall", 6, 8), + new Element(110, "Ds", "Darmstadtium", 281.000, 0.00, 28.500, "Metall", 6, 9), + new Element(111, "Rg", "Roentgenium", 282.000, 0.00, 32.000, "Metall", 6, 10), + new Element(112, "Cn", "Copernicium", 285.000, 0.00, 23.700, "Metall", 6, 11), + new Element(113, "Nh", "Nihonium", 286.000, 0.00, 16.000, "Unbekannt", 6, 12), + new Element(114, "Fl", "Flerovium", 289.000, 0.00, 14.000, "Unbekannt", 6, 13), + new Element(115, "Mc", "Moscovium", 290.000, 0.00, 13.500, "Unbekannt", 6, 14), + new Element(116, "Lv", "Livermorium", 293.000, 0.00, 12.900, "Unbekannt", 6, 15), + new Element(117, "Ts", "Tenness", 294.000, 0.00, 7.200, "Halogen", 6, 16), + new Element(118, "Og", "Oganesson", 294.000, 0.00, 4.900, "Unbekannt", 6, 17), + + // Lanthanoide (La bis Lu) → in Zeile 8 (4f-Block) + new Element(57, "La", "Lanthan", 138.910, 1.10, 6.145, "Lanthanoid", 8, 0), + new Element(58, "Ce", "Cer", 140.120, 1.12, 6.770, "Lanthanoid", 8, 1), + new Element(59, "Pr", "Praseodym", 140.910, 1.13, 6.773, "Lanthanoid", 8, 2), + new Element(60, "Nd", "Neodym", 144.240, 1.14, 7.007, "Lanthanoid", 8, 3), + new Element(61, "Pm", "Promethium", 145.000, 1.13, 7.260, "Lanthanoid", 8, 4), + new Element(62, "Sm", "Samarium", 150.360, 1.17, 7.520, "Lanthanoid", 8, 5), + new Element(63, "Eu", "Europium", 151.960, 1.20, 5.243, "Lanthanoid", 8, 6), + new Element(64, "Gd", "Gadolinium", 157.250, 1.20, 7.895, "Lanthanoid", 8, 7), + new Element(65, "Tb", "Terbium", 158.930, 1.10, 8.229, "Lanthanoid", 8, 8), + new Element(66, "Dy", "Dysprosium", 162.500, 1.22, 8.550, "Lanthanoid", 8, 9), + new Element(67, "Ho", "Holmium", 164.930, 1.23, 8.795, "Lanthanoid", 8, 10), + new Element(68, "Er", "Erbium", 167.260, 1.24, 9.066, "Lanthanoid", 8, 11), + new Element(69, "Tm", "Thulium", 168.930, 1.25, 9.321, "Lanthanoid", 8, 12), + new Element(70, "Yb", "Ytterbium", 173.040, 1.10, 6.965, "Lanthanoid", 8, 13), + new Element(71, "Lu", "Lutetium", 174.970, 1.27, 9.840, "Lanthanoid", 8, 14), + + // Actinoide (Ac bis Lr) → in Zeile 9 (5f-Block) + new Element(89, "Ac", "Actinium", 227.000, 1.10, 10.070, "Actinoid", 9, 0), + new Element(90, "Th", "Thorium", 232.040, 1.30, 11.720, "Actinoid", 9, 1), + new Element(91, "Pa", "Protactinium", 231.040, 1.50, 15.370, "Actinoid", 9, 2), + new Element(92, "U", "Uran", 238.030, 1.38, 18.950, "Actinoid", 9, 3), + new Element(93, "Np", "Neptunium", 237.000, 1.36, 20.450, "Actinoid", 9, 4), + new Element(94, "Pu", "Plutonium", 244.000, 1.28, 19.840, "Actinoid", 9, 5), + new Element(95, "Am", "Americium", 243.000, 1.30, 13.670, "Actinoid", 9, 6), + new Element(96, "Cm", "Curium", 247.000, 1.30, 13.510, "Actinoid", 9, 7), + new Element(97, "Bk", "Berkelium", 247.000, 1.30, 14.790, "Actinoid", 9, 8), + new Element(98, "Cf", "Californium", 251.000, 1.30, 15.100, "Actinoid", 9, 9), + new Element(99, "Es", "Einsteinium", 252.000, 1.30, 8.840, "Actinoid", 9, 10), + new Element(100, "Fm", "Fermium", 257.000, 0.00, 9.700, "Actinoid", 9, 11), + new Element(101, "Md", "Mendelevium", 258.000, 0.00, 10.300, "Actinoid", 9, 12), + new Element(102, "No", "Nobelium", 259.000, 0.00, 9.900, "Actinoid", 9, 13), + new Element(103, "Lr", "Lawrencium", 262.000, 0.00, 15.600, "Actinoid", 9, 14) + + }; } -} \ No newline at end of file +} diff --git a/Project_Periodensystem.View/Components/ElementTile.axaml b/Project_Periodensystem.View/Components/ElementTile.axaml new file mode 100644 index 0000000..09a873b --- /dev/null +++ b/Project_Periodensystem.View/Components/ElementTile.axaml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Project_Periodensystem.View/Components/ElementTile.axaml.cs b/Project_Periodensystem.View/Components/ElementTile.axaml.cs new file mode 100644 index 0000000..552c5e7 --- /dev/null +++ b/Project_Periodensystem.View/Components/ElementTile.axaml.cs @@ -0,0 +1,27 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Media; + +namespace Project_Periodensystem.View.Components +{ + public partial class ElementTile : UserControl + { + public static readonly StyledProperty IsFlippedProperty = + AvaloniaProperty.Register(nameof(IsFlipped)); + + public bool IsFlipped + { + get => GetValue(IsFlippedProperty); + set => SetValue(IsFlippedProperty, value); + } + + public ElementTile() + { + InitializeComponent(); + + // Optional: Klick per Code registrieren + this.PointerPressed += (_, __) => IsFlipped = !IsFlipped; + } + } +} diff --git a/Project_Periodensystem.View/Components/ElementTile.xaml b/Project_Periodensystem.View/Components/ElementTile.xaml deleted file mode 100644 index f7f0fee..0000000 --- a/Project_Periodensystem.View/Components/ElementTile.xaml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - BorderBrush="Black" - BorderThickness="1" - CornerRadius="4" - Padding="4"> - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Project_Periodensystem.View/Components/ElementTile.xaml.cs b/Project_Periodensystem.View/Components/ElementTile.xaml.cs deleted file mode 100644 index f0d0c9b..0000000 --- a/Project_Periodensystem.View/Components/ElementTile.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Namespace der Datei – muss zu deiner Projektstruktur und XAML-Klasse passen -namespace Project_Periodensystem.View -{ - // Diese Klasse ist der "Code-Behind" für die XAML-Datei ElementTile.xaml - // Sie erbt von Avalonia's UserControl und repräsentiert eine einzelne Kachel (ein Element) - - public partial class ElementTile : UserControl - { - // Konstruktor – wird aufgerufen, wenn ein neues ElementTile erstellt wird - public ElementTile() - { - InitializeComponent(); // Lädt und verbindet die XAML mit dem Code - } - } -} diff --git a/Project_Periodensystem.View/Converters/BoolToScaleXConverter.cs b/Project_Periodensystem.View/Converters/BoolToScaleXConverter.cs new file mode 100644 index 0000000..16da2c3 --- /dev/null +++ b/Project_Periodensystem.View/Converters/BoolToScaleXConverter.cs @@ -0,0 +1,20 @@ +using Avalonia.Data.Converters; +using System; +using System.Globalization; + +namespace Project_Periodensystem.View.Converters +{ + public class BoolToScaleXConverter : IValueConverter + { + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + bool flipped = value is bool b && b; + return flipped ? -1 : 1; + } + + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + { + throw new NotSupportedException(); + } + } +} diff --git a/Project_Periodensystem.View/Converters/GridPositionConverters.cs b/Project_Periodensystem.View/Converters/GridPositionConverters.cs new file mode 100644 index 0000000..b98f288 --- /dev/null +++ b/Project_Periodensystem.View/Converters/GridPositionConverters.cs @@ -0,0 +1,38 @@ +using System; +using System.Globalization; +using Avalonia.Data.Converters; + +namespace Project_Periodensystem.View.Converters +{ + public class RowToYConverter : IValueConverter + { + private const double TileHeight = 80; + + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + if (value is int row) + return row * TileHeight; + + return 0; + } + + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => + throw new NotImplementedException(); + } + + public class ColumnToXConverter : IValueConverter + { + private const double TileWidth = 80; + + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + if (value is int column) + return column * TileWidth; + + return 0; + } + + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => + throw new NotImplementedException(); + } +} diff --git a/Project_Periodensystem.View/Converters/SeriesToColorConverter.cs b/Project_Periodensystem.View/Converters/SeriesToColorConverter.cs new file mode 100644 index 0000000..3cfd3bb --- /dev/null +++ b/Project_Periodensystem.View/Converters/SeriesToColorConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Globalization; +using Avalonia.Data.Converters; +using Avalonia.Media; + +namespace Project_Periodensystem.View.Converters +{ + public class SeriesToColorConverter : IValueConverter + { + public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + if (value is not string series) + return Brushes.Gray; + + return series switch + { + "Nichtmetall" => Brushes.Green, + "Metall" => Brushes.DarkRed, + "Halbmetall" => Brushes.Orange, + "Edelgas" => Brushes.MediumPurple, + "Halogen" => Brushes.DeepPink, + "Lanthanoid" => Brushes.Blue, + "Actinoid" => Brushes.DarkBlue, + "Unbekannt" => Brushes.DimGray, + _ => Brushes.Black + }; + } + + public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => + throw new NotImplementedException(); + } +} diff --git a/Project_Periodensystem.View/Images/image1.jpeg b/Project_Periodensystem.View/Images/image1.jpeg deleted file mode 100644 index 83de953..0000000 Binary files a/Project_Periodensystem.View/Images/image1.jpeg and /dev/null differ diff --git a/Project_Periodensystem.View/MainWindow.axaml b/Project_Periodensystem.View/MainWindow.axaml index b128a8a..d3419b1 100644 --- a/Project_Periodensystem.View/MainWindow.axaml +++ b/Project_Periodensystem.View/MainWindow.axaml @@ -1,59 +1,25 @@ + Width="1600" Height="900" Background="White"> - - - - - - - - - - - Spacing="12" - Grid.Row="0"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/Project_Periodensystem.View/MainWindow.axaml.cs b/Project_Periodensystem.View/MainWindow.axaml.cs index 25fbe08..ba1ca40 100644 --- a/Project_Periodensystem.View/MainWindow.axaml.cs +++ b/Project_Periodensystem.View/MainWindow.axaml.cs @@ -11,16 +11,14 @@ namespace Project_Periodensystem.View // Namespace entspricht deinem Projektordn public partial class MainWindow : Window { // Der Controller verwaltet die Daten und steuert das Verhalten (MVCP-Prinzip!) - private readonly PeriodensystemController _controller; + private readonly PeriodensystemController? _controller; // Konstruktor – wird aufgerufen, wenn das Fenster erstellt wird public MainWindow() { InitializeComponent(); // Initialisiert die grafischen Komponenten aus XAML - - _controller = new PeriodensystemController(); // Erstellt eine Instanz des Controllers - - DataContext = _controller; + _controller = new PeriodensystemController(); + DataContext = _controller; // <-- wichtig! // Das Fenster (und alles darin) bekommt den Controller als Datenquelle (Binding-Kontext) // Dadurch funktionieren z.B. Bindings wie {Binding Elements} in der XAML } diff --git a/Project_Periodensystem.View/Project_Periodensystem.View.csproj b/Project_Periodensystem.View/Project_Periodensystem.View.csproj index 9456655..39e1e1a 100644 --- a/Project_Periodensystem.View/Project_Periodensystem.View.csproj +++ b/Project_Periodensystem.View/Project_Periodensystem.View.csproj @@ -1,45 +1,32 @@  - + - WinExe - net9.0 - enable - true - app.manifest - - true + + + true + + + false - - - - - - - - None - All - - - - +