public void LoadTerminalInfo() { try { XElement root = XElement.Parse(client.GetTerminalInfo()); TerminalInfo terminalInfo = new TerminalInfo() { OsName = root.Element("osName").Value, OsType = root.Element("osType").Value, OsVersion = root.Element("osVersion").Value, ProductKey = root.Element("productKey").Value, InstallDate = root.Element("installDate").Value, LastBootUpTime = root.Element("lastBootUpTime").Value, ProcessorName = root.Element("processorName").Value, ProcessorId = root.Element("processorId").Value, ProcessorCount = Convert.ToInt32(root.Element("processorCount").Value), CpuTotalUsage = root.Element("cpuTotalUsage").Value, TotalMemory = root.Element("totalMemory").Value, AvailableMemory = root.Element("availableMemory").Value, MemoryCount = Convert.ToInt32(root.Element("memoryCount").Value), VisibleMemory = root.Element("visibleMemory").Value, DiskSize = root.Element("diskSize").Value, DriveCount = Convert.ToInt32(root.Element("driveCount").Value), AvailableSize = root.Element("availableSize").Value, Ipv4 = root.Element("ipv4").Value, Ipv6 = root.Element("ipv6").Value, Mac = root.Element("mac").Value, ByteReceived = root.Element("byteReceived").Value, ByteSent = root.Element("byteSent").Value, }; this.Dispatcher.Invoke(new Action(() => uiTerminalInfoGrid.DataContext = terminalInfo)); } catch (Exception) { } }
private void btnGetTerminalInfo_Click(object sender, EventArgs e) { textBox1.Text = client.GetTerminalInfo(); }