private void Disconnect()
 {
     indexDataProvider            = null;
     viewModels                   = null;
     boundViewModels              = null;
     IndexDataGridView.DataSource = null;
     UpdateCaption();
 }
Example #2
0
 private void FixBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         int i     = 0;
         int total = Actions.Count();
         foreach (var action in Actions)
         {
             if (FixBackgroundWorker.CancellationPending)
             {
                 e.Cancel = true;
                 return;
             }
             if (action.HasSql())
             {
                 i++;
             }
             else
             {
                 total--;
             }
             var progressPercent = i * 100 / total;
             FixBackgroundWorker.ReportProgress(progressPercent, action.GetStatus());
             try
             {
                 IndexDataProvider.ExecuteAction(action, cancellationTokenSource);
             }
             catch (AggregateException ex)
             {
                 foreach (var ex2 in ex.InnerExceptions)
                 {
                     ReportException(progressPercent, ex2);
                 }
             }
             catch (Exception ex)
             {
                 ReportException(progressPercent, ex);
             }
             FixBackgroundWorker.ReportProgress(progressPercent);
         }
     }
     catch (Exception ex)
     {
         FixBackgroundWorker.ReportProgress(0, "ERROR: " + ex.Message);
         ErrorsOccurred = true;
     }
 }
        private void DataConnectionDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            var dlg = sender as DataConnectionDialog;

            if (dlg.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    indexDataProvider = new IndexDataProvider(dlg.ConnectionString);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, "Connect", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    e.Cancel = true;
                }
            }
        }
 private void Disconnect()
 {
     indexDataProvider = null;
     viewModels = null;
     boundViewModels = null;
     IndexDataGridView.DataSource = null;
     UpdateCaption();
 }
 private void DataConnectionDialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     var dlg = sender as DataConnectionDialog;
     if (dlg.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         try
         {
             indexDataProvider = new IndexDataProvider(dlg.ConnectionString);
         }
         catch (Exception ex)
         {
             MessageBox.Show(this, ex.Message, "Connect", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             e.Cancel = true;
         }
     }
 }