private void chkDeclaration_Checked(object sender, RoutedEventArgs e) { try { if (CPerformDrop.IsBusy || CDeclaration.IsBusy) { if (CPerformDrop.IsBusy) { MessageBox.ShowBox("MessageID368", BMC_Icon.Information); chkDeclaration.IsChecked = false; } e.Handled = false; return; } chkDeclaration.IsEnabled = false; pnlDropContent.Children.Clear(); CDeclaration declaration = new CDeclaration(); pnlDropContent.Children.Add(declaration); declaration.Margin = new Thickness(0); } finally { if (!CPerformDrop.IsBusy) { chkDeclaration.IsEnabled = true; chkDeclaration.IsChecked = true; } else { chkDeclaration.IsEnabled = false; chkDeclaration.IsChecked = false; } } }