mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Fixed VM disposal issues
This commit is contained in:
1 parent
5adc837673
commit
e783dcaa58
8 files changed
+17
-36
No files matched your search
@@ -13,7 +13,8 @@
|
||||
VerticalAlignment="Top"
|
||||
Source="/Assets/Images/home-banner.png"
|
||||
Height="200"
|
||||
Stretch="UniformToFill" />
|
||||
Stretch="UniformToFill"
|
||||
RenderOptions.BitmapInterpolationMode="HighQuality"/>
|
||||
|
||||
<!-- TODO: Replace with a shadow when available -->
|
||||
<TextBlock Grid.Row="0"
|
||||
|
||||
+7
-3
@@ -17,9 +17,13 @@ public partial class TreePropertyView : ReactiveUserControl<ITreePropertyViewMod
|
||||
InitializeComponent();
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
Observable.FromEventPattern<LayerPropertyEventArgs>(e => ViewModel!.BaseLayerProperty.CurrentValueSet += e, e => ViewModel!.BaseLayerProperty.CurrentValueSet -= e)
|
||||
.Subscribe(_ => this.BringIntoView())
|
||||
.DisposeWith(d);
|
||||
ITreePropertyViewModel? viewModel = ViewModel;
|
||||
if (viewModel != null)
|
||||
{
|
||||
Observable.FromEventPattern<LayerPropertyEventArgs>(e => viewModel.BaseLayerProperty.CurrentValueSet += e, e => viewModel.BaseLayerProperty.CurrentValueSet -= e)
|
||||
.Subscribe(_ => this.BringIntoView())
|
||||
.DisposeWith(d);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ internal class TreePropertyViewModel<T> : ActivatableViewModelBase, ITreePropert
|
||||
_profileEditorService.Time.Subscribe(t => _time = t).DisposeWith(d);
|
||||
_isCurrentlySelected = _profileEditorService.LayerProperty.Select(l => l == LayerProperty).ToProperty(this, vm => vm.IsCurrentlySelected).DisposeWith(d);
|
||||
_dataBindingEnabled = LayerProperty.BaseDataBinding.AsObservable().Select(b => b.IsEnabled).ToProperty(this, vm => vm.DataBindingEnabled).DisposeWith(d);
|
||||
|
||||
this.WhenAnyValue(vm => vm.LayerProperty.KeyframesEnabled).Subscribe(_ => this.RaisePropertyChanged(nameof(KeyframesEnabled))).DisposeWith(d);
|
||||
});
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace Artemis.UI.Screens.ProfileEditor;
|
||||
|
||||
public class ProfileEditorViewModel : MainScreenViewModel
|
||||
{
|
||||
private readonly IMainWindowService _mainWindowService;
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private readonly ISettingsService _settingsService;
|
||||
private readonly SourceList<IToolViewModel> _tools;
|
||||
@@ -51,7 +50,6 @@ public class ProfileEditorViewModel : MainScreenViewModel
|
||||
{
|
||||
_profileEditorService = profileEditorService;
|
||||
_settingsService = settingsService;
|
||||
_mainWindowService = mainWindowService;
|
||||
|
||||
_tools = new SourceList<IToolViewModel>();
|
||||
_tools.AddRange(toolViewModels);
|
||||
@@ -77,6 +75,8 @@ public class ProfileEditorViewModel : MainScreenViewModel
|
||||
{
|
||||
mainWindowService.MainWindowFocused -= MainWindowServiceOnMainWindowFocused;
|
||||
mainWindowService.MainWindowUnfocused -= MainWindowServiceOnMainWindowUnfocused;
|
||||
foreach (IToolViewModel toolViewModel in _tools.Items)
|
||||
toolViewModel.Dispose();
|
||||
}).DisposeWith(d);
|
||||
|
||||
// Slow and steady wins the race (and doesn't lock up the entire UI)
|
||||
|
||||
Reference in new issue
Block a user