Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        public async void RefreshDeliveryJobQueue()
        {
            try
            {
                deliveryJobQueue = await DeliveryJobProcessor.GetDeliveryJobs();
            }
            catch
            {
                //MessageBox.Show("Unable to connect to Internet.");
            }

            TableLayoutHelper.ClearTable(tableLayoutDeliveryQueue);

            populateDeliveryQueue(deliveryJobQueue);
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        public async void RefreshPrintJobQueue(Queue <PrintJobModel> printJobQueue)
        {
            //PrintJobQueue = GetPrintJobs();

            // TODO: Remove this server call and use formal parameter
            printJobQueue = await PrintJobProcessor.LoadPrintJobs();

            //int topPrintJobId = printJobQueue.Last().Id;
            string stringPrintJobQueue = printJobQueueToString(printJobQueue);

            if (!string.Equals(StringPrintJobQueue, stringPrintJobQueue))
            {
                StringPrintJobQueue = stringPrintJobQueue;

                // Only show this message in Manual operation
                if (PrintJobProcessor.PausePrint && PrintJobProcessor.showMessageBox)
                {
                    MessageBox.Show("We have a new Print Job");
                }
                PrintJobProcessor.showMessageBox = true;
                TableLayoutHelper.ClearTable(tableLayoutPrintQueue);
                populatePrintQueue(printJobQueue);
            }
        }