and Web Applications using Visual Studio.NET

abashedwhimsicalSoftware and s/w Development

Nov 2, 2013 (3 years and 11 months ago)

141 views

Delivering Awesome Web Applications

Developing Windows
and Web Applications
using Visual
Studio.NET

Drew Robson

Delivering Awesome Web Applications

Agenda

1.
About SSW

and Presenters

2.
Student Introduction

3.
Course Overview

4.
.NET Overview

5.
OOP

6.
VB.Net

vs

C#

7.
VS. Net Overview/ Demo

8.
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


Senior Software Architect @ SSW


Loves C# and .NET


Specializes in


Windows Forms


ASP.NET


ASP.NET MVC


TFS

Drew Robson

Delivering Awesome Web Applications


How to log on

Delivering Awesome Web Applications


Attendance


Please initial the sheet next to your name


Hands On Lab


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

This session will cover


What is .NET?


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

I
ntermediate
L
anguage (MSIL)

C
ommon
L
anguage
R
untime

Compiles to MSIL

Represents code

independent 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
/ Visual
Studio 2010


2012
-

.Net

4.5 / Visual Studio 2012

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


Further improvements in .NET 4


Win8 devices, parallel computing,

HTML5 in .NET 4.5

.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 =

C
ommon
L
anguage
R
untime

Delivering Awesome Web Applications


Main programming language for .NET framework


Based on C


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# 4.5


Devices and Web


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.NET


Dim

FavouriteColour

As

String

= "
LightGreen
"

//
C#

String

FavouriteColour

= "
LightGreen
";

Delivering Awesome Web Applications

Methods





Language Differences

'VB.NET

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.NET Properties




Language Differences

Public

Property

FirstName
()
As

String


Get


Return

pFirstName


End

Get


Set
(
ByVal

value
As

String
)


pFirstName

= value


End

Set

End

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


The 10 Sessions


Overview of .NET


C#, and how it differs to
VB.Net


OOP


Demo: Creating WinForms (C#)


Summary

Delivering Awesome Web Applications


Creating a Windows Form Application

1.
Opening forms

2.
Menus

3.
Event handlers

4.
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 OOP

http://msdn.microsoft.com/en
-
us/beginner/cc963989.aspx



More on OOP

http://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 tricks

http://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
Center

http://msdn.microsoft.com/en
-
us/beginner/default.aspx


Resources 2/2

Delivering Awesome Web Applications

2

things




DrewRobson
@ssw.com.au


twitter.com/
drewmrobson


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

info@ssw.com.au

www.ssw.com.au