ValidationResult Struktura

Definicja

Reprezentuje scaloną PrintTicket , która ma gwarancję, że będzie opłacalna, z raportem wszystkich ustawień, które zostały zmienione, aby było to możliwe.

C#
[System.Runtime.InteropServices.ComVisible(false)]
public struct ValidationResult
C#
public struct ValidationResult
Dziedziczenie
ValidationResult
Atrybuty

Przykłady

W poniższym przykładzie pokazano, jak używać wartości tego typu podczas scalania dwóch biletów drukowania.

C#
/// <summary>
/// Changes the user-default PrintTicket setting of the specified print queue.
/// </summary>
/// <param name="queue">the printer whose user-default PrintTicket setting needs to be changed</param>
static private void ChangePrintTicketSetting(PrintQueue queue)
{
    //
    // Obtain the printer's PrintCapabilities so we can determine whether or not
    // duplexing printing is supported by the printer.
    //
    PrintCapabilities printcap = queue.GetPrintCapabilities();

    //
    // The printer's duplexing capability is returned as a read-only collection of duplexing options
    // that can be supported by the printer. If the collection returned contains the duplexing
    // option we want to set, it means the duplexing option we want to set is supported by the printer,
    // so we can make the user-default PrintTicket setting change.
    //
    if (printcap.DuplexingCapability.Contains(Duplexing.TwoSidedLongEdge))
    {
        //
        // To change the user-default PrintTicket, we can first create a delta PrintTicket with
        // the new duplexing setting.
        //
        PrintTicket deltaTicket = new PrintTicket();
        deltaTicket.Duplexing = Duplexing.TwoSidedLongEdge;

        //
        // Then merge the delta PrintTicket onto the printer's current user-default PrintTicket,
        // and validate the merged PrintTicket to get the new PrintTicket we want to set as the
        // printer's new user-default PrintTicket.
        //
        ValidationResult result = queue.MergeAndValidatePrintTicket(queue.UserPrintTicket, deltaTicket);

        //
        // The duplexing option we want to set could be constrained by other PrintTicket settings
        // or device settings. We can check the validated merged PrintTicket to see whether the
        // the validation process has kept the duplexing option we want to set unchanged.
        //
        if (result.ValidatedPrintTicket.Duplexing == Duplexing.TwoSidedLongEdge)
        {
            //
            // Set the printer's user-default PrintTicket and commit the set operation.
            //
            queue.UserPrintTicket = result.ValidatedPrintTicket;
            queue.Commit();
            Console.WriteLine("PrintTicket new duplexing setting is set on '{0}'.", queue.FullName);
        }
        else
        {
            //
            // The duplexing option we want to set has been changed by the validation process
            // when it was resolving setting constraints.
            //
            Console.WriteLine("PrintTicket new duplexing setting is constrained on '{0}'.", queue.FullName);
        }
    }
    else
    {
        //
        // If the printer doesn't support the duplexing option we want to set, skip it.
        //
        Console.WriteLine("PrintTicket new duplexing setting is not supported on '{0}'.", queue.FullName);
    }
}

Uwagi

Jeśli początkowy PrintTicket monit o funkcję drukowania, że drukarka nie obsługuje, sterownik drukarki rozwiązuje wszystkie konflikty w celu utworzenia opłacalnego biletu.

Właściwości

ConflictStatus

Pobiera wartość wskazującą, czy wystąpił konflikt między funkcjonalnością obsługiwaną przez drukarkę a funkcją żądaną w początkowym połączeniu dwóch źródeł PrintTickets.

ValidatedPrintTicket

PrintTicket Pobiera obiekt, który wynika ze scalania dwóch PrintTicket obiektów, które mogły zostać dostosowane w celu zapewnienia jego rentowności.

Metody

Equals(Object)

Określa, czy określona wartość ValidationResult jest równa bieżącemu ValidationResult.

GetHashCode()

Pobiera kod skrótu skojarzony z strumieniem ValidationResult i jego PrintTicket i wydruku.

Operatory

Equality(ValidationResult, ValidationResult)

Określa, czy określone ValidationResult obiekty są równe.

Inequality(ValidationResult, ValidationResult)

Określa, czy określone ValidationResult obiekty nie są równe.

Dotyczy

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, 10