public void RemoveInterface(InterfaceStatus interfaceStatus) { // clean up interfaceStatus.Subscription?.Unsubscribe(this); InterfaceStatuses.Remove(interfaceStatus); interfaceStatus.Dispose(); }
public void Reload(HeliosProfile profile) { if (_profile != null) { // disconnect _profile.Interfaces.CollectionChanged -= Profile_InterfacesChanged; _profile = null; } // signal all interfaces removed so that any running view models / editors can refresh InterfaceStatuses?.Clear(); if (profile == null) { // empty status is correct return; } // add back new interface status objects for new profile foreach (HeliosInterface heliosInterface in profile.Interfaces) { AddInterfaceIfSupported(heliosInterface); } PerformChecks(); profile.Interfaces.CollectionChanged += Profile_InterfacesChanged; _profile = profile; }
private void AddInterfaceIfSupported(HeliosInterface heliosInterface) { if (InterfaceStatus.TryManage(heliosInterface, out InterfaceStatus interfaceStatus)) { InterfaceStatuses.Add(interfaceStatus); interfaceStatus.Subscription?.Subscribe(this); } }