Esempio n. 1
0
 protected void LoadBackend()
 {
     if (backend == null)
     {
         backend = OnCreateBackend();
         if (backend == null)
         {
             throw new InvalidOperationException("No backend found for widget: " + GetType());
         }
         backend.Initialize(this);
         OnBackendCreated();
     }
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
 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 ();
     }
 }