private async void manualPrintFile(object sender, EventArgs e) { Button button = sender as Button; DataDelivered data = (DataDelivered)button.Tag; var progressIndicator = new Progress <Queue <PrintJobModel> >(RefreshPrintJobQueue); try { // TODO: Check if Application is running in manual mode // if in manual mode: // print selected file // update printjobstatus // update tablelayout // else: // Switch to Manual mode // follow the steps for manual mode // switch to automatic mode if (PrintJobProcessor.PausePrint) { Task.Factory.StartNew(() => PrintJobProcessor.PrintOneFile(data.Job, progressIndicator), TaskCreationOptions.LongRunning); } TableLayoutHelper.RemoveArbitraryRow(tableLayoutPrintQueue, data.RowIndex); } catch (WebException ex) { Debug.WriteLine(ex.Message); } }
private async void cancelDelivery(object sender, EventArgs e) { Button button = sender as Button; DataDelivered data = (DataDelivered)button.Tag; try { await DeliveryJobProcessor.CancelDelivery(data.Job); TableLayoutHelper.RemoveArbitraryRow(tableLayoutDeliveryQueue, data.RowIndex); } catch (WebException ex) { Debug.WriteLine(ex.Message); } }