PrintServer Konstruktory
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Inicjuje nowe wystąpienie klasy PrintServer.
PrintServer() |
Inicjuje nowe wystąpienie klasy PrintServer. |
PrintServer(PrintSystemDesiredAccess) |
Inicjuje PrintServer nowe wystąpienie klasy, która reprezentuje lokalny serwer wydruku i przypisuje mu określony element PrintSystemDesiredAccess. |
PrintServer(String) |
Inicjuje PrintServer nowe wystąpienie klasy, która ma określoną ścieżkę. |
PrintServer(String, PrintServerIndexedProperty[]) |
Inicjuje PrintServer nowe wystąpienie klasy przy użyciu określonej PrintServerIndexedProperty tablicy w celu określenia, które właściwości zostaną zainicjowane. |
PrintServer(String, PrintSystemDesiredAccess) |
Inicjuje PrintServer nowe wystąpienie klasy, które ma określoną ścieżkę i wymagany dostęp. |
PrintServer(String, String[]) |
Inicjuje PrintServer nowe wystąpienie klasy z określoną ścieżką i filtrem właściwości. |
PrintServer(String, PrintServerIndexedProperty[], PrintSystemDesiredAccess) |
Inicjuje PrintServer nowe wystąpienie klasy i udostępnia określoną ścieżkę, tablicę PrintServerIndexedProperty i wymagany dostęp. |
PrintServer(String, String[], PrintSystemDesiredAccess) |
Inicjuje PrintServer nowe wystąpienie klasy z określoną ścieżką, filtrem właściwości i wymaganym dostępem. |
Inicjuje nowe wystąpienie klasy PrintServer.
public:
PrintServer();
public PrintServer ();
Public Sub New ()
Dotyczy
.NET Framework 4.8.1 i inne wersje
Produkt | Wersje |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Inicjuje PrintServer nowe wystąpienie klasy, która reprezentuje lokalny serwer wydruku i przypisuje mu określony element 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)
Parametry
- desiredAccess
- PrintSystemDesiredAccess
Wartość określająca typ dostępu serwera wydruku, którego potrzebuje program.
Wyjątki
desiredAccess
to wartość, która może być stosowana tylko do PrintQueue obiektu, a nie LocalPrintServer do obiektu. Na przykład UsePrinter.
Uwagi
Element PrintServer zostanie zainicjowany przy użyciu właściwości lokalnego serwera wydruku, takich jak Name.
Dotyczy
.NET Framework 4.8.1 i inne wersje
Produkt | Wersje |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Inicjuje PrintServer nowe wystąpienie klasy, która ma określoną ścieżkę.
public:
PrintServer(System::String ^ path);
public PrintServer (string path);
new System.Printing.PrintServer : string -> System.Printing.PrintServer
Public Sub New (path As String)
Parametry
- path
- String
Nazwa i pełna ścieżka serwera wydruku.
Przykłady
W poniższym przykładzie pokazano, jak użyć tego konstruktora do utworzenia wystąpienia klasy 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()
Uwagi
Jeśli path
parametr ma null
wartość , PrintServer będzie reprezentować lokalny serwer wydruku i zostanie zainicjowany przy użyciu jego właściwości, takich jak Name.
Dotyczy
.NET Framework 4.8.1 i inne wersje
Produkt | Wersje |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Inicjuje PrintServer nowe wystąpienie klasy przy użyciu określonej PrintServerIndexedProperty tablicy w celu określenia, które właściwości zostaną zainicjowane.
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())
Parametry
- path
- String
Pełna ścieżka i nazwa serwera wydruku.
- propertiesFilter
- PrintServerIndexedProperty[]
Właściwości inicjowane przez konstruktor.
Uwagi
Jeśli path
parametr ma null
wartość , PrintServer będzie reprezentować lokalny serwer wydruku i zostanie zainicjowany przy użyciu jego właściwości, takich jak Name.
Dotyczy
.NET Framework 4.8.1 i inne wersje
Produkt | Wersje |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Inicjuje PrintServer nowe wystąpienie klasy, które ma określoną ścieżkę i wymagany dostęp.
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)
Parametry
- path
- String
Nazwa i pełna ścieżka serwera wydruku.
- desiredAccess
- PrintSystemDesiredAccess
Wartość określająca typ dostępu serwera wydruku, którego potrzebuje program.
Wyjątki
desiredAccess
to wartość, która może być stosowana tylko do PrintQueue obiektu, a nie LocalPrintServer do obiektu. Na przykład UsePrinter.
Przykłady
W poniższym przykładzie pokazano, jak używać tego konstruktora do badania wszystkich drukarek pod kątem możliwego stanu błędu.
// 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()
Uwagi
Jeśli path
parametr ma null
wartość , PrintServer będzie reprezentować lokalny serwer wydruku i zostanie zainicjowany przy użyciu jego właściwości, takich jak Name.
Dotyczy
.NET Framework 4.8.1 i inne wersje
Produkt | Wersje |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Inicjuje PrintServer nowe wystąpienie klasy z określoną ścieżką i filtrem właściwości.
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())
Parametry
- path
- String
Nazwa i pełna ścieżka serwera wydruku.
- propertiesFilter
- String[]
Tablica nazw właściwości, które inicjuje konstruktor.
Uwagi
Jeśli path
parametr ma null
wartość , PrintServer będzie reprezentować lokalny serwer wydruku i zostanie zainicjowany przy użyciu jego właściwości, takich jak Name.
Dotyczy
.NET Framework 4.8.1 i inne wersje
Produkt | Wersje |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Inicjuje PrintServer nowe wystąpienie klasy i udostępnia określoną ścieżkę, tablicę PrintServerIndexedProperty i wymagany dostęp.
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)
Parametry
- path
- String
Pełna ścieżka i nazwa serwera wydruku.
- propertiesFilter
- PrintServerIndexedProperty[]
Właściwości inicjowane przez konstruktor.
- desiredAccess
- PrintSystemDesiredAccess
Wartość określająca typ dostępu serwera wydruku, którego potrzebuje program.
Wyjątki
desiredAccess
to wartość, która może być stosowana tylko do PrintQueue obiektu, a nie LocalPrintServer do obiektu. Na przykład UsePrinter.
Uwagi
Jeśli path
parametr ma null
wartość , PrintServer będzie reprezentować lokalny serwer wydruku i zostanie zainicjowany przy użyciu jego właściwości, takich jak Name.
Dotyczy
.NET Framework 4.8.1 i inne wersje
Produkt | Wersje |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Inicjuje PrintServer nowe wystąpienie klasy z określoną ścieżką, filtrem właściwości i wymaganym dostępem.
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)
Parametry
- path
- String
Nazwa i pełna ścieżka serwera wydruku.
- propertiesFilter
- String[]
Tablica nazw właściwości, które inicjuje konstruktor.
- desiredAccess
- PrintSystemDesiredAccess
Wartość określająca typ dostępu serwera wydruku, którego potrzebuje program.
Wyjątki
desiredAccess
to wartość, która może być stosowana tylko do PrintQueue obiektu, a nie LocalPrintServer do obiektu. Na przykład UsePrinter.
Uwagi
Jeśli path
parametr ma null
wartość , PrintServer będzie reprezentować lokalny serwer wydruku i zostanie zainicjowany przy użyciu jego właściwości, takich jak Name.
Dotyczy
.NET Framework 4.8.1 i inne wersje
Produkt | Wersje |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Opinia o produkcie .NET
.NET to projekt typu open source. Wybierz link, aby przekazać opinię: