private async void button3_Click(object sender, EventArgs e) { if (Source == "What you want to sync" || Dest == "Destination") { MessageBox.Show("Please select a valid path for both \"What you want to sync\" and \"Destination\"!", "NotValidPath", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Synchronize sh = new Synchronize(); Cursor = Cursors.WaitCursor; pictureBox2.Visible = true; SaveData(); await Task.Run(() => sh.SyncAllFiles(Source, Dest, Override)); Cursor = Cursors.Default; pictureBox2.Visible = false; MessageBox.Show("The directory is synchronized!", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); } }