Date post: | 29-Nov-2014 |
Category: |
Education |
Upload: | peter-gfader |
View: | 2,848 times |
Download: | 3 times |
Delivering Awesome Web Applications
Developing Windows and Web Applications using Visual Studio.NET
Peter Gfader
Delivering Awesome Web Applications
Agenda
1. About SSW and Presenters
2. Student Introduction
3. Course Overview
4. .NET Overview
5. VS. Net Overview/ Demo
6. Design Patterns
7. Hands on lab
Delivering Awesome Web Applications
SSW Consulting has 18 years development / consulting experience.
Adam Cogan is the Chief Software Architect at SSW
1of 3 Microsoft Regional Directors in Australia
About SSW
Delivering Awesome Web Applications
SSA @ SSW
Loves C# and .NET (Java not anymore)
Specializes in
Windows Forms ASP.NET TFS testing Automated tests Silverlight
Peter Gfader
Delivering Awesome Web Applications
Attendance
Please initial the sheet next to your name
Hands On Lab
Please get Peter to initial sheet
Homework
Certificate
At end of 10 sessions
Admin Stuff
Delivering Awesome Web Applications
Name
Company
Experience
IT Programming .NET C# / VB Database
Goals for the course
Anything else after 9PM
Introductions
Delivering Awesome Web Applications
http://www.ssw.com.au/ssw/Events/2010UTSNET/
Part 1: .NET WinForms
1. Overview of .NET & C# basics2. C# Advanced + Data in Forms3. Usability - Rules to Better Windows Forms4. Deployment and Security of Windows Forms5. Web Services and Threading
The 10 Sessions
Delivering Awesome Web Applications
http://www.ssw.com.au/ssw/Events/2010UTSNET/default.aspx
Part 2: .NET Webforms
1. Overview of ASP.NET Webforms2. Data in Webforms3. Usability
• Rich Web Forms and • Other ASP.NET Features
4. Web Security 5. Advanced Topics & Future Technology
The 10 Sessions
Delivering Awesome Web Applications
What is .NET?
What is C#?
Language Differences VB + C#
Review of OOP
N-Tier Solution Design
Demo: Creating WinForms
Session 1: Overview
Delivering Awesome Web Applications
.NET is the Microsoft Web services strategy to connect information, people, systems, and devices through
software
Microsoft, beginning 2000
What is .NET?
Delivering Awesome Web Applications
An application development platform from Microsoft
Runtime (Virtual machine)
Tools
Languages, IDE, …
Rapidly develop secure and robust software
Web and Windows
Full support for object-oriented programming
What is .NET?
Delivering Awesome Web Applications
C# compiler
Intermediate Language
(MSIL)
Common Language Runtime
Compiles to MSIL
Represents codeindependent from src
Executes MSIL
Delivering Awesome Web Applications
What is .NET?
Language Independence VB C# F# C++ IronPython
Any language that supports the Common Language Runtime (CLR) Specification
Delivering Awesome Web Applications
C:\Windows\Microsoft.NET
Tools
Delivering Awesome Web Applications
2002 - .Net 1.0 / Visual Studio.NET
2003 - .Net 1.1 / Visual Studio 2003
2005 - .Net 2.0 / Visual Studio 2005
2007 - .Net 3.5 / Visual Studio 2008
2008 - .Net 3.5sp1 (added EDMX)
2010 - .Net 4.0/ VS.Net 2010
Details on http://shrinkster.com/1cu8
History of .NET and Visual Studio
Delivering Awesome Web Applications
Over 4500 classes that provides features such as:
• Data access and connectivity (ADO.NET)• User Interfaces (WinForms, WPF)• Web Applications (ASP.NET, Silverlight)• Network Communication (WCF)• Workflow (WF)
What is the .NET Framework?
Delivering Awesome Web Applications
Evolution
The whole .NET FX 3.5
http://shrinkster.com/1515
Only new types in .NET 4
http://shrinkster.com/1cu9
.NET Framework
Delivering Awesome Web Applications
Allows for language independence
Memory Management (allocation and de-allocation of memory)
Performs automatic garbage collection with the elimination of pointers
No more memory leaks (in theory at least!)
Exception Handling
Security (sandbox from the OS– cannot run malicious code)
Converts the IL byte code into runtime code
CLR =Common Language Runtime
Delivering Awesome Web Applications
Main programming language for .NET framework
Based on C
Object Oriented
Built with hindsight
Java Very similar to Java C++ Very similar to C++
A ‘modern language’ that did not inherit the ‘junk’ from C++ (eg header files, syntax)
C# ?
Delivering Awesome Web Applications
Variable declaration
bool isVeryLong;
Variable assignment
isVeryLong = false;
Control statements
if (yourInput.Length > 10){
isVeryLong = true;}
C# Basis
Delivering Awesome Web Applications
C# 1.0 – First Version
C# 2.0 – Everything that didn’t fit in 1.0
C# 3.0 – LINQ, functional influence
C# 4.0 – Dynamic Programming
C# 5.0 …
History C# - Anders Hejlsberg
Delivering Awesome Web Applications
OOP
Delivering Awesome Web Applications
Terms - I want you to know
#1 Inheritance
#2 Encapsulation
#3 Polymorphism
#4 Abstraction
Classes
Objects
Properties
Methods
Events
Delivering Awesome Web Applications
Class vs. Object
Object
Instance of a class “Car” has an
instance called “petersCar”
Class Defines abstract
characterizations of a “thing”
• Customer• Employee• Car
Blueprint or template
Delivering Awesome Web Applications
Properties
Changeable features of objects Eg. „Color“ of a car
Methods
Actions on an object Eg. Car has a method „Accelerate“
Events
Let other objects know about an action Eg. Car has an event „DoorOpened“
Terms
Delivering Awesome Web Applications
A "square" is a "shape"
#1 Inheritance
Delivering Awesome Web Applications
A "shape" defines a common property "Color"
A "square" inherits the property "Color"
Delivering Awesome Web Applications
Information hiding
E.g.A shape hides internal data
1st point 2nd point
#2 Encapsulation
Delivering Awesome Web Applications
A „Square" has internal fields like „_side“
Delivering Awesome Web Applications
Appear as another
Be used like another
#3 Polymorphism
Delivering Awesome Web Applications
var shapes = new List<IShapes>() {
new Square(“Red"),
new Rectangle(“Blue"),
new Triangle(“Red")
};
foreach (var shape in shapes) {
Console.WriteLine(shape.Color +
": " + shape.CalcSize());
}
#3 Polymorphism
Delivering Awesome Web Applications
Allows inheritance but no instantiation
#4 Abstraction
Delivering Awesome Web Applications
No instance of a "Shape"
Delivering Awesome Web Applications
VB.NET versus C#
Delivering Awesome Web Applications
Variables
Language Differences
' VB Dim FavouriteColour As String = "LightGreen"
// C#String FavouriteColour = "LightGreen";
Delivering Awesome Web Applications
Methods
Language Differences
'VB
Public Function GetName () As String
Public Sub DoSomething()
//C#
public string GetName() {}
public void DoSomething() {}
Delivering Awesome Web Applications
Events and Methods
Language Differences
Delivering Awesome Web Applications
VB Properties
Language Differences
Public Property FirstName() As String Get Return pFirstName End Get Set(ByVal value As String) pFirstName = value End SetEnd Property
Delivering Awesome Web Applications
C# Properties
Language Differences
private string firstName;
public String FirstName{
get{ return firstName }set{ firstName = value;}
}
Delivering Awesome Web Applications
Automatic Properties Feature
public String FirstName
{
get; set;
}
Notice no internal variable was declared?
It is created by the compiler
Saves typing and makes code neater
Properties since C# 3.0
Delivering Awesome Web Applications
Auto Implemented Properties
Collection Initializers
Named parameters
Optional parameters
Lambdas
Can span statements across multiple lines
Auto Implemented Properties
Collection Initializers (limited)
Named parameters
Optional parameters
Lambdas (limited)
Can span statements across multiple lines
.NET 3.5
Delivering Awesome Web Applications
Auto Implemented Properties
Collection Initializers
Named parameters
Optional parameters
Lambdas
Can span statements across multiple lines
Auto Implemented Properties
Collection Initializers
Named parameters
Optional parameters
Lambdas
Can span statements across multiple lines
.NET 4
Delivering Awesome Web Applications
Visual Studio 2010
Delivering Awesome Web Applications
Visual Studio 2010
Delivering Awesome Web Applications
Windows Forms
Delivering Awesome Web Applications
A UI Component
WinForm – a Window displayed by an application Web Forms are page hosted in a browser
What is a Form?
Delivering Awesome Web Applications
Textboxes
Buttons
Tool Strip Menu
Picture
Labels
Controls
Delivering Awesome Web Applications
Reuse a set of controls
e.g. Form with • Billing Address and • Shipping Address
Where an address consists of– Address line 1 – Address line 2 – Suburb – State– Post code
User Controls
Delivering Awesome Web Applications
Most controls have events
Examples• Clicked• TextChanged• Closing
Event Handlers
Can’t control the order the event gets handled
Events
Delivering Awesome Web Applications
"Programming"
Able to code in that language
"Understanding .NET“
Understanding the .NET Framework and technology
"Architecture“
Knowing when and what do and why
Architecture vs. Programming
Delivering Awesome Web Applications
N-Tier Application Simplified
Delivering Awesome Web Applications
Separate logic and data access from presentation Easier to maintain code Low-coupling
Modularity/Re-use business logic Easily add a different UI
• Web UI• Smart Phone UI
Team Development
Why n-tier?
Delivering Awesome Web Applications
Keep the users in mind
Delivering Awesome Web Applications
Keep the users in mind
Delivering Awesome Web Applications
WPF?
Delivering Awesome Web Applications
Windows Presentation Foundation
Rich Windows Applications
Great Architecture + Great Graphics
Rapid Prototyping
2D, 3D, Vector, Document Flow, Layouts, Composition, etc.
WPF in a nutshell
Delivering Awesome Web Applications
The 10 Sessions
Overview of .NET
OOP
Language Differences
n-Tier Application Architecture
Demo: Creating WinForms (C#)
Summary
Delivering Awesome Web Applications
Creating a Windows Form Application
1. Opening forms2. Menus3. Event handlers4. User controls
Hands ON LAB
Delivering Awesome Web Applications
The C# tutorial http://www.csharp-station.com/Tutorial.aspx
Online videos and training http://channel9.msdn.com/learn/courses/VS2010/
Nice video to OOPhttp://msdn.microsoft.com/en-us/beginner/cc963989.aspx
More on OOPhttp://en.wikipedia.org/wiki/Object-oriented_programming
Resources 1/2
Delivering Awesome Web Applications
Design patterns in C#http://www.dofactory.com/Patterns/Patterns.aspx
Winforms tips and trickshttp://peitor.blogspot.com/search/label/winforms
Use controls in Windows Forms!
http://www.telerik.com http://www.devexpress.com http://www.infragistics.com
Beginner Developer Learning Centerhttp://msdn.microsoft.com/en-us/beginner/default.aspx
Resources 2/2
Delivering Awesome Web Applications
3 things…
http://peitor.blogspot.com
Delivering Awesome Web Applications
Thank You!
Gateway Court Suite 10 81 - 91 Military Road Neutral Bay, Sydney NSW 2089 AUSTRALIA
ABN: 21 069 371 900
Phone: + 61 2 9953 3000 Fax: + 61 2 9953 3105