private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { disposedValue = true; if (disposing) { _subscriber.Unregister(this); _store?.Dispose(); _store = null; } } }
public SnippetService( ISnippetStore dataStore, IMessenger messenger, CsScriptRunService csScriptRunService, PyScriptRunService pyScriptRunService, IDispatcherHelper dispatcher, ISubscriber subscriber, string myName) { _store = dataStore; _messenger = messenger; _csScriptRunService = csScriptRunService; _pyScriptRunService = pyScriptRunService; _dispatcher = dispatcher; _subscriber = subscriber; _myName = myName; subscriber.Register <SnippetCreated>(Handle); subscriber.Register <SnippetUpdated>(Handle); subscriber.Register <SnippetDeleted>(Handle); }