async private void DoGenerateXML(object obj) { try { WorkInProgress = true; if (DeliveryBatch != null) { DeliveryInProgress = Visibility.Visible; var result = await RestHub.GenerateXML(DeliveryBatch.Id); if (result.HttpCode == System.Net.HttpStatusCode.OK) { var dto = result.UserObject as GenerateXMLDTO; if (dto.IsSuccess) { GenerateXMLSuccessBox.ShowStatus(dto.OutXmlPath); } } else { AppErrorBox.ShowErrorMessage(result.StatusMessage, result.HttpResponse); } DeliveryInProgress = Visibility.Hidden; } else { MessageBox.Show("From Batch, From Category, Delivery Batch Number Is Required . . ."); } } catch (Exception ex) { Log.This(ex); AppErrorBox.ShowErrorMessage("Can't Generate XML", ex.ToString()); } finally { WorkInProgress = false; } }