PrintServer Construtores

Definição

Inicializa uma nova instância da PrintServer classe.

Sobrecargas

Name Description
PrintServer()

Inicializa uma nova instância da PrintServer classe.

PrintServer(PrintSystemDesiredAccess)

Inicializa uma nova instância da PrintServer classe que representa o servidor de impressão local e atribui-lhe o .PrintSystemDesiredAccess

PrintServer(String)

Inicializa uma nova instância da PrintServer classe que tem o caminho especificado.

PrintServer(String, PrintServerIndexedProperty[])

Inicializa uma nova instância da PrintServer classe usando o array especificado PrintServerIndexedProperty para determinar quais as propriedades que serão inicializadas.

PrintServer(String, PrintSystemDesiredAccess)

Inicializa uma nova instância da PrintServer classe que tem o caminho especificado e o acesso necessário.

PrintServer(String, String[])

Inicializa uma nova instância da PrintServer classe que tem o filtro de caminho e propriedades especificado.

PrintServer(String, PrintServerIndexedProperty[], PrintSystemDesiredAccess)

Inicializa uma nova instância da PrintServer classe e fornece o caminho especificado, o PrintServerIndexedProperty array e o acesso necessário.

PrintServer(String, String[], PrintSystemDesiredAccess)

Inicializa uma nova instância da PrintServer classe que tem o caminho especificado, o filtro de propriedades e o acesso necessário.

PrintServer()

Inicializa uma nova instância da PrintServer classe.

public:
 PrintServer();
public PrintServer();
Public Sub New ()

Aplica-se a

PrintServer(PrintSystemDesiredAccess)

Inicializa uma nova instância da PrintServer classe que representa o servidor de impressão local e atribui-lhe o .PrintSystemDesiredAccess

public:
 PrintServer(System::Printing::PrintSystemDesiredAccess desiredAccess);
public PrintServer(System.Printing.PrintSystemDesiredAccess desiredAccess);
new System.Printing.PrintServer : System.Printing.PrintSystemDesiredAccess -> System.Printing.PrintServer
Public Sub New (desiredAccess As PrintSystemDesiredAccess)

Parâmetros

desiredAccess
PrintSystemDesiredAccess

Um valor que especifica o tipo de acesso ao servidor de impressão que o seu programa precisa.

Exceções

desiredAccess é um valor que só pode ser aplicado a um PrintQueue objeto, não a um LocalPrintServer objeto. Por exemplo, UsePrinter.

Observações

O PrintServer será inicializado com as propriedades do servidor de impressão local, como Name.

Aplica-se a

PrintServer(String)

Inicializa uma nova instância da PrintServer classe que tem o caminho especificado.

public:
 PrintServer(System::String ^ path);
public PrintServer(string path);
new System.Printing.PrintServer : string -> System.Printing.PrintServer
Public Sub New (path As String)

Parâmetros

path
String

O nome e o percurso completo do servidor de impressão.

Exemplos

O exemplo seguinte mostra como usar este construtor para criar uma instância de PrintServer.


// Create a PrintServer
// "theServer" must be a print server to which the user has full print access.
PrintServer myPrintServer = new PrintServer(@"\\theServer");

// List the print server's queues
PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();
String printQueueNames = "My Print Queues:\n\n";
foreach (PrintQueue pq in myPrintQueues)
{
    printQueueNames += "\t" + pq.Name + "\n";
}
Console.WriteLine(printQueueNames);
Console.WriteLine("\nPress Return to continue.");
Console.ReadLine();

' Create a PrintServer
' "theServer" must be a print server to which the user has full print access.
Dim myPrintServer As New PrintServer("\\theServer")

' List the print server's queues
Dim myPrintQueues As PrintQueueCollection = myPrintServer.GetPrintQueues()
Dim printQueueNames As String = "My Print Queues:" & vbLf & vbLf
For Each pq As PrintQueue In myPrintQueues
    printQueueNames &= vbTab & pq.Name & vbLf
Next pq
Console.WriteLine(printQueueNames)
Console.WriteLine(vbLf & "Press Return to continue.")
Console.ReadLine()

Observações

Se path for , os null representarão o servidor de impressão local e serão inicializados com as suas propriedades, como PrintServerName.

Aplica-se a

PrintServer(String, PrintServerIndexedProperty[])

Inicializa uma nova instância da PrintServer classe usando o array especificado PrintServerIndexedProperty para determinar quais as propriedades que serão inicializadas.

public:
 PrintServer(System::String ^ path, cli::array <System::Printing::PrintServerIndexedProperty> ^ propertiesFilter);
