public void Update(DeviceInformationWrapper wrapper, string name, Specialization specialization, string icon) { NUpdates++; uiNameBlock.Text = name; if (specialization == null) { uiIconBlock.Text = icon; if (NUpdates == 1) { // Make it smaller and less appealing, but only the first time. uiIconBlock.FontSize = uiIconBlock.FontSize * 0.7; } // BluetoothLE and Bluetooth -- replace the useless bits about the device type string description = "??--??"; if (wrapper.di != null) { description = wrapper.di.Id.Replace("BluetoothLE#BluetoothLEbc:83:85:22:5a:70-", "Address:"); description = description.Replace("Bluetooth#Bluetoothbc:83:85:22:5a:70-", "Address:"); description = description.Replace(":00000000:{00001101-0000-1000-8000-00805f9b34fb}", ""); } else if (wrapper.BleAdvert != null) { var ble = wrapper.BleAdvert.BleAdvert; var addr = BluetoothAddress.AsString(ble.BluetoothAddress); var timestamp = ble.Timestamp.ToString("T"); description = $"{addr} RSS {ble.RawSignalStrengthInDBm} at {timestamp}"; } uiDescriptionBlock.Text = description; } else { uiIconBlock.Text = specialization.Icon; if (string.IsNullOrEmpty(specialization.ShortDescription)) { ; } uiDescriptionBlock.Text = specialization.ShortDescription; uiNameBlock.FontWeight = FontWeights.Bold; ToolTipService.SetToolTip(uiNameBlock, specialization.Description); ToolTipService.SetToolTip(uiIconBlock, specialization.Description); ToolTipService.SetToolTip(uiDescriptionBlock, specialization.Description); } }
public DeviceMenuEntryControl(DeviceInformationWrapper wrapper, string name, Specialization specialization, string icon) { this.InitializeComponent(); Wrapper = wrapper; Update(wrapper, name, specialization, icon); }