Esempio n. 1
0
 protected override void PerformTask()
 {
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         this._database.Connect();
     }
     catch (System.Exception exception)
     {
         this._database = null;
         this._exception = exception;
     }
     finally
     {
         Cursor.Current = Cursors.Default;
         if ((this._database != null) && base.IsCanceled)
         {
             AccessDatabase database = this._database;
             this._database = null;
             try
             {
                 database.Disconnect();
             }
             catch
             {
             }
         }
         base.PostResults(this._connectType, 100, true);
     }
 }
Esempio n. 2
0
 public ConnectionTask(AccessConnectionSettings connectionSettings, Microsoft.Matrix.Packages.DBAdmin.UserInterface.Access.AccessDatabaseLoginForm.ConnectType connectType)
 {
     this._connectType = connectType;
     this._database = new AccessDatabase(connectionSettings);
 }
Esempio n. 3
0
 private void OnAsyncConnectCompleted(object sender, AsyncTaskResultPostedEventArgs e)
 {
     this.Connecting = false;
     ConnectType data = (ConnectType) e.Data;
     ConnectionTask task = sender as ConnectionTask;
     if (((task != this._connectionTask) || task.IsCanceled) && (task.Database != null))
     {
         try
         {
             task.Database.Disconnect();
         }
         catch
         {
         }
     }
     else if (task.Database == null)
     {
         this.ReportError(task.Exception, "Unable to connect to the database.");
     }
     else
     {
         switch (data)
         {
             case ConnectType.ConnectButton:
             {
                 this.ConnectionSettings.Filename = this._filenameEdit.Text;
                 AccessDatabase database = new AccessDatabase(this.ConnectionSettings);
                 try
                 {
                     database.Connect();
                     base.DialogResult = DialogResult.OK;
                     base.Close();
                     return;
                 }
                 catch (Exception exception)
                 {
                     this.ReportError(exception.Message, "Unable to connect to the database.");
                 }
                 finally
                 {
                     database.Disconnect();
                 }
                 break;
             }
         }
         task.Database.Disconnect();
     }
 }
Esempio n. 4
0
 public AccessDatabaseProject(IProjectFactory factory, IServiceProvider serviceProvider, AccessDatabase database)
     : base(factory, serviceProvider, database)
 {
     this._accessDatabase = database;
     this._rootItem = new AccessDatabaseProjectItem(this);
 }
Esempio n. 5
0
 Project IProjectFactory.CreateProject(object creationArgs)
 {
     AccessDatabase database = null;
     if (creationArgs != null)
     {
         AccessConnectionSettings connectionSettings = creationArgs as AccessConnectionSettings;
         if (connectionSettings == null)
         {
             throw new ArgumentException("Invalid creationArgs");
         }
         database = new AccessDatabase(connectionSettings);
         return this.CreateProject(database);
     }
     IUIService service = (IUIService) this._serviceProvider.GetService(typeof(IUIService));
     if (service != null)
     {
         if (!AccessHelper.IsAdoxPresent())
         {
             AccessHelper.PromptInstallAdox(this._serviceProvider);
             return null;
         }
         AccessDatabaseLoginForm form = new AccessDatabaseLoginForm(this._serviceProvider);
         if (service.ShowDialog(form) == DialogResult.OK)
         {
             database = new AccessDatabase(form.ConnectionSettings);
             return this.CreateProject(database);
         }
     }
     return null;
 }
Esempio n. 6
0
 public AccessTableCollection(AccessDatabase database)
     : base(database)
 {
     this.PopulateCollection();
 }