/// <summary> /// Called on a device manager event. /// </summary> /// <param name="e">E.</param> private void OnDeviceManagerEvent(DeviceManagerEvent e) { if (DeviceManagerEvent.EType.DeviceEvent == e.type) { OnDeviceEvent(e.deviceEvent); } }
/// <summary> /// The callback used by the device manager when its state changes. /// </summary> /// <param name="dm">Dm.</param> private void OnDeviceManagerEvent(DeviceManagerEvent e) { if (ion.deviceManager.connectionHelper.isEnabled) { UpdateScanState(); } }
/// <summary> /// Method to raise a device manager event for logging, etc. /// </summary> /// <param name="name"></param> /// <param name="info"></param> private void RaiseDeviceManagerEvent(string name, string info) { var newDMArgs = new StateMachineEventArgs(name, $"Device manager event: {info}", StateMachineEventType.System, "Device Manager"); // Raise only, if subscribed DeviceManagerEvent?.Invoke(this, newDMArgs); }
private void OnDeviceManagerEvent(DeviceManagerEvent e) { switch (e.type) { case DeviceManagerEvent.EType.DeviceEvent: OnDeviceEvent(e.deviceEvent); break; } }
/// <summary> /// Called when a device manager throws an event. /// </summary> /// <param name="dm">Dm.</param> /// <param name="dme">Dme.</param> private void OnDeviceManagerEvent(DeviceManagerEvent dme) { if (DeviceManagerEvent.EType.DeviceEvent == dme.type) { if (DeviceEvent.EType.ConnectionChange == dme.deviceEvent.type) { context.UpdateNotification(); } } }
private void OnDeviceManagerEvent(DeviceManagerEvent dme) { if (dme != null && dme.type == DeviceManagerEvent.EType.ScanStarted) { if (updatingGrid == false) { updatingGrid = true; connectedSensors.Clear(); disconnectedSensors.Clear(); foreach (var device in ion.deviceManager.devices) { var holder = device as GaugeDevice; if (holder.connection.connectionState == Core.Connections.EConnectionState.Connected || holder.connection.connectionState == Core.Connections.EConnectionState.Broadcasting) { foreach (var sensor in holder.sensors) { connectedSensors.Add(sensor); } } else { if (holder.isNearby == true) { foreach (var sensor in holder.sensors) { if (!connectedSensors.Contains(sensor)) { connectedSensors.Add(sensor); } } } else { foreach (var sensor in holder.sensors) { disconnectedSensors.Add(sensor); } } } } connectedSensors.Sort(new GeneralSensorSorter()); disconnectedSensors.Sort(new GeneralSensorSorter()); spaceSensors(); } } }
/// <summary> /// The callback used by the device manager when its state changes. /// </summary> /// <param name="dm">Dm.</param> private void OnDeviceManagerEvent(DeviceManagerEvent e) { switch (e.type) { case DeviceManagerEvent.EType.ScanStarted: // Fallthrough case DeviceManagerEvent.EType.ScanStopped: { UpdateScanState(); break; } default: { break; } } if (ion.deviceManager.connectionManager.isEnabled) { UpdateScanState(); } }
/// <summary> /// The callback used by the device manager when its state changes. /// </summary> /// <param name="dm">Dm.</param> private void OnDeviceManagerEvent(DeviceManagerEvent e) { if (ion.deviceManager.connectionManager.isEnabled) { } }
/// <summary> /// Resolves any needed device manager events. /// </summary> /// <param name="de">De.</param> private void OnDeviceManagerEvent(DeviceManagerEvent de) { lock (this) { if (DeviceManagerEvent.EType.DeviceEvent == de.type) { var eventType = de.deviceEvent.type; if (DeviceEvent.EType.ConnectionChange != eventType && DeviceEvent.EType.Deleted != eventType && DeviceEvent.EType.Found != eventType) { return; } var device = de.deviceEvent.device; var state = device.GetDeviceState(); var section = allSections[state]; if (deviceToSection.ContainsKey(device)) { var oldSection = deviceToSection[device]; if (oldSection != section) { int recordIndex = -1; int numberRemoved = -1; if (oldSection.RemoveDevice(device, out recordIndex, out numberRemoved) && shownSections.Contains(oldSection)) { if (oldSection.devices.Count <= 0) { var index = shownSections.IndexOf(oldSection); shownSections.Remove(oldSection); AnimateSectionRemoval(index); } else { AnimateRemoveDevice(NSIndexPath.FromRowSection(recordIndex, shownSections.IndexOf(oldSection)), numberRemoved); } } } } if (!section.HasDevice(device)) { var sectionIndex = -1; if (!shownSections.Contains(section)) { shownSections.Add(section); shownSections.Sort(new SectionSorter()); sectionIndex = shownSections.IndexOf(section); AnimateSectionAdd(sectionIndex); } else { sectionIndex = shownSections.IndexOf(section); } int index = -1; if (section.AddDevice(device, out index)) { AnimateAddDevice(NSIndexPath.FromRowSection(index, sectionIndex)); } deviceToSection[device] = section; if (EDeviceState.Connected == state) { DoExpand(NSIndexPath.FromRowSection(index, shownSections.IndexOf(section))); } } Invalidate(); } } }