public PrintServer(string path, System.Printing.PrintServerIndexedProperty[] propertiesFilter);
new System.Printing.PrintServer : string * System.Printing.PrintServerIndexedProperty[] -> System.Printing.PrintServer
Public Sub New (path As String, propertiesFilter As PrintServerIndexedProperty())

Parâmetros

path
String

O caminho completo e o nome do servidor de impressão.

propertiesFilter
PrintServerIndexedProperty[]

As propriedades que o construtor inicializa.

Observações

Se path for , os null representarão o servidor de impressão local e serão inicializados com as suas propriedades, como PrintServerName.

Aplica-se a

PrintServer(String, PrintSystemDesiredAccess)

Inicializa uma nova instância da PrintServer classe que tem o caminho especificado e o acesso necessário.

public:
 PrintServer(System::String ^ path, System::Printing::PrintSystemDesiredAccess desiredAccess);
public PrintServer(string path, System.Printing.PrintSystemDesiredAccess desiredAccess);
new System.Printing.PrintServer : string * System.Printing.PrintSystemDesiredAccess -> System.Printing.PrintServer
Public Sub New (path As String, desiredAccess As PrintSystemDesiredAccess)

Parâmetros

path
String

O nome e o percurso completo do servidor de impressão.

desiredAccess
PrintSystemDesiredAccess

Um valor que especifica o tipo de acesso ao servidor de impressão que o seu programa precisa.

Exceções

desiredAccess é um valor que só pode ser aplicado a um PrintQueue objeto, não a um LocalPrintServer objeto. Por exemplo, UsePrinter.

Exemplos

O exemplo seguinte mostra como usar este construtor para avaliar todas as impressoras quanto a possível estado de erro.

// Survey queue status for every queue on every print server
System::String^ line;
System::String^ statusReport = "\n\nAny problem states are indicated below:\n\n";
while ((line = fileOfPrintServers->ReadLine()) != nullptr)
{
   System::Printing::PrintServer^ myPS = gcnew System::Printing::PrintServer(line, PrintSystemDesiredAccess::AdministrateServer);
   System::Printing::PrintQueueCollection^ myPrintQueues = myPS->GetPrintQueues();
   statusReport = statusReport + "\n" + line;
   for each (System::Printing::PrintQueue^ pq in myPrintQueues)
   {
      pq->Refresh();
      statusReport = statusReport + "\n\t" + pq->Name + ":";
      if (useAttributesResponse == "y")
      {
         TroubleSpotter::SpotTroubleUsingQueueAttributes(statusReport, pq);
         // TroubleSpotter class is defined in the complete example.
      } else
      {
         TroubleSpotter::SpotTroubleUsingProperties(statusReport, pq);
      }
   }
}
fileOfPrintServers->Close();
Console::WriteLine(statusReport);
Console::WriteLine("\nPress Return to continue.");
Console::ReadLine();
// Survey queue status for every queue on every print server
String line;
String statusReport = "\n\nAny problem states are indicated below:\n\n";
while ((line = fileOfPrintServers.ReadLine()) != null)
 {
     PrintServer myPS = new PrintServer(line, PrintSystemDesiredAccess.AdministrateServer);
     PrintQueueCollection myPrintQueues = myPS.GetPrintQueues();
     statusReport = statusReport + "\n" + line;
     foreach (PrintQueue pq in myPrintQueues)
     {
         pq.Refresh();
         statusReport = statusReport + "\n\t" + pq.Name + ":";
         if (useAttributesResponse == "y")
         {
             TroubleSpotter.SpotTroubleUsingQueueAttributes(ref statusReport, pq);
             // TroubleSpotter class is defined in the complete example.
         }
         else
         {
             TroubleSpotter.SpotTroubleUsingProperties(ref statusReport, pq);
         }                 
     }// end for each print queue
 }// end while list of print servers is not yet exhausted

fileOfPrintServers.Close();
Console.WriteLine(statusReport);
Console.WriteLine("\nPress Return to continue.");
Console.ReadLine();
' Survey queue status for every queue on every print server
Dim line As String
Dim statusReport As String = vbLf & vbLf & "Any problem states are indicated below:" & vbLf & vbLf
line = fileOfPrintServers.ReadLine()
Do While line IsNot Nothing
     Dim myPS As New PrintServer(line, PrintSystemDesiredAccess.AdministrateServer)
     Dim myPrintQueues As PrintQueueCollection = myPS.GetPrintQueues()
     statusReport = statusReport & vbLf & line
     For Each pq As PrintQueue In myPrintQueues
         pq.Refresh()
         statusReport = statusReport & vbLf & vbTab & pq.Name & ":"
         If useAttributesResponse = "y" Then
             TroubleSpotter.SpotTroubleUsingQueueAttributes(statusReport, pq)
             ' TroubleSpotter class is defined in the complete example.
         Else
             TroubleSpotter.SpotTroubleUsingProperties(statusReport, pq)
         End If

     Next pq ' end for each print queue

    line = fileOfPrintServers.ReadLine()
