From 7fa0f47c311ae47cf7ab83a5f366b051612c3664 Mon Sep 17 00:00:00 2001 From: Yuki Matsuzawa Date: Wed, 13 Nov 2024 14:15:00 +0900 Subject: [PATCH] Update DatasetModel.Method property --- src/MSDIAL5/MsdialGuiApp/Model/Core/DatasetModel.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/MSDIAL5/MsdialGuiApp/Model/Core/DatasetModel.cs b/src/MSDIAL5/MsdialGuiApp/Model/Core/DatasetModel.cs index 05aa8da71..84d68ef95 100644 --- a/src/MSDIAL5/MsdialGuiApp/Model/Core/DatasetModel.cs +++ b/src/MSDIAL5/MsdialGuiApp/Model/Core/DatasetModel.cs @@ -13,10 +13,10 @@ using Reactive.Bindings.Notifiers; using System; using System.IO; +using System.Reactive.Disposables; using System.Threading; using System.Threading.Tasks; using System.Windows; -using CompMs.Common.Extension; namespace CompMs.App.Msdial.Model.Core { @@ -26,6 +26,7 @@ internal sealed class DatasetModel : DisposableModelBase, IDatasetModel private readonly AnalysisFileBeanModelCollection _analysisFileBeanModelCollection; private readonly IMessageBroker _broker; private readonly FilePropertiesModel _projectBaseParameter; + private readonly SerialDisposable _methodDisposable; public DatasetModel(IMsdialDataStorage storage, IMessageBroker broker) : this(storage, new AnalysisFileBeanModelCollection(storage.AnalysisFiles), broker) { @@ -44,14 +45,14 @@ public DatasetModel(IMsdialDataStorage storage, AnalysisFileBeanM allProcessMethodSettingModel = new MethodSettingModel(ProcessOption.All, files, _alignmentFileBeanModelCollection, storage, HandlerAsync, _projectBaseParameter, StudyContext, broker); identificationProcessMethodSettingModel = new MethodSettingModel(ProcessOption.IdentificationPlusAlignment, files, _alignmentFileBeanModelCollection, storage, HandlerAsync, _projectBaseParameter, StudyContext, broker); alignmentProcessMethodSettingModel = new MethodSettingModel(ProcessOption.Alignment, files, _alignmentFileBeanModelCollection, storage, HandlerAsync, _projectBaseParameter, StudyContext, broker); + _methodDisposable = new SerialDisposable().AddTo(Disposables); } public IMethodModel? Method { get => method; private set { - var prev = method; if (SetProperty(ref method, value)) { - prev?.Dispose(); + _methodDisposable.Disposable = method; } } }