Exemplo n.º 1
0
        public void RefreshList()
        {
            string Lib = IBMi.CurrentSystem.GetValue("printerLib"), Obj = IBMi.CurrentSystem.GetValue("printerObj");

            Thread spoolThread = new Thread((ThreadStart) delegate
            {
                ListViewItem curItem;
                List <ListViewItem> Items = new List <ListViewItem>();
                SpoolFile[] Listing       = IBMiUtils.GetSpoolListing(Lib, Obj);

                if (Listing != null)
                {
                    foreach (SpoolFile Spool in Listing)
                    {
                        curItem     = new ListViewItem(new[] { Spool.getName(), Spool.getData(), Spool.getStatus(), Spool.getJob() }, 0);
                        curItem.Tag = Spool;
                        Items.Add(curItem);
                    }
                }
                else
                {
                    Items.Add(new ListViewItem("No spool files found."));
                }

                if (spoolList != null)
                {
                    this.Invoke((MethodInvoker) delegate
                    {
                        spoolList.Items.Clear();
                        spoolList.Items.AddRange(Items.ToArray());
                    });
                }
            });

            if (Lib == "" || Obj == "")
            {
                MessageBox.Show("You must setup the Output Queue in the Connection Settings for the spool file listing to work.", "Spool Listing", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                spoolThread.Start();
            }
        }