private void UpdateLabels() { var device = record.device; imageDeviceIcon.Image = DeviceUtil.GetUIImageFromDeviceModel(device.serialNumber.deviceModel); labelDeviceType.Text = device.serialNumber.deviceModel.GetTypeString(); labelDeviceName.Text = device.name; }
public void UpdateFromGaugeSensor(GaugeDeviceSensor sensor) { if (viewSensor == null) { return; } var device = ((GaugeDeviceSensor)viewSensor)?.device; var state = device.connection.connectionState; labelHeader.Text = device.serialNumber.deviceModel.GetTypeString() + ": " + viewSensor.name; imageSensorIcon.Image = DeviceUtil.GetUIImageFromDeviceModel(device.serialNumber.deviceModel); labelMeasurement.Text = sensor.ToFormattedString(); labelUnit.Text = sensor.unit.ToString(); activityConnectStatus.Hidden = EConnectionState.Resolving != sensor.device.connection.connectionState; buttonConnection.Hidden = false; UpdateAlarm(sensor); if (device.isConnected) { UpdateBatteryIcon(device.battery); buttonConnection.SetImage(UIImage.FromBundle("ic_bluetooth_connected"), UIControlState.Normal); buttonConnection.BackgroundColor = UIColor.Green; labelMeasurement.TextColor = new UIColor(Colors.BLACK); labelUnit.TextColor = new UIColor(Colors.BLACK); labelConnectionStatus.Text = "Connected"; labelConnectionStatus.TextColor = UIColor.Green; } else { if (EConnectionState.Broadcasting == device.connection.connectionState) { UpdateBatteryIcon(device.battery); labelConnectionStatus.Text = "Long Range Mode"; labelConnectionStatus.TextColor = UIColor.Blue; } else { labelConnectionStatus.Text = "Disconnected"; labelConnectionStatus.TextColor = UIColor.Red; UpdateBatteryIcon(-1); } buttonConnection.SetImage(UIImage.FromBundle("ic_bluetooth_disconnected"), UIControlState.Normal); buttonConnection.BackgroundColor = UIColor.Red; labelMeasurement.TextColor = new UIColor(Colors.LIGHT_GRAY); labelUnit.TextColor = new UIColor(Colors.LIGHT_GRAY); } }
public void setLHUI() { if (currentSensor != null) { LabelTop.Text = currentSensor.name; LabelMiddle.Text = SensorUtils.ToFormattedString(currentSensor.measurement); LabelBottom.Text = currentSensor.measurement.unit.ToString() + " "; LabelSubview.Text = " " + LabelTop.Text + Util.Strings.Analyzer.LHTABLE; if (currentSensor.device.isConnected) { Connection.Image = UIImage.FromBundle("ic_bluetooth_connected"); connectionColor.BackgroundColor = UIColor.Green; LabelMiddle.Font = UIFont.FromName("DroidSans-Bold", 42f); } else { Connection.Image = UIImage.FromBundle("ic_bluetooth_disconnected"); connectionColor.BackgroundColor = UIColor.Red; LabelMiddle.Font = UIFont.FromName("DroidSans", 20f); } DeviceImage.Image = DeviceUtil.GetUIImageFromDeviceModel(currentSensor.device.serialNumber.deviceModel); Connection.Hidden = false; connectionColor.Hidden = false; } else if (manualSensor != null) { LabelTop.Text = manualSensor.name; LabelMiddle.Text = SensorUtils.ToFormattedString(manualSensor.measurement); LabelBottom.Text = manualSensor.measurement.unit.ToString() + " "; LabelSubview.Text = " " + LabelTop.Text + Util.Strings.Analyzer.LHTABLE; DeviceImage.Image = UIImage.FromBundle("ic_edit"); Connection.Hidden = true; connectionColor.Hidden = true; } LabelTop.Hidden = false; DeviceImage.Hidden = false; LabelMiddle.Hidden = false; LabelBottom.Hidden = false; LabelSubview.Hidden = false; subviewHide.Hidden = false; subviewTable.Hidden = false; headingDivider.Hidden = false; LabelMiddle.Font = UIFont.FromName("DroidSans-Bold", 42f); }
public void setUI(ManualSensor lowManual, ManualSensor highManual) { pLowHigh.SetTitle(Util.Strings.Analyzer.UNSPECIFIED, UIControlState.Normal); pLowHigh.BackgroundColor = UIColor.White; pLowHigh.SetTitleColor(UIColor.Black, UIControlState.Normal); if (currentSensor == null) { pdeviceName.Text = currentSensor.name; pdeviceImage.Image = UIImage.FromBundle("ic_edit"); pconnectionStatus.Text = ""; pconnection.Image = null; pconnection.Hidden = true; pbatteryImage.Image = null; connectionColor.Hidden = true; conDisButton.Hidden = true; if (lowManual != null && manualSensor != null && lowManual == manualSensor) { pLowHigh.SetTitle(Util.Strings.Analyzer.LOWSIDE, UIControlState.Normal); pLowHigh.BackgroundColor = UIColor.Blue; pLowHigh.Layer.CornerRadius = 6f; pLowHigh.SetTitleColor(UIColor.White, UIControlState.Normal); } else if (highManual != null && manualSensor != null && highManual == manualSensor) { pLowHigh.SetTitle(Util.Strings.Analyzer.HIGHSIDE, UIControlState.Normal); pLowHigh.BackgroundColor = UIColor.Red; pLowHigh.Layer.CornerRadius = 6f; pLowHigh.SetTitleColor(UIColor.White, UIControlState.Normal); } if (manualSensor.unit != Units.Vacuum.MICRON) { pgaugeValue.Text = manualSensor.measurement.amount.ToString("N"); } else { pgaugeValue.Text = manualSensor.measurement.amount.ToString(); } pvalueType.Text = manualSensor.unit.ToString(); } else { pdeviceName.Text = currentSensor.name; if (currentSensor.device.isConnected) { pconnection.Image = UIImage.FromBundle("ic_bluetooth_connected"); connectionColor.BackgroundColor = UIColor.Green; pconnectionStatus.Text = ""; if (currentSensor.device.battery > 75) { pbatteryImage.Image = UIImage.FromBundle("img_battery_100"); } else if (currentSensor.device.battery > 50) { pbatteryImage.Image = UIImage.FromBundle("img_battery_75"); } else if (currentSensor.device.battery > 25) { pbatteryImage.Image = UIImage.FromBundle("img_battery_50"); } else if (currentSensor.device.battery > 0) { pbatteryImage.Image = UIImage.FromBundle("img_battery_25"); } else { pbatteryImage.Image = UIImage.FromBundle("img_battery_0"); } } else { pconnection.Image = UIImage.FromBundle("ic_bluetooth_disconnected"); pconnectionStatus.Text = Util.Strings.Device.DISCONNECTED; pconnectionStatus.TextColor = UIColor.Red; connectionColor.BackgroundColor = UIColor.Red; } if (currentSensor.unit != Units.Vacuum.MICRON) { pgaugeValue.Text = currentSensor.measurement.amount.ToString("N"); } else { pgaugeValue.Text = currentSensor.measurement.amount.ToString(); } pvalueType.Text = currentSensor.unit.ToString(); pconnection.Hidden = false; connectionColor.Hidden = false; conDisButton.Hidden = false; pdeviceImage.Image = DeviceUtil.GetUIImageFromDeviceModel(currentSensor.device.serialNumber.deviceModel); if (AppState.context.currentAnalyzer.lowSideSensor != null && AppState.context.currentAnalyzer.lowSideSensor == currentSensor) { pLowHigh.SetTitle(Util.Strings.Analyzer.LOWSIDE, UIControlState.Normal); pLowHigh.SetTitleColor(UIColor.White, UIControlState.Normal); pLowHigh.BackgroundColor = UIColor.Blue; } else if (AppState.context.currentAnalyzer.highSideSensor != null && AppState.context.currentAnalyzer.highSideSensor == currentSensor) { pLowHigh.SetTitle(Util.Strings.Analyzer.HIGHSIDE, UIControlState.Normal); pLowHigh.SetTitleColor(UIColor.White, UIControlState.Normal); pLowHigh.BackgroundColor = UIColor.Red; } aView.Hidden = false; } }