If the JAWS reader does not support this feature, you can implement it yourself with SpeechSynthesizer . Voice playback example:
using System.Speech.Synthesis; SpeechSynthesizer MySpeechSynthesizer = new SpeechSynthesizer(); MySpeechSynthesizer.Speak("Hello!");
I used the ObservableCollection example to which the ListBox assigned. ObservableCollection is a CollectionChanged event that contains an enumeration of the actions performed on the [MSDN] collection:
Member name Description
This event will be implemented as follows:
// Set the ItemsSource SampleListBox.ItemsSource = SomeListBoxCollection; // Set handler on the collection SomeListBoxCollection.CollectionChanged += new NotifyCollectionChangedEventHandler(SomeListBoxCollection_CollectionChanged); private void SomeListBoxCollection_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { // Some actions, in our case - speech } }
Below is my example:
XAML
<Window x:Class="JAWShelp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" WindowStartupLocation="CenterScreen"> <Grid> <ListBox Name="MyListBox" DisplayMemberPath="Name" SelectedIndex="0" Width="100" Height="100" Loaded="MyListBox_Loaded" /> <WrapPanel Width="200" Height="30" Margin="40,150,0,0"> <Button Name="AddButton" Padding="5" Content="Add item" VerticalAlignment="Bottom" Click="AddButton_Click" /> <Button Name="RemoveButton" Padding="5" Margin="30,0,0,0" Content="Remove item" VerticalAlignment="Bottom" Click="RemoveButton_Click" /> </WrapPanel> </Grid> </Window>
Code behind
// using System.Speech.Synthesis; // using System.Collections.ObjectModel; // using System.Collections.Specialized; public partial class MainWindow : Window { public class Person { public string Name { get; set; } } private ObservableCollection<Person> DataForListBox = new ObservableCollection<Person>(); public MainWindow() { InitializeComponent(); } private void MyListBox_Loaded(object sender, RoutedEventArgs e) { DataForListBox.Add(new Person() { Name = "Peter Orange", }); MyListBox.ItemsSource = DataForListBox; DataForListBox.CollectionChanged += new NotifyCollectionChangedEventHandler(DataForListBox_CollectionChanged); } private void DataForListBox_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { SpeechSynthesizer MySpeechSynthesizer = new SpeechSynthesizer(); MySpeechSynthesizer.Speak("You are add item."); } if (e.Action == NotifyCollectionChangedAction.Remove) { SpeechSynthesizer MySpeechSynthesizer = new SpeechSynthesizer(); MySpeechSynthesizer.Speak("You are remove item."); } } private void AddButton_Click(object sender, RoutedEventArgs e) { DataForListBox.Add(new Person() { Name = "Jack Rider", }); } private void RemoveButton_Click(object sender, RoutedEventArgs e) { DataForListBox.RemoveAt(1); } }
No problem, you can add play text to the Add/Remove element. You can also add a .wav play file using PromptBuilder :
PromptBuilder MyPromptBuilder = new PromptBuilder(); MyPromptBuilder.AppendAudio("SomeFile.wav");
Anatoliy Nikolaev
source share