PrintServer Конструкторы

Определение

Инициализирует новый экземпляр класса PrintServer.

Перегрузки

PrintServer()

Инициализирует новый экземпляр класса PrintServer.

PrintServer(PrintSystemDesiredAccess)

Инициализирует новый экземпляр класса PrintServer, который представляет локальный сервер печати и назначает ему указанный тип доступа PrintSystemDesiredAccess.

PrintServer(String)

Инициализирует новый экземпляр класса PrintServer, для которого задан путь.

PrintServer(String, PrintServerIndexedProperty[])

Инициализирует новый экземпляр класса PrintServer, используя указанный массив PrintServerIndexedProperty для определения инициализируемых свойств.

PrintServer(String, PrintSystemDesiredAccess)

Инициализирует новый экземпляр класса PrintServer, для которого задан путь и необходимый тип доступа.

PrintServer(String, String[])

Инициализирует новый экземпляр класса PrintServer, для которого задан путь и фильтр свойств.

PrintServer(String, PrintServerIndexedProperty[], PrintSystemDesiredAccess)

Инициализирует новый экземпляр класса PrintServer и предоставляет заданный путь, массив PrintServerIndexedProperty и необходимый тип доступа.

PrintServer(String, String[], PrintSystemDesiredAccess)

Инициализирует новый экземпляр класса PrintServer, для которого задан путь, фильтр свойств и необходимый тип доступа.

PrintServer()

Инициализирует новый экземпляр класса PrintServer.

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

Применяется к

PrintServer(PrintSystemDesiredAccess)

Инициализирует новый экземпляр класса PrintServer, который представляет локальный сервер печати и назначает ему указанный тип доступа 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)

Параметры

desiredAccess
PrintSystemDesiredAccess

Значение, указывающее тип доступа к серверу печати, необходимый программе.

Исключения

Значение desiredAccess можно применить только к объекту PrintQueue, а не LocalPrintServer. Например, UsePrinter.

Комментарии

Будет PrintServer инициализирован с помощью свойств локального сервера печати, таких как Name.

Применяется к

PrintServer(String)

Инициализирует новый экземпляр класса PrintServer, для которого задан путь.

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

Параметры

path
String

Имя сервера печати и полный путь к нему.

Примеры

В следующем примере показано, как использовать этот конструктор для создания экземпляра 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()

Комментарии

Если path имеет значение null, PrintServer будет представлять локальный сервер печати и будет инициализирован с его свойствами, такими как Name.

Применяется к

PrintServer(String, PrintServerIndexedProperty[])

Инициализирует новый экземпляр класса PrintServer, используя указанный массив PrintServerIndexedProperty для определения инициализируемых свойств.

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())

Параметры

path
String

Полный путь и имя сервера печати.

propertiesFilter
PrintServerIndexedProperty[]

Свойства, инициализируемые конструктором.

Комментарии

Если path имеет значение null, PrintServer будет представлять локальный сервер печати и будет инициализирован с его свойствами, такими как Name.

Применяется к

PrintServer(String, PrintSystemDesiredAccess)

Инициализирует новый экземпляр класса PrintServer, для которого задан путь и необходимый тип доступа.

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)

Параметры

path
String

Имя сервера печати и полный путь к нему.

desiredAccess
PrintSystemDesiredAccess

Значение, указывающее тип доступа к серверу печати, необходимый программе.

Исключения

Значение desiredAccess можно применить только к объекту PrintQueue, а не LocalPrintServer. Например, UsePrinter.

Примеры

В следующем примере показано, как использовать этот конструктор для опроса всех принтеров на наличие возможного состояния ошибки.

// 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()

Комментарии

Если path имеет значение null, PrintServer будет представлять локальный сервер печати и будет инициализирован с его свойствами, такими как Name.

Применяется к

PrintServer(String, String[])

Инициализирует новый экземпляр класса PrintServer, для которого задан путь и фильтр свойств.

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())

Параметры

path
String

Имя сервера печати и полный путь к нему.

propertiesFilter
String[]

Массив имен свойств, инициализируемых конструктором.

Комментарии

Если path имеет значение null, PrintServer будет представлять локальный сервер печати и будет инициализирован с его свойствами, такими как Name.

Применяется к

PrintServer(String, PrintServerIndexedProperty[], PrintSystemDesiredAccess)

Инициализирует новый экземпляр класса PrintServer и предоставляет заданный путь, массив PrintServerIndexedProperty и необходимый тип доступа.

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)

Параметры

path
String

Полный путь и имя сервера печати.

propertiesFilter
PrintServerIndexedProperty[]

Свойства, инициализируемые конструктором.

desiredAccess
PrintSystemDesiredAccess

Значение, указывающее тип доступа к серверу печати, необходимый программе.

Исключения

Значение desiredAccess можно применить только к объекту PrintQueue, а не LocalPrintServer. Например, UsePrinter.

Комментарии

Если path имеет значение null, PrintServer будет представлять локальный сервер печати и будет инициализирован с его свойствами, такими как Name.

Применяется к

PrintServer(String, String[], PrintSystemDesiredAccess)

Инициализирует новый экземпляр класса PrintServer, для которого задан путь, фильтр свойств и необходимый тип доступа.

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)

Параметры

path
String

Имя сервера печати и полный путь к нему.

propertiesFilter
String[]

Массив имен свойств, инициализируемых конструктором.

desiredAccess
PrintSystemDesiredAccess

Значение, указывающее тип доступа к серверу печати, необходимый программе.

Исключения

Значение desiredAccess можно применить только к объекту PrintQueue, а не LocalPrintServer. Например, UsePrinter.

Комментарии

Если path имеет значение null, PrintServer будет представлять локальный сервер печати и будет инициализирован с его свойствами, такими как Name.

Применяется к