private void Display() { IGridList <View> gridList = piStatsGrid.Children; gridList.Clear(); int rowIndex = 0; if (_piSystem == null) { AddLabel($"Service {_monitorTopic.Name} is not available at {_monitorTopic.Server}.", gridList, rowIndex++, 0, 5); AbortRefresh(); return; } HttpResponse response = _piSystem.CpuClient.GetResponse(); if (!response.Success) { AddLabel($"Error getting data for {_monitorTopic.Name} at {_monitorTopic.Server}", gridList, rowIndex++, 0, 5); GridUtil.AddLabel(response.ErrorMessage, gridList, rowIndex++, 0, 5, 10, Color.Default, false, LayoutOptions.End); StopRefresh(); return; } _piSystem.MemoryClient.Get(); CpuData cpu = _piSystem.CpuClient.CpuData; MemoryData memory = _piSystem.MemoryClient.MemoryData; DisplayHeaderAndValueRow("Server Address", _monitorTopic.Server, gridList, rowIndex++, 3); DisplayHeaderAndValueRow("CPU Core Temperature", cpu.Temperature.ToString(), gridList, rowIndex++, 3); AddLabel("Usage", gridList, rowIndex, 1, 1); AddLabel("User", gridList, rowIndex, 2, 1); AddLabel("System", gridList, rowIndex, 3, 1); AddLabel("Idle", gridList, rowIndex, 4, 1); rowIndex++; DisplayCpuRow(_monitorTopic.Name, cpu, gridList, rowIndex++); if (cpu.Cores != null) { foreach (var data in cpu.Cores) { DisplayCpuRow(data.Key, data.Value, gridList, rowIndex++); } } DisplayHeaderAndValueRow("Total Memory (MB)", memory.Total.ToString(), gridList, rowIndex++, 2); DisplayMemoryRow("Used Memory (MB)", memory.Used, memory.Total, gridList, rowIndex++); DisplayMemoryRow("Cached Memory (MB)", memory.Cached, memory.Total, gridList, rowIndex++); DisplayMemoryRow("Free Memory (MB)", memory.Free, memory.Total, gridList, rowIndex++); DisplayMemoryRow("Available Memory (MB)", memory.Available, memory.Total, gridList, rowIndex++); if (_hygroThermoSensor != null) { string json = _hygroThermoSensor.Get(); DisplayHeaderAndValueRow("Humidity (%)", _hygroThermoSensor.HygroThermoData.Humidity.ToString(), gridList, rowIndex++, 2); DisplayHeaderAndValueRow("Temperature (C)", _hygroThermoSensor.HygroThermoData.Temperature.ToString(), gridList, rowIndex++, 2); } }
private void Display() { IGridList <View> gridList = dataGrid.Children; gridList.Clear(); int rowIndex = 0; DisplayHeaderAndValueRow("Device Name", _phoneService.DeviceInfo.Name, gridList, rowIndex++); string display = $"{_phoneService.DeviceInfo.Height:0.} x {_phoneService.DeviceInfo.Width:0.}"; DisplayHeaderAndValueRow("Display", display, gridList, rowIndex++); DisplayHeaderAndValueRow("Version", _phoneService.DeviceInfo.VersionString, gridList, rowIndex++); string hostName = Dns.GetHostName(); // Retrive the Name of HOST DisplayHeaderAndValueRow("Host Name", hostName, gridList, rowIndex++); // Get the IP var entry = Dns.GetHostEntry(hostName); string myIP = entry.AddressList[0].ToString(); DisplayHeaderAndValueRow("IP Address", myIP, gridList, rowIndex++); try { DisplayHeaderAndValueRow("Acceleration", ToText(_phoneService.Accelerometer.Acceleration.Value), gridList, rowIndex++); DisplayHeaderAndValueRow("Pressure", ToText(_phoneService.Barometer.Pressure.Value), gridList, rowIndex++); DisplayHeaderAndValueRow("Heading", ToText(_phoneService.Compass.Heading.Value), gridList, rowIndex++); DisplayHeaderAndValueRow("Angular Velocity", ToText(_phoneService.Gyroscope.AngularVelocity.Value), gridList, rowIndex++); DisplayHeaderAndValueRow("Magnetic Field", ToText(_phoneService.Magnetometer.MagneticField.Value), gridList, rowIndex++); DisplayHeaderAndValueRow("Orientation", ToText(_phoneService.OrientationSensor.Orientation.Value), gridList, rowIndex++); Location location = _phoneService.GpsLocation.Location.Value; DisplayHeaderAndValueRow("Latitude", location != null? ToTextLong(location.Latitude) : string.Empty, gridList, rowIndex++); DisplayHeaderAndValueRow("Longitude", location != null ? ToTextLong(location.Longitude) : string.Empty, gridList, rowIndex++); DisplayHeaderAndValueRow("Altitude", location != null ? ToText(location.Altitude) : string.Empty, gridList, rowIndex++); DisplayHeaderAndValueRow("Accuracy", location != null ? ToText(location.Accuracy) : string.Empty, gridList, rowIndex++); DisplayHeaderAndValueRow("Speed", location != null ? ToText(location.Speed) : string.Empty, gridList, rowIndex++); } catch (Exception err) { rowIndex++; DisplayHeaderAndValueRow("Exception", "Check for permissions", gridList, rowIndex++); } }
private void Display() { IGridList <View> gridList = dataGrid.Children; gridList.Clear(); int rowIndex = 0; if (_hs1xxClient == null) { AddLabel($"Smart Plug {_DeviceTopic.Name} is not available at {_DeviceTopic.Server}.", gridList, rowIndex++, 0, 2); _initialized = false; return; } HttpResponse response = _hs1xxClient.System.GetResponse(); if (!response.Success) { AddLabel($"Error getting data for {_DeviceTopic.Name} at {_DeviceTopic.Server}", gridList, rowIndex++, 0, 2); GridUtil.AddLabel(response.ErrorMessage, gridList, rowIndex++, 0, 2, 10, Color.Default, false, LayoutOptions.End); return; } string timeJson = _hs1xxClient.Time.Get(); KasaHs1xxSystemData systemData = _hs1xxClient.System.SystemData; KasaHs1xxTimeData timeData = _hs1xxClient.Time.TimeData; if (systemData.Relay_state == 0) { OnOffToolbarItem.Text = "On"; } else { OnOffToolbarItem.Text = "Off"; } if (systemData.Led_off == 0) { LedOffToolbarItem.Text = "LedOff"; } else { LedOffToolbarItem.Text = "LedOn"; } DisplayHeaderAndValueRow("IP Address", systemData.Ipaddress, gridList, rowIndex++); DisplayHeaderAndValueRow("Alias", systemData.Alias, gridList, rowIndex++); DisplayHeaderAndValueRow("Time", timeData.Time, gridList, rowIndex++); DisplayHeaderAndValueRow("Relay State", systemData.Relay_state == 1 ? "On" : "Off", gridList, rowIndex++); DisplayHeaderAndValueRow("On Time", SecondToString(systemData.On_time), gridList, rowIndex++); DisplayHeaderAndValueRow("LED Always Off", systemData.Led_off == 1 ? "True" : "False", gridList, rowIndex++); DisplayHeaderAndValueRow("Next Action", systemData.next_action.Action.ToString(), gridList, rowIndex++); DisplayHeaderAndValueRow("Next Action Time", SecondToString(systemData.next_action.schd_sec), gridList, rowIndex++); DisplayHeaderAndValueRow("Next Action Type", systemData.next_action.Type.ToString(), gridList, rowIndex++); DisplayHeaderAndValueRow("WIFI Signal", systemData.Rssi.ToString(), gridList, rowIndex++); DisplayHeaderAndValueRow("Active Mode", systemData.Active_mode, gridList, rowIndex++); DisplayHeaderAndValueRow("Device Name", systemData.Dev_name, gridList, rowIndex++); DisplayHeaderAndValueRow("Error Code", systemData.Err_code.ToString(), gridList, rowIndex++); DisplayHeaderAndValueRow("Feature", systemData.Feature, gridList, rowIndex++); DisplayHeaderAndValueRow("HW Version", systemData.hw_ver, gridList, rowIndex++); DisplayHeaderAndValueRow("Icon Hash", systemData.Icon_hash, gridList, rowIndex++); DisplayHeaderAndValueRow("Latitude", systemData.Latitude_i.ToString(), gridList, rowIndex++); DisplayHeaderAndValueRow("Longitude", systemData.Longitude_i.ToString(), gridList, rowIndex++); DisplayHeaderAndValueRow("Mac Address", systemData.Mac, gridList, rowIndex++); DisplayHeaderAndValueRow("NTC State", systemData.Ntc_state.ToString(), gridList, rowIndex++); DisplayHeaderAndValueRow("Software Version", systemData.Sw_ver, gridList, rowIndex++); DisplayHeaderAndValueRow("Status", systemData.Status, gridList, rowIndex++); DisplayHeaderAndValueRow("Updating", systemData.Updating.ToString(), gridList, rowIndex++); // display IDs - 1st row for label 2nd row for data AddLabel("Device ID", gridList, rowIndex++, 0); GridUtil.AddLabel(systemData.DeviceId, gridList, rowIndex++, 0, 2, 1, Color.Default, false, LayoutOptions.End); AddLabel("Hardware ID", gridList, rowIndex++, 0); GridUtil.AddLabel(systemData.HwId, gridList, rowIndex++, 0, 2, 1, Color.Default, false, LayoutOptions.End); AddLabel("OEM ID", gridList, rowIndex++, 0); GridUtil.AddLabel(systemData.OemId, gridList, rowIndex++, 0, 2, 1, Color.Default, false, LayoutOptions.End); AddLabel("Next Action ID", gridList, rowIndex++, 0); GridUtil.AddLabel(systemData.next_action.Id, gridList, rowIndex++, 0, 2, 1, Color.Default, false, LayoutOptions.End); }