Loop ' end while list of print servers is not yet exhausted

fileOfPrintServers.Close()
Console.WriteLine(statusReport)
Console.WriteLine(vbLf & "Press Return to continue.")
Console.ReadLine()

Observações

Se path for , os null representarão o servidor de impressão local e serão inicializados com as suas propriedades, como PrintServerName.

Aplica-se a

PrintServer(String, String[])

Inicializa uma nova instância da PrintServer classe que tem o filtro de caminho e propriedades especificado.

public:
 PrintServer(System::String ^ path, cli::array <System::String ^> ^ propertiesFilter);
public PrintServer(string path, string[] propertiesFilter);
new System.Printing.PrintServer : string * string[] -> System.Printing.PrintServer
Public Sub New (path As String, propertiesFilter As String())

Parâmetros

path
String

O nome e o percurso completo do servidor de impressão.

propertiesFilter
String[]

Um array dos nomes das propriedades que o construtor inicializa.

Observações

Se path for , os null representarão o servidor de impressão local e serão inicializados com as suas propriedades, como PrintServerName.

Aplica-se a

PrintServer(String, PrintServerIndexedProperty[], PrintSystemDesiredAccess)

Inicializa uma nova instância da PrintServer classe e fornece o caminho especificado, o PrintServerIndexedProperty array e o acesso necessário.

public:
 PrintServer(System::String ^ path, cli::array <System::Printing::PrintServerIndexedProperty> ^ propertiesFilter, System::Printing::PrintSystemDesiredAccess desiredAccess);
public PrintServer(string path, System.Printing.PrintServerIndexedProperty[] propertiesFilter, System.Printing.PrintSystemDesiredAccess desiredAccess);
new System.Printing.PrintServer : string * System.Printing.PrintServerIndexedProperty[] * System.Printing.PrintSystemDesiredAccess -> System.Printing.PrintServer
Public Sub New (path As String, propertiesFilter As PrintServerIndexedProperty(), desiredAccess As PrintSystemDesiredAccess)

Parâmetros

path
String

O caminho completo e o nome do servidor de impressão.

propertiesFilter
PrintServerIndexedProperty[]

As propriedades que o construtor inicializa.

desiredAccess
PrintSystemDesiredAccess

Um valor que especifica o tipo de acesso ao servidor de impressão que o seu programa precisa.

Exceções

desiredAccess é um valor que só pode ser aplicado a um PrintQueue objeto, não a um LocalPrintServer objeto. Por exemplo, UsePrinter.

Observações

Se path for , os null representarão o servidor de impressão local e serão inicializados com as suas propriedades, como PrintServerName.

Aplica-se a

PrintServer(String, String[], PrintSystemDesiredAccess)

Inicializa uma nova instância da PrintServer classe que tem o caminho especificado, o filtro de propriedades e o acesso necessário.

public:
 PrintServer(System::String ^ path, cli::array <System::String ^> ^ propertiesFilter, System::Printing::PrintSystemDesiredAccess desiredAccess);
public PrintServer(string path, string[] propertiesFilter, System.Printing.PrintSystemDesiredAccess desiredAccess);
new System.Printing.PrintServer : string * string[] * System.Printing.PrintSystemDesiredAccess -> System.Printing.PrintServer
Public Sub New (path As String, propertiesFilter As String(), desiredAccess As PrintSystemDesiredAccess)

Parâmetros

path
String

O nome e o percurso completo do servidor de impressão.

propertiesFilter
String[]

Um array dos nomes das propriedades que o construtor inicializa.

desiredAccess
PrintSystemDesiredAccess

Um valor que especifica o tipo de acesso ao servidor de impressão que o seu programa precisa.

Exceções

desiredAccess é um valor que só pode ser aplicado a um PrintQueue objeto, não a um LocalPrintServer objeto. Por exemplo, UsePrinter.

Observações

Se path for , os null representarão o servidor de impressão local e serão inicializados com as suas propriedades, como PrintServerName.

Aplica-se a