/// <summary> /// Called immediately after construction when our factory installs the Interface property, not /// executed at run time (Profile Editor only) /// </summary> protected override void OnInterfaceChanged(HeliosInterface oldInterface, HeliosInterface newInterface) { base.OnInterfaceChanged(oldInterface, newInterface); if (newInterface is MonitorSetup monitorSetupInterface) { _model = new MonitorSetupViewModel(monitorSetupInterface); DataContext = _model; } else { // deinit; provoke crash on attempt to use Dispose(); } }
private void Dispose() { _model?.Dispose(); _model = null; DataContext = null; }