public void TransferComplete(TransferStatus status) { if (progress != null) { progress.Hide(); progress.Close(); progress = null; } switch (status) { case TransferStatus.BAD_USER1: MessageBox.Show(this, "Please choose a valid profile from which to copy settings."); break; case TransferStatus.BAD_USER2: if (_domain) { MessageBox.Show(this, "The domain account that you entered cannot be found. " + "Make sure you are connected to the proper domain and try again."); } else { MessageBox.Show(this, "Please choose a valid local account to copy settings to."); } break; case TransferStatus.SRC_IS_DEST: MessageBox.Show(this, "The source and destination profiles cannot be the same."); break; case TransferStatus.PROFILE_EXISTS: MessageBox.Show(this, "The destination account already has a profile. Please check the option to overwrite the destination profile and try again." + " (Note that the existing profile will NOT be deleted - only made inactive.)"); break; case TransferStatus.FAILED_OTHER: MessageBox.Show(this, "Profile transfer failed. Make sure that you're running this program as an administrator."); break; case TransferStatus.NO_PROFILE: MessageBox.Show(this, "The source user does not have a valid user profile. Please try again."); break; case TransferStatus.COMPLETE: MessageBox.Show(this, "Profile successfully transfered."); init(); break; } }
private void executeButton_Click(object sender, RoutedEventArgs e) { String SrcName = Profile.SelectedItem as String; String DestName = null; if (_domain) { DestName = domain.Text + "\\" + uname.Text; } else { DestName = DestAcct.SelectedItem as String; } TransferStatus status = ProfileTransfer.CheckAccounts(SrcName, DestName); if (status != TransferStatus.COMPLETE) { TransferComplete(status); return; } MessageBoxResult result = MessageBox.Show(this, "The profile belonging to " + SrcName + " will be transfered to " + DestName + ". Are you sure you want to continue?", "Confirm", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { progress = new Window2(); progress.Owner = this; progress.Show(); ProfileTransfer.TransferWithCallback(SrcName, DestName, TransferComplete, _replace.IsChecked.GetValueOrDefault(), _deleteProfile.IsChecked.GetValueOrDefault(), ".", _deleteAcct.IsChecked.GetValueOrDefault()); } }