private void FillHardware() { List <string> view = new List <string>(); ComputerInformation ci = new ComputerInformation(); ci.ScanFromCpuZ(); currentComputer.AddHardware(ci.GetCpu()); currentComputer.AddHardware(ci.GetMotherboard()); foreach (Hardware h in ci.GetGpus()) { currentComputer.AddHardware(h); } foreach (Hardware h in ci.GetRams()) { currentComputer.AddHardware(h); } foreach (Hardware h in ci.GetHdds()) { currentComputer.AddHardware(h); } //currentComputer.AddHardware(new Hardware() //{ // Model = currentComputer.Hardwares[2].Model, // Memory = currentComputer.Hardwares[2].Memory, // Type = currentComputer.Hardwares[2].Type //}); }
private void BtnSend_Click(object sender, EventArgs e) { try { ComputerInformation ci = new ComputerInformation(); Pgs.SendReport(ci.GetOs(), chosenComputerName, reporttype, selectedItem, selectedEquipementType, tbFio.Text, rtbComment.Text); var result = MessageBox.Show("Заявка успешно отправлена! Желаете сохранить ее в виде текстового файла?", "Успех", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { SaveFileDialog sv = new SaveFileDialog(); sv.FileName = "result"; sv.Filter = "Тексовый файл|*.txt"; result = sv.ShowDialog(); if (result == DialogResult.OK) { System.IO.StreamWriter sw = new System.IO.StreamWriter(sv.FileName, false); sw.WriteLine("ФИО: " + tbFio.Text); sw.WriteLine("Компьютер: " + chosenComputerName); sw.WriteLine("Тип заявки: " + reporttype.ToString()); sw.WriteLine("Комментарий:" + rtbComment.Text); sw.Close(); MessageBox.Show("Успешно сохранено.", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); } } if (onReportFinished != null) { onReportFinished(); } } catch (Exception ex) { MessageBox.Show("Ошибка отправки заявки: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CreateComputer() { ComputerInformation nw = new ComputerInformation(); currentComputer._MAC = nw.GetMACAddress(); currentComputer._Name = nw.GetName(); currentComputer._Ip = nw.GetIp(); currentComputer._Os = nw.GetOs(); }
private void FillSoftware() { ComputerInformation ci = new ComputerInformation(); List <Software> soft = ci.GetSoftwareCollection(); foreach (Software s in soft) { currentComputer.AddSoftware(s); } }