protected override void DisposeHook() { NanoleafPlugin.getControllers().ForEach(c => c.PanelAdded -= PanelAdded); NanoleafPlugin.getControllers().ForEach(c => c.PanelRemoved -= PanelRemoved); NanoleafPlugin.ControllerAdded -= NanoleafPlugin_ControllerAdded; base.DisposeHook(); }
private void setInstance() { this._instance = NanoleafPlugin.getAllPanels(this.deviceType).FirstOrDefault(p => p.ID.Equals(this.panelId)); NanoleafPlugin.getControllers().ForEach(c => c.PanelAdded -= PanelAdded); NanoleafPlugin.getControllers().ForEach(c => c.PanelRemoved -= PanelRemoved); if (this._instance == null) { NanoleafPlugin.getControllers().ForEach(c => c.PanelAdded += PanelAdded); } else { NanoleafPlugin.getControllers().ForEach(c => c.PanelRemoved += PanelRemoved); } }