Exemplo n.º 1
0
 private void dbImport_OnCompleteNativeThread(object sender, EventArgs e)
 {
     chkContinueOnError.Enabled = true;
     chkContinueOnError.Enabled = true;
     btnCancel.Enabled          = false;
     _dbImport = null;
     GC.Collect();
     AppendProgressInfo("Import completed");
     MessageBox.Show("Import complete!", "Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Exemplo n.º 2
0
        private void dbImport_OnErrorNativeThread(object sender, ErrorEventArgs e)
        {
            if (_dbImport != null)
            {
                if (_logViewForm == null || _logViewForm.IsDisposed)
                {
                    _logViewForm = new frmLogView();
                    _logViewForm.Show(this);
                }

                _logViewForm.AppendLogText(e.GetException().Message);

                btnCancel.Enabled          = false;
                chkContinueOnError.Enabled = true;
                _dbImport = null;
                GC.Collect();
                MessageBox.Show(e.GetException().Message);
            }
        }
Exemplo n.º 3
0
        private async void btnImport_Click(object sender, EventArgs e)
        {
            if (_dbImport != null && _dbImport.IsRunning)
            {
                MessageBox.Show("Import is already running!");
                return;
            }
            if (txtCSVDirectory.Text.Length == 0 || !Directory.Exists(txtCSVDirectory.Text))
            {
                MessageBox.Show("Invalid directory");
                return;
            }
            Properties.Settings.Default.ImportLocation = txtCSVDirectory.Text;
            Properties.Settings.Default.Save();
            try
            {
                _dbImport                  = new DatabaseImporter(updateProgress, UpdateProgressText);
                progressBar1.Value         = 0;
                btnCancel.Enabled          = true;
                chkContinueOnError.Enabled = false;
                _dbImport.OnError         += dbImport_OnError;
                _dbImport.OnComplete      += dbImport_OnComplete;
                ClearProgressInfo();
                txtProgressInfo.Text = "";

                if (rbCountry.Checked)
                {
                    UpdateProgressText("Starting import of GeoIp Country data");
                    await _dbImport.ImportGeoIPCountryDataAsync(txtCSVDirectory.Text, chkContinueOnError.Checked);
                }
                else if (rbCity.Checked)
                {
                    UpdateProgressText("Starting import of GeoIp City data");
                    await _dbImport.ImportGeoIPCityDataAsync(txtCSVDirectory.Text, chkContinueOnError.Checked);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }