Code: |
// Normalement c'est a stocker dans la BDD mais c'est pour l'exemple public enum eSocketType { None = 0x00, LGA1150 = 0x01, AM3Plus = 0x02 } public enum eFormatType { None = 0x00, ATX = 0x01, mATX = 0x02 } public struct Motherboard { public int ID; public string Name; public eSocketType Socket; public eFormatType Format; } public struct CPU { public int ID; public string Name; public eSocketType Socket; } public class CurrentPC { protected int _ID; protected Motherboard _Motherboard; protected CPU _CPU; public Motherboard Motherboard { get{ return _Motherboard;} set { if (_Motherboard != value && CheckCompatibility(value, _CPU)) { _Motherboard = value; } else { MessageBox.Show("Carte mère incompatible avec le CPU sélectionné"); } } } public CPU CPU { get{ return _CPU;} set { if (_CPU != value && CheckCompatibility(_Motherboard, value)) { _CPU = value; } else { MessageBox.Show("CPU incompatible avec la carte mère sélectionnée"); } } } public CurrentPC(int ID) { _ID = ID; _CPU = default(CPU); _Motherboard = default(Motherboard); } private bool CheckCompatibility(Motherboard motherboard, CPU cpu) { if (motherboard.Socket != eSocketType.None && cpu.Socket != eSocketType.None) return motherboard.Socket == cpu.Socket; else return true; } } |
Code: |
Code: |
= |
Sujets similaires |
|||||
Sujet | Auteur | Forum | Réponses | Posté le | |
---|---|---|---|---|---|
Ajout et remplacement pièces config actuelle | Poutz | L'atelier | 4 | 25 mars 2024 à 13:05 | |
Upgrade config 2016 d'un ami | Sphx | L'atelier | 26 | 19 mars 2024 à 11:49 | |
Évolution config ancienne - Conseils | bjc49 | L'atelier | 13 | 13 mars 2024 à 07:32 | |
[VDS] Config PC AMD Ryzen 9 5950X + RTX 3070ti FE + 64Gb RAM | Mybluesuedeshoe | Ventes | 4 | 01 mars 2024 à 13:03 | |
Réflexion future config | Darcier | L'atelier | 18 | 09 février 2024 à 14:09 |