private void ResetBackend(Exception ex) { try { if (m_backend != null) { m_backend.Dispose(); } } catch (Exception dex) { Logging.Log.WriteWarningMessage(LOGTAG, "BackendDisposeError", dex, "Failed to dispose backend instance: {0}", ex.Message); } m_backend = null; }
private void Dispose(bool disposing) { if (!_disposed) { _disposed = true; if (disposing) { if (_threadPool != null) { _threadPool.Dispose(); } } } }
void InitializeBackend() { var node = availableBackendNodes.Single ( n => n.Id == currentBackend); Logger.Info ("Using backend: {0} ({1})", node.Data.Name, currentBackend); backend = (IBackend)node.CreateInstance (); backend.NeedsConfiguration += delegate { if (BackendConfigurationRequested != null) BackendConfigurationRequested (this, EventArgs.Empty); }; backend.Initialized += delegate { // load data taskLists.LoadTaskLists (backend); if (BackendInitialized != null) BackendInitialized (this, EventArgs.Empty); }; try { backend.Initialize (preferences); } catch (Exception ex) { backend.Dispose (); backend = null; throw ex; } }
public void ReInitializeBackend() { ThrowIfDisposed (); if (currentBackend == null) return; if (backend != null) { Logger.Debug ("Cleaning up backend: {0}", backend.GetType ()); backend.Disposed += delegate { backend = null; InitializeBackend (); }; backend.Dispose (); taskLists.UnloadTaskLists (); } else InitializeBackend (); }
public void Dispose() { K.Dispose(this); }