Share via


Metodo InkAnalyzerBase.UpdateStrokesData

Aggiornamento: novembre 2007

Aggiorna i dati del pacchetto per i tratti specificati.

Spazio dei nomi:  System.Windows.Ink.AnalysisCore
Assembly:  IACore (in IACore.dll)

Sintassi

'Dichiarazione
Public Sub UpdateStrokesData ( _
    strokeIds As Integer(), _
    strokePacketCounts As Integer(), _
    strokesPacketData As Integer(), _
    strokesPacketDescription As Guid() _
)
'Utilizzo
Dim instance As InkAnalyzerBase
Dim strokeIds As Integer()
Dim strokePacketCounts As Integer()
Dim strokesPacketData As Integer()
Dim strokesPacketDescription As Guid()

instance.UpdateStrokesData(strokeIds, _
    strokePacketCounts, strokesPacketData, _
    strokesPacketDescription)
public void UpdateStrokesData(
    int[] strokeIds,
    int[] strokePacketCounts,
    int[] strokesPacketData,
    Guid[] strokesPacketDescription
)
public:
void UpdateStrokesData(
    array<int>^ strokeIds, 
    array<int>^ strokePacketCounts, 
    array<int>^ strokesPacketData, 
    array<Guid>^ strokesPacketDescription
)
public void UpdateStrokesData(
    int[] strokeIds,
    int[] strokePacketCounts,
    int[] strokesPacketData,
    Guid[] strokesPacketDescription
)
public function UpdateStrokesData(
    strokeIds : int[], 
    strokePacketCounts : int[], 
    strokesPacketData : int[], 
    strokesPacketDescription : Guid[]
)

Parametri

  • strokeIds
    Tipo: array<System.Int32[]
    Matrice che contiene gli identificatori di tratto.
  • strokePacketCounts
    Tipo: array<System.Int32[]
    Matrice che contiene il numero di pacchetti in ogni tratto.
  • strokesPacketData
    Tipo: array<System.Int32[]
    Matrice che contiene i dati del pacchetto per i tratti.
  • strokesPacketDescription
    Tipo: array<System.Guid[]
    Matrice che contiene gli identificatori di proprietà del pacchetto.

Note

strokePacketData contiene dati di pacchetto per tutti i tratti. strokePacketDescription contiene GUID che descrivono i tipi di dati di pacchetto inclusi per ogni punto in ciascun tratto. Per un elenco completo delle proprietà del pacchetto disponibili, vedere la classe Microsoft.Ink.PacketProperty.

Questo metodo può aggiornare i dati relativi al tratto solo se tutti i nuovi dati relativi al tratto dispongono della stessa descrizione del pacchetto.

Questo metodo non aggiorna la proprietà DirtyRegion dell'analizzatore dell'input penna.

Se un tratto identificato in strokeIds non è associato all'analizzatore dell'input penna, questo metodo ignora l'identificatore.

Se nessuno dei tratti identificati in strokeIds identifica un tratto associato all'analizzatore dell'input penna, questo metodo restituisce un risultato senza aggiornare l'analizzatore dell'input penna.

Questo metodo genera un'eccezione System.ArgumentNullException quando strokeIds è nullriferimento null (Nothing in Visual Basic).

Esempi

Nell'esempio seguente viene definito un metodo, UpdateStrokesData, che aggiorna i dati relativi al tratto per un oggetto InkAnalyzerBase specificato. Questo metodo converte un insieme Strokes nei dati del pacchetto e aggiorna i tratti relativi al tratto nell'analizzatore dell'input penna. In pratica, se l'applicazione sta utilizzando un oggetto Microsoft.Ink.Ink per archiviare dati relativi al tratto, l'applicazione deve utilizzare la classe Microsoft.Ink.InkAnalyzer derivata.

