private void btnOK_Click(object sender, EventArgs e) { var driveLetter = string.IsNullOrEmpty(cmbDriveLetter.Text) ? "" : cmbDriveLetter.Text + "\\"; using (var frm = new ServiceWaitForm("Changing drive letter", delegate() { var res = PipeClient.ChangeDriveLetter(this.Volume.VolumeName, driveLetter); if (res.IsError) { throw new InvalidOperationException(res.Message); } })) { frm.ShowDialog(this); } }