Udostępnij za pośrednictwem


NavigableListActivity.CurrentItem Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Gets or sets the index of the current item in the Items collection.

Namespace: Microsoft.SpeechServer.Dialog
Assembly: Microsoft.SpeechServer (in microsoft.speechserver.dll)

Syntax

'Declaration
<GlobalizedCategoryAttribute("NonDesignableCategory")> _
<GlobalizedDescriptionAttribute("NavigableListActivity_CurrentItem")> _
<ReadOnlyAttribute(True)> _
<TypeConverterAttribute("Microsoft.SpeechServer.Authoring.DialogDesigner.NonDesignableStringConverter, Microsoft.SpeechServer.Authoring.DialogDesigner, Version=2.0.3400.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")> _
<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)> _
Public Property CurrentItem As Nullable(Of Integer)
[GlobalizedCategoryAttribute("NonDesignableCategory")] 
[GlobalizedDescriptionAttribute("NavigableListActivity_CurrentItem")] 
[ReadOnlyAttribute(true)] 
[TypeConverterAttribute("Microsoft.SpeechServer.Authoring.DialogDesigner.NonDesignableStringConverter, Microsoft.SpeechServer.Authoring.DialogDesigner, Version=2.0.3400.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] 
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] 
public Nullable<int> CurrentItem { get; set; }

Property Value

The index of the current item in the Items collection, or null if no item in the Items collection is selected or there are no items in this collection.

Exceptions

Exception type Condition
ArgumentOutOfRangeException

An attempt was made to set CurrentItem to a value greater than or equal to the number of items in the Items collection.

An attempt was made to set CurrentItem to a value less than zero.

Example

The following example shows an implementation of an event handler for the TurnStarting event. This method executes when the recognition turn starts. If the recognized phrase does not represent an item in the navigable list or the user attempted to navigate past either end of the list, this method plays a prompt to notify the user. Otherwise, it plays the CurrentItem in the list.

private void browseCities_TurnStarting(object sender, SelectionTurnStartingEventArgs e)
{
  this.browseCities.MainPrompt.ClearContent();
  if (e.TriedAccessingOutOfRangeItem)
  {
    this.browseCities.MainPrompt.AppendText("There are no other choices.");
  }
  this.browseCities.MainPrompt.AppendText(string.Format("{0}?", Destinations[e.CurrentItem.Value]));
}

Thread Safety

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

Windows Server 2003

See Also

Reference

NavigableListActivity Class
NavigableListActivity Members
Microsoft.SpeechServer.Dialog Namespace
TurnStarting