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 | |
---|---|---|---|---|---|
[MaJ] Config 2017 | Makkintoch | L'atelier | 12 | 18 avril 2024 à 11:47 | |
Vente config rtx 3080ti 12go/ 11700k/ 32go / boitier rgb | kyp | Ventes | 1 | 13 avril 2024 à 21:34 | |
Estimation config complete | kyp | Estimations | 6 | 12 avril 2024 à 11:07 | |
Rafraichissement ancienne config | KefCry | L'atelier | 13 | 08 avril 2024 à 11:56 | |
Config autour d'un 5800x3D | lioun | L'atelier | 26 | 05 avril 2024 à 08:05 |