2.1 program design with...
TRANSCRIPT
-
Session 2.1
-
Windows Phone
Topics
-
Windows Phone
Software and Design
3
-
Windows Phone
Separation of tasks
4
-
Windows Phone
Tools for the job : Graphical Design
5
-
Windows Phone
Tools for the job : Code Creation
6
-
Windows Phone
The Metro design style
7
-
Windows Phone
Design Style and programming
8
-
Windows Phone
Silverlight and Metro
9
-
Windows Phone
Silverlight and Us
10
-
Windows Phone
Software Objects
11
-
Windows Phone
Software Objects
12
public class Account
{
private decimal balance ;
private string name ;
public string GetName ()
{
return name;
}
public bool SetName (string newName){
{
// Final version will validate the name
name = newName;
return true;
}
// Other get and set methods here
}
-
Windows Phone
Data members
13
public class Account
{
private decimal balance ;
private string name ;
public string GetName ()
{
return name;
}
public bool SetName (string newName){
{
// Final version will validate the name
name = newName;
return true;
}
// Other get and set methods here
}
This is the data our bank account will hold:The name of the holder and the balanceThis is the data our bank account will hold:The name of the holder and the balance
-
Windows Phone
Data members
14
public class Account
{
private decimal balance ;
private string name ;
public string GetName ()
{
return name;
}
public bool SetName (string newName){
{
// Final version will validate the name
name = newName;
return true;
}
// Other get and set methods here
}
These are the behaviours the account providesThese are the behaviours the account provides
-
Windows Phone
Using the Account class
15
Account rob = new Account();
rob.SetName("Rob");
-
Windows Phone
Objects Oriented Design
16
-
Windows Phone
The Silverlight Adding Machine
17
-
Windows Phone
Silverlight and Objects
18
-
Windows Phone
Silverlight display elements
19
-
Windows Phone
Display element data
20
-
Windows Phone
Types of element
21
-
Windows Phone
Class Hierarchies and Silverlight
22
-
Windows Phone
Silverlight element class hierarchy
23
FrameworkElement
TextBlock
TextBox ContentControl
ButtonBase
Button
Control
-
Windows Phone
Class Hierarchies
24
-
Windows Phone
Silverlight and Code
25
-
Windows Phone
Silverlight and Design
26
-
Windows Phone
The Toolbox and Designer
27
-
Windows Phone
Demo 1: Adding display elements
28
-
Windows Phone
Silverlight element names
29
-
Windows Phone
Setting the name of an element
30
-
Windows Phone
Selecting an element
31
-
Windows Phone
Editing the name of an element
32
-
Windows Phone
Demo 2: Display element names
33
-
Windows Phone
Silverlight element properties
34
-
Windows Phone
Properties in C#
-
Windows Phone
Private and Public
-
Windows Phone
Managing Class Data
-
Windows Phone
Bank accounts and data
-
Windows Phone
NamePropertypublic class Account
{
private int age;
/// rest of account here
}
-
Windows Phone
Using Get and Set methodspublic class Account
{
private int age;
public int GetAge()
{
return this.age;
}
public void SetAge( int inAge )
{
if ( (inAge > 0) && (inAge < 120) )
{
this.age = inAge;
}
}
}
-
Windows Phone
Managing the AgeCurrentAccount a = new Account();
a.SetAge(21);
-
Windows Phone
Get and Set Methods
-
Windows Phone
Using Properties
-
Windows Phone
Age Propertypublic class Account
{
private int ageValue;
public int Age
{
set
{
if ( (value > 8) && (value < 100) )
ageValue = value;
}
get
{
return ageValue;
}
}
}
-
Windows Phone
Property Keywords
-
Windows Phone
Using the Age PropertyAccount s = new Account ();
s.Age = 21;
Console.WriteLine ( "Age is : " + s.Age );
-
Windows Phone
Property validationAccount s = new Account ();
int newAge = 150;
s.Age = newAge;
if (s.Age != newAge )
Console.WriteLine ( "Age was not set" );
-
Windows Phone
Multiple properties for one value
public int AgeInMonths
{
get
{
return this.ageValue*12;
}
}
-
Windows Phone
Properties and Silverlight
49
-
Windows Phone
Properties and Notification
50
-
Windows Phone
Page Design with Silverlight
51
-
Windows Phone
Review
52