예제 #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();
     }
 }
예제 #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);
     }
 }
예제 #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;
            }
        }
예제 #4
0
파일: XwtComponent.cs 프로젝트: chkn/xwt
 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 ();
     }
 }