''' <summary>
''' Updates the packet data for the specified strokes of an InkAnalyzerBase.
''' </summary>
''' <param name="baseInkAnalyzer">
''' The analyzer that receives the strokes.</param>
''' <param name="theStrokes">
''' The strokes for which to update the stroke data.</param>
''' <remarks>
''' This method converts stroke data to packet data for example only.
''' The InkAnalyzerBase is used when your application is handling packet
''' data. If your application uses stroke data from an Ink object, then
''' you would use InkAnalyzer.
''' </remarks>
Public Shared Sub MyUpdateStrokesData( _
ByVal baseInkAnalyzer As System.Windows.Ink.AnalysisCore.InkAnalyzerBase, _
ByVal theStrokes As Microsoft.Ink.Strokes)

    ' Check that the parameters are valid
    If Nothing Is baseInkAnalyzer Then
        Throw New ArgumentNullException("baseInkAnalyzer")
    End If

    If Nothing Is theStrokes Then
        Throw New ArgumentNullException("theStrokes")
    End If

    If 0 = theStrokes.Count Then
        Throw New ArgumentException("Empty strokes collection.")
    End If

    ' Only strokes that have the same packet description GUIDs
    ' can be added in one call to InkAnalyzerBase.AddStrokes.
    Dim thePacketDescription As Guid() = theStrokes(0).PacketDescription

    ' Accumulate the stroke data in collections.
    Dim theStrokeIdentifiers As New ArrayList()
    Dim thePacketCounts As New ArrayList()
    Dim thePacketData As New ArrayList()
    Dim aStroke As Microsoft.Ink.Stroke
    For Each aStroke In theStrokes
        If Not InkAnalyzerHelper.AreElementwiseEquivalent( _
            aStroke.PacketDescription, thePacketDescription) Then

            Throw New ApplicationException( _
                "The strokes collection contains strokes with" + _
                "different packet descriptions.")
        End If

        ' Add the stroke data to the collections.
        theStrokeIdentifiers.Add(aStroke.Id)
        thePacketCounts.Add(aStroke.PacketCount)
        thePacketData.AddRange(aStroke.GetPacketData())
    Next aStroke

    ' Update the stroke data for the base layer ink analyzer.
    baseInkAnalyzer.UpdateStrokesData( _
        DirectCast(theStrokeIdentifiers.ToArray(GetType(Integer)), Integer()), _
        DirectCast(thePacketCounts.ToArray(GetType(Integer)), Integer()), _
        DirectCast(thePacketData.ToArray(GetType(Integer)), Integer()), _
        thePacketDescription)

End Sub 'UpdateStrokesData '
/// <summary>
/// Updates the packet data for the specified strokes of an InkAnalyzerBase.
/// </summary>
/// <param name="baseInkAnalyzer">
/// The analyzer that receives the strokes.</param>
/// <param name="theStrokes">
/// The strokes for which to update the stroke data.</param>
/// <remarks>
/// This method converts stroke data to packet data for example only.
/// The InkAnalyzerBase is used when your application is handling packet
/// data. If your application uses stroke data from an Ink object, then
/// you would use InkAnalyzer.
/// </remarks>
public static void MyUpdateStrokesData(
    System.Windows.Ink.AnalysisCore.InkAnalyzerBase baseInkAnalyzer,
    Microsoft.Ink.Strokes theStrokes)
{
    // Check that the parameters are valid
    if (null == baseInkAnalyzer)
    {
        throw new ArgumentNullException("baseInkAnalyzer");
    }

    if (null == theStrokes)
    {
        throw new ArgumentNullException("theStrokes");
    }

    if (0 == theStrokes.Count)
    {
        throw new ArgumentException("Empty strokes collection.");
    }

    // Only strokes that have the same packet description GUIDs
    // can be added in one call to InkAnalyzerBase.AddStrokes.
    Guid[] thePacketDescription = theStrokes[0].PacketDescription;

    // Accumulate the stroke data in collections.
    ArrayList theStrokeIdentifiers = new ArrayList();
    ArrayList thePacketCounts = new ArrayList();
    ArrayList thePacketData = new ArrayList();
    foreach (Microsoft.Ink.Stroke aStroke in theStrokes)
    {
        if (!InkAnalyzerHelper.AreElementwiseEquivalent(
            aStroke.PacketDescription, thePacketDescription))
        {
            throw new ApplicationException(
                "The strokes collection contains strokes with" +
                "different packet descriptions.");
        }

        // Add the stroke data to the collections.
        theStrokeIdentifiers.Add(aStroke.Id);
        thePacketCounts.Add(aStroke.PacketCount);
        thePacketData.AddRange(aStroke.GetPacketData());
    }

    // Update the stroke data for the base layer ink analyzer.
    baseInkAnalyzer.UpdateStrokesData(
        theStrokeIdentifiers.ToArray(typeof(int)) as int[],
        thePacketCounts.ToArray(typeof(int)) as int[],
        thePacketData.ToArray(typeof(int)) as int[],
        thePacketDescription);
}

Piattaforme

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

InkAnalyzerBase Classe

Membri InkAnalyzerBase

Spazio dei nomi System.Windows.Ink.AnalysisCore

InkAnalyzerBase.AddStroke

InkAnalyzerBase.AddStrokes

InkAnalyzerBase.ClearStrokeData

InkAnalyzerBase.UpdateStrokeData

InkAnalyzerBase.UpdateStrokesCacheBase