Пример #1
0
        internal static bool TestConnection(bool showSuccess, ArchAngel.Providers.EntityModel.UI.PropertyGrids.ucDatabaseInformation dbInfo)
        {
            Monitor.Enter(databaseLock);

            try
            {
                if (!dbInfo.ReadyToProceed())
                    return false;

                dbInfo.SetDatabaseOperationResults(new DatabaseOperationResults("Testing connection...", true));

                IDatabaseLoader loader = DatabasePresenter.CreateDatabaseLoader(dbInfo);

                try
                {
                    loader.TestConnection();
                    if (showSuccess)
                        dbInfo.SetDatabaseOperationResults(new DatabaseOperationResults("Connection Test", true));

                    return true;
                }
                catch (DatabaseLoaderException e)
                {
                    DatabaseOperationResults results = new DatabaseOperationResults("Connection Test", false, e.ActualMessage);

                    dbInfo.SetDatabaseOperationResults(results);

                    return false;
                }
            }
            finally
            {
                Monitor.Exit(databaseLock);
            }
        }
Пример #2
0
        private bool TestConnection(bool showSuccess)
        {
            Monitor.Enter(databaseLock);

            IDatabaseLoader loader = CreateDatabaseLoader(form);

            try
            {
                loader.TestConnection();
                if (showSuccess)
                    form.SetDatabaseOperationResults(new DatabaseOperationResults("Connection Test", true));

                return true;
            }
            catch (DatabaseLoaderException e)
            {
                DatabaseOperationResults results = new DatabaseOperationResults("Connection Test", false, e.ActualMessage);

                form.SetDatabaseOperationResults(results);

                return false;
            }
            finally
            {
                Monitor.Exit(databaseLock);
            }
        }
Пример #3
0
 public void SetDatabaseOperationResults(DatabaseOperationResults results)
 {
     ucDatabaseInformation1.SetDatabaseOperationResults(results);
 }
        public void SetDatabaseOperationResults(DatabaseOperationResults results)
        {
            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(() => SetDatabaseOperationResults(results)));
                return;
            }

            try
            {
                Utility.SuspendPainting(this);
                labelTestStatus.Text = "";

                if (!results.Succeeded)
                    MessageBox.Show(this, results.Message, results.OperationName + (results.Succeeded ? " Succeeded" : " Failed"), MessageBoxButtons.OK, results.Succeeded ? MessageBoxIcon.Information : MessageBoxIcon.Error);
                else
                {
                    //labelTestStatus.Text = results.OperationName + (results.Succeeded ? " Succeeded" : " Failed");
                    //labelTestStatus.ForeColor = results.Succeeded ? Color.Green : Color.Red;

                    if (string.IsNullOrEmpty(results.Message))
                    {
                        labelTestStatus.Text = results.OperationName;// "";
                        return;
                    }
                    labelTestStatus.Text = results.OperationName + " Succeeded";
                    labelTestStatus.ForeColor = Color.White;

                    //labelDatabaseOperationMessage.Text = results.Message;
                    //labelDatabaseOperationMessage.Visible = true;
                }
            }
            finally
            {
                Utility.ResumePainting(this);
            }
        }