protected void LoadBackend() { if (backend == null) { backend = OnCreateBackend(); if (backend == null) { throw new InvalidOperationException("No backend found for widget: " + GetType()); } backend.Initialize(this); OnBackendCreated(); } }
private bool RetryBackend() { try { if (backend != null && !backend.Configured) { backend.Cleanup(); backend.Initialize(preferences); } } catch (Exception e) { Logger.Error("{0}", e.Message); } if (backend == null || !backend.Configured) { return(true); } else { return(false); } }
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; } }
protected void LoadBackend() { if (usingCustomBackend) { usingCustomBackend = false; backend.Initialize (this); OnBackendCreated (); } else if (backend == null) { backend = OnCreateBackend (); if (backend == null) throw new InvalidOperationException ("No backend found for widget: " + GetType ()); backend.Initialize (this); OnBackendCreated (); } }