c# advanced l01-intro and warmup
DESCRIPTION
C# Advanced L01-Intro and WarmupTRANSCRIPT
Mohammad Shaker
mohammadshaker.com
@ZGTRShaker
2011, 2012, 2013, 2014
C# AdvancedL01 – Intro
Topics in This Course
1. Utilities: Speech, Windows Voice Recognition, Regular Expressions, Internationalization.
2. Operator Overloading, Indexers and User-Defined Conversion
3. Parallel Programming and Threading
4. Attributes and Reflection
5. WPF: Windows Presentation Foundation
6. Database: XML, LINQ to XML, SQL Server, LINQ to SQL
7. Design Patterns: Element of Reusable Objects
8. WF: Windows Workflow Foundation
9. Networking and WCF: Windows Communication Foundation
10. Web Development: HTML5, ASP.NET, ASP.NET MVC
11. Mobile Development: Windows Phone, Stores and Games
Speech with .NET
Speech
• Add: using System.Speech.Synthesis;
• Now, just write the following and listen for “Hello”
• You can output speech asynchronously to allow processing to continue whilst the
audio is played using synth.SpeakAsync
private void SayHello(){
var synth = new SpeechSynthesizer();synth.Speak("Hello");Console.WriteLine("Finished");Console.ReadLine();
}
private void SayHello(){
var synth = new SpeechSynthesizer();synth.SpeakAsync("Hello");Console.WriteLine("Finished");Console.ReadLine();
}
Speech Recognition
Speech RecognitionDead easy with .NET!
Speech Recognition
• Adding References
• Using: System.Speech.Recognition Namespace
• Recognition: as easy as event handling
using System.Speech.Recognition;
public void SpeechRecognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e){
textBox1.Text = e.Result.Text;}
Speech Recognitionclass SpeechEngine {
private SpeechRecognizer _speechRecognizer;public SpeechEngine(){
this._speechRecognizer = new SpeechRecognizer();this.BuildGrammars();this._speechRecognizer.SpeechRecognized += SpeechRecognizer_SpeechRecognized;
}
private void BuildGrammars(){
Choices choices = new Choices();List<string> listOfStudentNames = new List<string>() {“Mohammad”, “Hamza”, “Mariam”, “Amal”};foreach (string studentName in listOfStudentNames){
choices.Add(studentName);}GrammarBuilder grammarBuilder = new GrammarBuilder(choices);Grammar grammmars = new Grammar(grammarBuilder);_speechRecognizer.LoadGrammar(grammmars);
}
public void SpeechRecognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e){ textBox1.Text = e.Result.Text; }
}
Regular Expressions
Regexusing System;using System.Text.RegularExpressions;
class MainClass{
public static void Main(){
string s = "A, B,cCCC, D";Regex regex = new Regex(@" |, ");foreach (string sub in regex.Split(s)){
Console.WriteLine("Word: {0}", sub);}
}}
Word: A
Word: B,cCCC
Word: D
Internationalization
Cultures
using System;using System.Globalization;using System.Threading;
class MainClass{public static void Main(){Console.WriteLine(Thread.CurrentThread.CurrentCulture.Name);
}}
en-CA
http://www.mohammadshaker.com
https://twitter.com/ZGTRShaker @ZGTRShaker
https://de.linkedin.com/pub/mohammad-shaker/30/122/128/
http://www.slideshare.net/ZGTRZGTR
https://www.goodreads.com/user/show/11193121-mohammad-shaker
https://plus.google.com/u/0/+MohammadShaker/
https://www.youtube.com/channel/UCvJUfadMoEaZNWdagdMyCRA
http://mohammadshakergtr.wordpress.com/