wpf and threading
TRANSCRIPT
-
8/6/2019 WPF and Threading
1/15
WPFLets Tech @ NTU 2011
by
1
-
8/6/2019 WPF and Threading
2/15
WPF
Windows Presentation Foundation (or WPF) is a
computer-software graphical subsystem for
rendering user interfaces in Windows-based
applications (Wikipedia).
Windows Presentation Foundation (WPF) is a
next-generation presentation system for
building Windows client applications withvisually stunning user experiences. With WPF,
you can create a wide range of both standalone
and browser-hosted applications (Microsoft).
2
-
8/6/2019 WPF and Threading
3/15
Silverlight Showcase
Official Site
http://www.silverlight.net/showcase/
btyazilim http://www.btyazilim.com.tr/
Microsoft Academic Seaerch
http://academic.research.microsoft.com/VisualExplorer.aspx#63591
3
http://www.silverlight.net/showcase/http://www.btyazilim.com.tr/http://academic.research.microsoft.com/VisualExplorer.aspxhttp://academic.research.microsoft.com/VisualExplorer.aspxhttp://academic.research.microsoft.com/VisualExplorer.aspxhttp://academic.research.microsoft.com/VisualExplorer.aspxhttp://www.btyazilim.com.tr/http://www.silverlight.net/showcase/ -
8/6/2019 WPF and Threading
4/15
Winform vs. WPF
Winform
(
4
-
8/6/2019 WPF and Threading
5/15
Winform vs. WPF
WPF
Silverlight
Databinding
5
-
8/6/2019 WPF and Threading
6/15
Winform vs. WPF
*
DreamSpark (All NTU Students) MSDNAA (All SCE Students)
6
-
8/6/2019 WPF and Threading
7/15
Thread
1
1
2
3
4
7
-
8/6/2019 WPF and Threading
8/15
Web-based
One thread per request
Handled by sever-side software
Apache HTTP server
Internet Information Services (IIS)
Apache Tomcat Console-based
8
-
8/6/2019 WPF and Threading
9/15
GUI
Web server
9
-
8/6/2019 WPF and Threading
10/15
.NET Framework
1. Thread t = new Thread(delegate() { foo(); });
2. ThreadPool.QueueUserWorkItem((WaitCallback)delegate(object s) { foo(); });
3. Dispatcher.BeginInvoke((Action)delegate() {foo(); });
4. Dispatcher.Invoke((Action)delegate() {
foo();});5.
*delegation()
10
-
8/6/2019 WPF and Threading
11/15
Thread t = new
Concurrent programming Synchronization
Deadlock
Debug
Support
11
-
8/6/2019 WPF and Threading
12/15
.NET Framework
ThreadPool
Dispatcher
BackgroundWorker
.NET
Framework
Background Thread
12
-
8/6/2019 WPF and Threading
13/15
Lets CODE!
Quick WPF Project Demo
XMAL Drag and drop
Writing markup
Events handling
Threading demo, the Bad
Threading demo, the Good
13
-
8/6/2019 WPF and Threading
14/15
Q & A
14
-
8/6/2019 WPF and Threading
15/15
Reference
Windows Presentation Foundation http://msdn.microsoft.com/en-us/library/ms754130.aspx
WPF Architecture http://msdn.microsoft.com/en-us/library/ms750441.aspx
WPF Threading Model
http://msdn.microsoft.com/en-us/library/ms741870.aspx Build More Responsive Apps With The Dispatcher
http://msdn.microsoft.com/en-us/magazine/cc163328.aspx
Generic BackgroundWorker implementation in C# http://osherove.com/blog/2004/6/16/backgroundworker-implementation-in-c.html
Why Threads Are A Bad Idea
http://www.cs.sfu.ca/~vaughan/teaching/431/papers/ousterhout-threads-usenix96.pdf Simple WPF Progress Window with Cancellation
http://blog.quantumbitdesigns.com/2008/07/22/simple-wpf-progress-window-with-cancellation/
They are Anonymous Methods, not Anonymous Delegates http://staceyw1.wordpress.com/2007/12/22/they-are-anonymous-methods-not-
anonymous-delegates/
15
http://msdn.microsoft.com/en-us/library/ms754130.aspxhttp://msdn.microsoft.com/en-us/library/ms750441.aspxhttp://msdn.microsoft.com/en-us/library/ms741870.aspxhttp://msdn.microsoft.com/en-us/magazine/cc163328.aspxhttp://osherove.com/blog/2004/6/16/backgroundworker-implementation-in-c.htmlhttp://www.cs.sfu.ca/~vaughan/teaching/431/papers/ousterhout-threads-usenix96.pdfhttp://blog.quantumbitdesigns.com/2008/07/22/simple-wpf-progress-window-with-cancellation/http://blog.quantumbitdesigns.com/2008/07/22/simple-wpf-progress-window-with-cancellation/http://staceyw1.wordpress.com/2007/12/22/they-are-anonymous-methods-not-anonymous-delegates/http://staceyw1.wordpress.com/2007/12/22/they-are-anonymous-methods-not-anonymous-delegates/http://staceyw1.wordpress.com/2007/12/22/they-are-anonymous-methods-not-anonymous-delegates/http://staceyw1.wordpress.com/2007/12/22/they-are-anonymous-methods-not-anonymous-delegates/http://blog.quantumbitdesigns.com/2008/07/22/simple-wpf-progress-window-with-cancellation/http://blog.quantumbitdesigns.com/2008/07/22/simple-wpf-progress-window-with-cancellation/http://www.cs.sfu.ca/~vaughan/teaching/431/papers/ousterhout-threads-usenix96.pdfhttp://osherove.com/blog/2004/6/16/backgroundworker-implementation-in-c.htmlhttp://msdn.microsoft.com/en-us/magazine/cc163328.aspxhttp://msdn.microsoft.com/en-us/library/ms741870.aspxhttp://msdn.microsoft.com/en-us/library/ms750441.aspxhttp://msdn.microsoft.com/en-us/library/ms754130.aspx