示例#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 ();
     }
 }