private void savePC_Click(object sender, EventArgs e) { Computer cmp = new Computer(); cmp.type = typePC.Text; foreach(CPU val in listCPU) if(Convert.ToString(typeCPU.SelectedItem) == val.model) cmp.cpu = val; foreach (VideoCard val in listGPU) if (Convert.ToString(typeGPU.SelectedItem) == val.model) cmp.videoCard = val; cmp.capacityRAM = capacityRAM.Value; cmp.typeRAM = typeRAM.Text; cmp.capacityROM = capacityROM.Value; cmp.typeROM = typeROM.Text; XmlSerializeWrapper.Serialize(cmp, "PC.xml"); }
private void сToolStripMenuItem_Click(object sender, EventArgs e) { CPU cpu = new CPU(); cpu.maker = "AMD"; cpu.series = "KH"; cpu.model = "Miner"; cpu.amountCore = 4; cpu.typeCPU = "Fast"; cpu.frequency = 1400; cpu.hyperThreading = true; cpu.bit = "x64"; cpu.cacheSizeL1 = 3; cpu.cacheSizeL2 = 4; cpu.cacheSizeL3 = 12; listCPU.Add(cpu); VideoCard gpu = new VideoCard(); gpu.maker = "NVIDIA"; gpu.series = "FG"; gpu.model = "View"; gpu.frequency = 1200; gpu.directX = true; gpu.capacityMemory = 512; listGPU.Add(gpu); Computer cmp = new Computer(id++); cmp.type = "Профессиональный"; cmp.cpu = cpu; cmp.videoCard = gpu; cmp.capacityRAM = 1024; cmp.typeRAM = "DDR3"; cmp.capacityROM = 2048; cmp.typeROM = "SSD"; listPC.Add(cmp); XmlSerializeWrapper.Serialize(listPC, "PC.xml"); PCListView.Clear(); fillListView(); }
private void changeButton_Click(object sender, EventArgs e) { CPU cpu = new CPU(); if (Intel.Checked) cpu.maker = Intel.Text; else cpu.maker = AMD.Text; cpu.series = seriesCPU.Text; cpu.model = modelCPU.Text; cpu.amountCore = Convert.ToInt32(coresCPU.Text); cpu.typeCPU = typesCPU.Text; cpu.frequency = Convert.ToInt32(frequencyCPU.Text); if (hyperThreadCPUTrue.Checked) cpu.hyperThreading = true; else cpu.hyperThreading = false; cpu.bit = bitCPU.Text; cpu.cacheSizeL1 = Convert.ToInt32(cacheL1.Text); cpu.cacheSizeL2 = Convert.ToInt32(cacheL2.Text); cpu.cacheSizeL3 = Convert.ToInt32(cacheL3.Text); VideoCard gpu = new VideoCard(); gpu.maker = makerGPU.Text; gpu.series = seriesGPU.Text; gpu.model = modelGPU.Text; gpu.frequency = Convert.ToInt32(frequencyGPU.Text); if (directxGPUTrue.Checked) gpu.directX = true; else gpu.directX = false; gpu.capacityMemory = Convert.ToInt32(capacityGPU.Text); Computer cmp = new Computer(); cmp.type = typePC.Text; cmp.cpu = cpu; cmp.videoCard = gpu; cmp.capacityRAM = capacityRAM.Value; cmp.typeRAM = typeRAM.Text; cmp.capacityROM = capacityROM.Value; cmp.typeROM = typeROM.Text; list[id] = cmp; XmlSerializeWrapper.Serialize(list, "PC.xml"); main.fillListView(); }