PrintQueueStatus returns None, printer is already

2019-07-19 04:07发布

问题:

I already turned off the printer, and my code still returns None

Here is my code

try


 {
printServer.Refresh();
        PrintQueue printQueue = new PrintQueue(printServer, cmbPrinters.Text.Trim());
printQueue.Refresh();
        if (printQueue.QueueStatus == PrintQueueStatus.Offline)
        {
            MessageBox.Show("Offline");
        }
        else if (printQueue.QueueStatus == PrintQueueStatus.None)
        {
            MessageBox.Show("None");
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }

I am expecting that it should return offline because I turned it off.

How can I fix this issue? Anyone? Any suggestions or advice will be a big help.

Thanks!