Merge branch 'release/#168' into develmaster
This commit is contained in:
@@ -18,7 +18,8 @@ namespace CampusAppWP8.Pages.Events
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
using Windows.Phone.Speech.Synthesis;
|
||||
|
||||
/// <summary>
|
||||
/// EventPage, where every event fees has his own PivotItem.
|
||||
/// </summary>
|
||||
@@ -39,6 +40,12 @@ namespace CampusAppWP8.Pages.Events
|
||||
/// </summary>
|
||||
private bool isNewInstance = false;
|
||||
|
||||
/// <summary>The speech synthesizer object.</summary>
|
||||
private SpeechSynthesizer synth = null;
|
||||
|
||||
/// <summary>The is in speech. </summary>
|
||||
private volatile bool isInSpeech = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EventPage" /> class.
|
||||
/// </summary>
|
||||
@@ -52,7 +59,16 @@ namespace CampusAppWP8.Pages.Events
|
||||
linkBtn.Click += new EventHandler(this.EventLink_Click);
|
||||
ApplicationBar.Buttons.Add(linkBtn);
|
||||
|
||||
ApplicationBarIconButton ttsBtn = new ApplicationBarIconButton();
|
||||
ttsBtn.IconUri = new Uri(Icons.TextToSpeech, UriKind.Relative);
|
||||
ttsBtn.Text = AppResources.TextToSpeech_Btn;
|
||||
ttsBtn.Click += new EventHandler(this.EventTextToSpeech_Click);
|
||||
ApplicationBar.Buttons.Add(ttsBtn);
|
||||
|
||||
this.isNewInstance = true;
|
||||
|
||||
this.synth = new SpeechSynthesizer();
|
||||
this.isInSpeech = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -134,6 +150,11 @@ namespace CampusAppWP8.Pages.Events
|
||||
{
|
||||
App.SaveToIsolatedStorage<RSSViewModel>(Constants.IsolatedStorage_EventRSSModel, EventIndexPage.GetEventFeed().GetModel());
|
||||
}
|
||||
|
||||
if (this.synth != null)
|
||||
{
|
||||
this.synth.CancelAll();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -151,7 +172,7 @@ namespace CampusAppWP8.Pages.Events
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventWebBrowser", Visibility.Collapsed, this.lastSelectedIndex);
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventTextGrid", Visibility.Visible, this.lastSelectedIndex);
|
||||
}
|
||||
|
||||
|
||||
this.lastSelectedIndex = selIndex;
|
||||
}
|
||||
|
||||
@@ -175,5 +196,31 @@ namespace CampusAppWP8.Pages.Events
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventTextGrid", Visibility.Visible, this.EventPivot.SelectedIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Event handler. Called by EventTextToSpeech for click events.</summary>
|
||||
/// <param name="sender">parent pivot object.</param>
|
||||
/// <param name="e">Event information.</param>
|
||||
private async void EventTextToSpeech_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.synth != null && this.isInSpeech == false)
|
||||
{
|
||||
string ssmlPrompt = "<speak version=\"1.0\" ";
|
||||
ssmlPrompt += "xmlns=\"http://www.w3.org/2001/10/synthesis\" xml:lang=\"de-DE\">";
|
||||
ssmlPrompt += EventIndexPage.GetEventFeed().GetModel().Channel[0].Item[this.EventPivot.SelectedIndex].Text;
|
||||
ssmlPrompt += "</speak>";
|
||||
|
||||
this.isInSpeech = true;
|
||||
|
||||
try
|
||||
{
|
||||
await this.synth.SpeakSsmlAsync(ssmlPrompt);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
this.isInSpeech = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace CampusAppWP8.Pages.News
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using Windows.Phone.Speech.Synthesis;
|
||||
|
||||
/// <summary>
|
||||
/// EventPage, where every news fees has his own PivotItem.
|
||||
@@ -39,6 +40,12 @@ namespace CampusAppWP8.Pages.News
|
||||
/// </summary>
|
||||
private bool isNewInstance = false;
|
||||
|
||||
/// <summary>The speech synthesizer object.</summary>
|
||||
private SpeechSynthesizer synth = null;
|
||||
|
||||
/// <summary>The is in speech. </summary>
|
||||
private volatile bool isInSpeech = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NewsPage" /> class.
|
||||
/// </summary>
|
||||
@@ -52,7 +59,16 @@ namespace CampusAppWP8.Pages.News
|
||||
linkBtn.Click += new EventHandler(this.NewsLink_Click);
|
||||
ApplicationBar.Buttons.Add(linkBtn);
|
||||
|
||||
ApplicationBarIconButton ttsBtn = new ApplicationBarIconButton();
|
||||
ttsBtn.IconUri = new Uri(Icons.TextToSpeech, UriKind.Relative);
|
||||
ttsBtn.Text = AppResources.TextToSpeech_Btn;
|
||||
ttsBtn.Click += new EventHandler(this.NewsTextToSpeech_Click);
|
||||
ApplicationBar.Buttons.Add(ttsBtn);
|
||||
|
||||
this.isNewInstance = true;
|
||||
|
||||
this.synth = new SpeechSynthesizer();
|
||||
this.isInSpeech = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -127,6 +143,11 @@ namespace CampusAppWP8.Pages.News
|
||||
{
|
||||
App.SaveToIsolatedStorage<RSSViewModel>(Constants.IsolatedStorage_NewsRSSModel, NewsIndexPage.GetNewsFeed().GetModel());
|
||||
}
|
||||
|
||||
if (this.synth != null)
|
||||
{
|
||||
this.synth.CancelAll();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -168,5 +189,31 @@ namespace CampusAppWP8.Pages.News
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsTextGrid", Visibility.Visible, this.NewsPivot.SelectedIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Event handler. Called by EventTextToSpeech for click events.</summary>
|
||||
/// <param name="sender">parent pivot object.</param>
|
||||
/// <param name="e">Event information.</param>
|
||||
private async void NewsTextToSpeech_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.synth != null && this.isInSpeech == false)
|
||||
{
|
||||
string ssmlPrompt = "<speak version=\"1.0\" ";
|
||||
ssmlPrompt += "xmlns=\"http://www.w3.org/2001/10/synthesis\" xml:lang=\"de-DE\">";
|
||||
ssmlPrompt += NewsIndexPage.GetNewsFeed().GetModel().Channel[0].Item[this.NewsPivot.SelectedIndex].Text;
|
||||
ssmlPrompt += "</speak>";
|
||||
|
||||
this.isInSpeech = true;
|
||||
|
||||
try
|
||||
{
|
||||
await this.synth.SpeakSsmlAsync(ssmlPrompt);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
this.isInSpeech = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<Capability Name="ID_CAP_MEDIALIB_PLAYBACK" />
|
||||
<Capability Name="ID_CAP_MEDIALIB_PHOTO" />
|
||||
<Capability Name="ID_CAP_MICROPHONE" />
|
||||
<Capability Name="ID_CAP_SPEECH_RECOGNITION" />
|
||||
</Capabilities>
|
||||
<Tasks>
|
||||
<DefaultTask Name="_default" NavigationPage="Pages/StartPage.xaml" />
|
||||
|
||||
@@ -852,6 +852,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die vorlesen ähnelt.
|
||||
/// </summary>
|
||||
public static string TextToSpeech_Btn {
|
||||
get {
|
||||
return ResourceManager.GetString("TextToSpeech_Btn", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Freitag ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -413,4 +413,7 @@
|
||||
<data name="QRReader_Search" xml:space="preserve">
|
||||
<value>... suche</value>
|
||||
</data>
|
||||
<data name="TextToSpeech_Btn" xml:space="preserve">
|
||||
<value>vorlesen</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -275,6 +275,17 @@ namespace CampusAppWP8.Resources
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the uri string of the TextToSpeech icon.
|
||||
/// </summary>
|
||||
public static string TextToSpeech
|
||||
{
|
||||
get
|
||||
{
|
||||
return Themerize("info_159.png");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the uri string of the Update icon.
|
||||
/// </summary>
|
||||
|
||||
@@ -186,6 +186,9 @@
|
||||
<data name="StudentCouncil" xml:space="preserve">
|
||||
<value>student_council_159.png</value>
|
||||
</data>
|
||||
<data name="TextToSpeech" xml:space="preserve">
|
||||
<value>info_159.png</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>update_159.png</value>
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user