public InfoForm() { InitializeComponent(); cvList = new ComponentValueList(); cn = new ComponentValue(); //0 id cv = new ComponentValue(); //1 id }
private void btLoad_Click(object sender, EventArgs e) { var dialog = new OpenFileDialog(); dialog.Filter = "XML files|*.xml"; if (dialog.ShowDialog() == DialogResult.OK) { XmlSerializer formatter = new XmlSerializer(typeof(ComponentValue)); try { using (var file = new FileStream(dialog.FileName, FileMode.Open, FileAccess.Read)) { cv.Clear(); cv = (ComponentValue)formatter.Deserialize(file); MyMessageBox.ShowMessage("Information loaded successfully!", "Information", MessageBoxButtons.OK); UpdateList(); } } catch { MyMessageBox.ShowMessage("Information were not loaded \rsuccessfully! Please upload \ra file called \"Information\"", "Error!", MessageBoxButtons.OK); } } }
public void Add(ComponentValue cn, ComponentValue cv) { cvList[cn.CPU_Name] = cv.CPU_Name; cvList[cn.CPU_NCores] = cv.CPU_NCores; cvList[cn.CPU_NThreads] = cv.CPU_NThreads; cvList[cn.CPU_Architecture] = cv.CPU_Architecture; cvList[cn.CPU_Clock] = cv.CPU_Clock; cvList[cn.CPU_Socket] = cv.CPU_Socket; cvList[cn.CPU_Description] = cv.CPU_Description; cvList[cn.CPU_Manufacturer] = cv.CPU_Manufacturer; cvList[cn.RAM_BankLabel] = cv.RAM_BankLabel; cvList[cn.RAM_Capacity] = cv.RAM_Capacity; cvList[cn.RAM_Clock] = cv.RAM_Clock; cvList[cn.MOBO_Caption] = cv.MOBO_Caption; cvList[cn.MOBO_Name] = cv.MOBO_Name; cvList[cn.MOBO_Manufacturer] = cv.MOBO_Manufacturer; cvList[cn.GPU_Name] = cv.GPU_Name; cvList[cn.GPU_Model] = cv.GPU_Model; cvList[cn.GPU_Capacity] = cv.GPU_Capacity; cvList[cn.OS_Caption] = cv.OS_Caption; cvList[cn.OS_Location] = cv.OS_Location; cvList[cn.OS_BuildNumber] = cv.OS_BuildNumber; cvList[cn.OS_Version] = cv.OS_Version; cvList[cn.OS_FPM] = cv.OS_FPM; cvList[cn.OS_FVM] = cv.OS_FVM; cvList[cn.OS_SerialNumber] = cv.OS_SerialNumber; cvList[cn.OS_SystemDrive] = cv.OS_SystemDrive; }