private void OnManifoldEvent(ManifoldEvent manifoldEvent) { switch (manifoldEvent.type) { case ManifoldEvent.EType.SensorPropertyAdded: break; case ManifoldEvent.EType.SensorPropertyRemoved: break; case ManifoldEvent.EType.SensorPropertySwapped: break; case ManifoldEvent.EType.Invalidated: Invalidate(); break; case ManifoldEvent.EType.SecondarySensorAdded: goto case ManifoldEvent.EType.Invalidated; case ManifoldEvent.EType.SecondarySensorRemoved: goto case ManifoldEvent.EType.Invalidated; default: Log.E(this, "Cannot handle manifold event: " + manifoldEvent.type); break; } }
// Overridden from AbstractSensorProperty protected override void OnManifoldEvent(ManifoldEvent e) { base.OnManifoldEvent(e); switch (e.type) { case ManifoldEvent.EType.SecondarySensorAdded: { if (sensor.linkedSensor != null && !isRegisteredToSecondary) { //sensor.linkedSensor.onSensorStateChangedEvent += SensorChangeEvent; sensor.linkedSensor.onSensorEvent += SensorChangeEvent; } break; } case ManifoldEvent.EType.SecondarySensorRemoved: { if (sensor.linkedSensor != null && isRegisteredToSecondary) { //sensor.linkedSensor.onSensorStateChangedEvent -= SensorChangeEvent; sensor.linkedSensor.onSensorEvent -= SensorChangeEvent; } break; } // Manifold.EType.SecondarySensorRemove } }
private void OnManifoldEvent(ManifoldEvent e) { switch (e.type) { case ManifoldEvent.EType.SensorPropertyAdded: { var aifm = AdapterIndexForManifold(e.manifold); NotifyItemChanged(aifm); var mr = records[aifm] as ManifoldRecord; if (mr.manifold.sensorPropertyCount == 1) { mr.isExpanded = true; } if (mr.isExpanded) { var i = aifm + e.index + 1; var record = CreateSensorPropertyRecord(e.manifold, e.manifold[e.index]); records.Insert(i, record); NotifyItemInserted(i); if (mr.manifold.sensorPropertyCount > 1) { NotifyItemChanged(aifm + mr.manifold.sensorPropertyCount); } else { NotifyItemChanged(aifm - 1); } } } break; // ManifoldEvent.EType.SensorPropertyAdded case ManifoldEvent.EType.SensorPropertyRemoved: { var aifm = AdapterIndexForManifold(e.manifold); NotifyItemChanged(aifm); var i = aifm + e.index + 1; records.RemoveAt(i); NotifyItemRemoved(i); if (e.manifold.sensorPropertyCount > 1) { NotifyItemChanged(aifm + e.manifold.sensorPropertyCount); } else { NotifyItemChanged(aifm - 1); } } break; // ManifoldEvent.EType.SensorPropertyRemoved case ManifoldEvent.EType.SensorPropertySwapped: { var m = e.manifold; var mi = AdapterIndexForManifold(m) + 1; var i1 = mi + e.index; var i2 = mi + e.otherIndex; SwapRecords(i1, i2); } break; // ManifoldEvent.EType.SensorPropertySwapped } }
public void ManifoldEventListener(ManifoldEvent e) { switch (e.type) { case ManifoldEvent.EType.Invalidated: case ManifoldEvent.EType.SecondarySensorAdded: case ManifoldEvent.EType.SecondarySensorRemoved: OnSensorChanged(); break; } }
private void OnManifoldEvent(ManifoldEvent e) { switch (e.type) { case ManifoldEvent.EType.Invalidated: Invalidate(); break; case ManifoldEvent.EType.SensorPropertyAdded: case ManifoldEvent.EType.SensorPropertyRemoved: break; } }
protected virtual void OnManifoldEvent(ManifoldEvent manifoldEvent) { switch (manifoldEvent.type) { case ManifoldEvent.EType.SensorPropertyAdded: { InvalidateAssociation(); break; } // ManifoldEvent.EType.SensorPropertyAdded case ManifoldEvent.EType.SensorPropertyRemoved: { InvalidateAssociation(); break; } // ManifoldEvent.EType.SensorPropertyAdded case ManifoldEvent.EType.SensorPropertySwapped: { InvalidateAssociation(); break; } // ManifoldEvent.EType.SensorPropertySwapped } }
/// <summary> /// Called when a manifold event is thrown. /// </summary> /// <param name="me">Me.</param> private void OnManifoldEvent(ManifoldEvent me) { switch (me.type) { case ManifoldEvent.EType.SecondarySensorAdded: goto case ManifoldEvent.EType.Invalidated; case ManifoldEvent.EType.SecondarySensorRemoved: goto case ManifoldEvent.EType.Invalidated; case ManifoldEvent.EType.Invalidated: RefreshRecords(); break; case ManifoldEvent.EType.SensorPropertyAdded: records.Add(CreateSensorPropertyRecord(manifold, manifold[me.index])); NotifyItemRangeInserted(me.index, 1); break; case ManifoldEvent.EType.SensorPropertyRemoved: records.RemoveAt(me.index); NotifyItemRemoved(me.index); break; case ManifoldEvent.EType.SensorPropertySwapped: var i1 = me.index; var i2 = me.otherIndex; SwapRecords(i1, i2); var vh1 = recyclerView.FindViewHolderForAdapterPosition(i1) as SensorPropertyViewHolder; var vh2 = recyclerView.FindViewHolderForAdapterPosition(i2) as SensorPropertyViewHolder; vh1.Invalidate(); vh2.Invalidate(); break; case ManifoldEvent.EType.SensorPropertyCleared: records.Clear(); NotifyDataSetChanged(); break; } }
public void manifoldUpdating(ManifoldEvent Event) { //if (record.manifold.secondarySensor != null) { if (record.sensor.linkedSensor != null) { //labelMeasurement.Text = record.manifold.secondarySensor.measurement.amount.ToString("N") + " " + record.manifold.secondarySensor.unit; labelMeasurement.Text = record.sensor.linkedSensor.measurement.amount.ToString("N") + " " + record.sensor.linkedSensor.unit; //if (record.manifold.secondarySensor.type == ESensorType.Temperature){ if (record.sensor.linkedSensor.type == ESensorType.Temperature) { labelTitle.Text = "TEMP"; } else { labelTitle.Text = "PRESS"; } } else { labelMeasurement.Text = "Not Linked"; labelTitle.Text = "Linked"; } }
protected virtual void OnManifoldEvent(ManifoldEvent e) { }
/// <summary> /// The delegate that is called when the property's manifold changes. /// </summary> /// <param name="manifold">Manifold.</param> private void OnManifoldEvent(ManifoldEvent me) { NotifyChanged(); }