private void button1_Click(object sender, System.EventArgs e) { //Console.WriteLine((ProgramUtils.HasAdministratorRights()) ? "True" : "False"); if (this.listboxSource.Items.Count == this.listBoxDestination.Items.Count && (this.listboxSource.Items.Count > 0 && this.listBoxDestination.Items.Count > 0)) { // Create a new Task to run the complete migration behind and to dont freeze the UI. Task.Run(() => MigrationUtils.Proceed(ConvertData())); // When we are done we can empty the listboxes //this.listboxSource.Items.Clear(); //this.listBoxDestination.Items.Clear(); } else { // Display Error Message to user. MessageBox.Show("Sie haben entweder Source/Destination Ordner nicht ausgewählt.", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } }