/// <summary>
 /// Initializes the data export.
 /// </summary>
 private void InitializeDataExport()
 {
     this.GenerateScripts.Enabled = true;
     this.hasErrors        = false;
     this.panel3.Visible   = true;
     this.panel3.Enabled   = true;
     this.LogPanel.Visible = false;
     //this.CancelBtn.Visible = false;
     this.RetrievingTables.Visible  = false;
     this.ViewLogBtn.Visible        = false;
     this.TimeTaken_Execute.Visible = false;
     queryToExecute = new Dictionary <string, StringBuilder>();
     totalSeconds   = 1;
     TablesListbox.Invoke((Action)(() => this.TablesListbox.Refresh()));
 }
        /// <summary>
        /// Handles the 1 event of the SelectAllTables_CheckedChanged control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void SelectAllTables_CheckedChanged_1(object sender, EventArgs e)
        {
            if (SelectAllTables.Checked)
            {
                for (int i = 0; i < TablesListbox.Items.Count; i++)
                {
                    TablesListbox.SetItemChecked(i, true);
                }
            }
            else
            {
                for (int i = 0; i < TablesListbox.Items.Count; i++)
                {
                    TablesListbox.SetItemChecked(i, false);
                }
            }

            this.SelectedLabel.Text = TablesListbox.CheckedItems.Count + " of " + tables_insert.Count + " selected";
        }
        /// <summary>
        /// Handles the Click event of the MatchBtn control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void MatchBtn_Click(object sender, EventArgs e)
        {
            if (MySQLTablesListBox != null && MySQLTablesListBox.Items != null && MySQLTablesListBox.Items.Count > 0)
            {
                for (int i = 0; i < TablesListbox.Items.Count; i++)
                {
                    TablesListbox.SetItemChecked(i, false);
                }

                var lob = (IList)this.Invoke(new Func <IList>(() => MySQLTablesListBox.Items.Cast <object>().ToList()));
                foreach (string item in lob)
                {
                    for (int i = 0; i < TablesListbox.Items.Count; i++)
                    {
                        if (TablesListbox.GetItemText(TablesListbox.Items[i]).Trim().ToLower() == item.Trim().ToLower())
                        {
                            TablesListbox.SetItemChecked(i, true);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Lists all tables.
        /// </summary>
        private void ListAllTables()
        {
            // MSSQL Tables
            if (tables_insert != null && tables_insert.Count > 0)
            {
                TablesListbox.Invoke((Action)(() => TablesListbox.Items.Clear()));
                foreach (string item in tables_insert.Keys)
                {
                    TablesListbox.Invoke((Action)(() => TablesListbox.Items.Add(item)));
                }
                this.SelectedLabel.Text = "0 of " + tables_insert.Count + " selected";
            }

            // MySQL Tables
            if (tables_mysql_db != null && tables_mysql_db.Count > 0)
            {
                MySQLTablesListBox.Invoke((Action)(() => this.MySQLTablesListBox.Items.Clear()));
                foreach (string item in tables_mysql_db)
                {
                    MySQLTablesListBox.Invoke((Action)(() => this.MySQLTablesListBox.Items.Add(item)));
                }
            }
        }