async private void DoGenerateZip(object obj) { try { WorkInProgress = true; if (DeliveryBatch != null) { DeliveryInProgress = Visibility.Visible; var result = await RestHub.GenerateZIP(DeliveryBatch.Id, MaxZipSize * 1000 * 1000); if (result.HttpCode == System.Net.HttpStatusCode.OK) { ZipResultDTO zipResult = (ZipResultDTO)result.UserObject; ZipResult.ShowResult(zipResult); } else { AppErrorBox.ShowErrorMessage("Error While Generating ZIP . .", result.HttpResponse); } DeliveryInProgress = Visibility.Hidden; } else { MessageBox.Show("From Batch, From Category, Delivery Batch Number Is Required . . ."); } WorkInProgress = false; } catch (Exception ex) { Log.This(ex); } }
static public void ShowResult(ZipResultDTO zipResult) { try { if (thisInstance == null) { thisInstance = new ZipResult(); } thisInstance.result.Items.Clear(); thisInstance.TotalTans.Content = String.Empty; foreach (var tanNumber in zipResult.TanNumbers) { thisInstance.result.Items.Add(tanNumber); } thisInstance.TotalTans.Content = zipResult.TanNumbers.Count; thisInstance.ZipsPath.Content = zipResult.Path; thisInstance.TotalZips.Content = zipResult.Count; thisInstance.ShowDialog(); } catch (Exception ex) { Log.This(ex); } }