mobile software engineering crash course - c06 windowsphone

51
Mobile Software Engineering L06 – Windows Phone Mohammad Shaker FIT of Damascus - AI dept. [email protected] Mobile SE – August 2012

Upload: mohammad-shaker

Post on 01-Nov-2014

756 views

Category:

Documents


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Mobile Software Engineering Crash Course - C06 WindowsPhone

Mobile

Software

Engineering

L06 – Windows Phone

Mohammad Shaker

FIT of Damascus - AI dept.

[email protected]

Mobile SE – August 2012

Page 2: Mobile Software Engineering Crash Course - C06 WindowsPhone
Page 3: Mobile Software Engineering Crash Course - C06 WindowsPhone

Take a look

http://bit.ly/e-76phone

Page 4: Mobile Software Engineering Crash Course - C06 WindowsPhone

Free Developer Account

Page 5: Mobile Software Engineering Crash Course - C06 WindowsPhone

Code Samples for Windows Phone

Page 6: Mobile Software Engineering Crash Course - C06 WindowsPhone

Downloading the SDKbit.ly/wp7sdktools

Page 7: Mobile Software Engineering Crash Course - C06 WindowsPhone

Downloading the SDK

Page 8: Mobile Software Engineering Crash Course - C06 WindowsPhone

Silverlight and Mango

Page 9: Mobile Software Engineering Crash Course - C06 WindowsPhone
Page 10: Mobile Software Engineering Crash Course - C06 WindowsPhone
Page 11: Mobile Software Engineering Crash Course - C06 WindowsPhone

Emulator

Page 12: Mobile Software Engineering Crash Course - C06 WindowsPhone

.NET Support

Page 13: Mobile Software Engineering Crash Course - C06 WindowsPhone

Tutorialhttp://jesseliberty.com/tutorials/

Page 14: Mobile Software Engineering Crash Course - C06 WindowsPhone

Design PatternsMVC and MVVC Models

Page 15: Mobile Software Engineering Crash Course - C06 WindowsPhone

MVVM

Model-View View-Model

Page 16: Mobile Software Engineering Crash Course - C06 WindowsPhone

MVVMtargeted at modern UI development platforms

which support Event-driven programming

Page 17: Mobile Software Engineering Crash Course - C06 WindowsPhone

MVVMHTML5, WPF, Silverlight, … etc.

Page 18: Mobile Software Engineering Crash Course - C06 WindowsPhone

MVVMmore @ https://en.wikipedia.org/wiki/MVVM

Page 19: Mobile Software Engineering Crash Course - C06 WindowsPhone

MVVM – Microsoft Prismhttp://msdn.microsoft.com/en-us/library/cc707819.aspx

Page 20: Mobile Software Engineering Crash Course - C06 WindowsPhone

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

Page 21: Mobile Software Engineering Crash Course - C06 WindowsPhone

Straight into the Action!“Live test”

Page 22: Mobile Software Engineering Crash Course - C06 WindowsPhone

MVVMBinding Awesomeness

Page 23: Mobile Software Engineering Crash Course - C06 WindowsPhone

Binding Awesomeness<TextBlock Text="{Binding Message}" Margin="10“TextWrapping="Wrap" FontSize="18" Width="350" />

Page 24: Mobile Software Engineering Crash Course - C06 WindowsPhone

Project attached

Page 25: Mobile Software Engineering Crash Course - C06 WindowsPhone

Deleting with ItemSource sethttp://stackoverflow.com/questions/6422378/listbox-operation-not-supported-on-read-only-collection

this.UserListBox.Items.RemoveAt(this.UserListBox.SelectedIndex);

Page 26: Mobile Software Engineering Crash Course - C06 WindowsPhone

Expression BlendDesigner Tool

Page 27: Mobile Software Engineering Crash Course - C06 WindowsPhone
Page 28: Mobile Software Engineering Crash Course - C06 WindowsPhone
Page 29: Mobile Software Engineering Crash Course - C06 WindowsPhone
Page 30: Mobile Software Engineering Crash Course - C06 WindowsPhone

Binding Techniques - Templates

<ListBox Name="lstTwitter" Margin="12,78,8,78">

<ListBox.ItemTemplate>

<DataTemplate>

<StackPanel Orientation="Horizontal" Height="110" Margin="-10,-10,-10,-10">

<TextBlock Text="{Binding Message}" Margin="10" TextWrapping="Wrap"

FontSize="18" Width="350" />

</StackPanel>

</DataTemplate>

</ListBox.ItemTemplate>

</ListBox>

Page 31: Mobile Software Engineering Crash Course - C06 WindowsPhone

XML Revisited - Twitter Binding!http://www.netmagazine.com/tutorials/build-your-first-windows-phone-7-app

Page 32: Mobile Software Engineering Crash Course - C06 WindowsPhone

WebClientWhat a line of code can do!

Page 33: Mobile Software Engineering Crash Course - C06 WindowsPhone

WebClient

private void button2_Click(object sender, RoutedEventArgs e)

{

WebClient twitter = new WebClient();

// Handle downloaded data when finished

twitter.DownloadStringCompleted += new DownloadStringCompletedEventHandler(twitter_DownloadStringCompleted);

// Set the site

twitter.DownloadStringAsync(new Uri("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=" + textBox1.Text));

}

Page 34: Mobile Software Engineering Crash Course - C06 WindowsPhone

WebClient

private void button2_Click(object sender, RoutedEventArgs e)

{

WebClient twitter = new WebClient();

// Handle downloaded data when finished

twitter.DownloadStringCompleted += new DownloadStringCompletedEventHandler(twitter_DownloadStringCompleted);

// Set the site

twitter.DownloadStringAsync(new Uri("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=" + textBox1.Text));

}

Page 35: Mobile Software Engineering Crash Course - C06 WindowsPhone

WebClient

void twitter_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)

{

if (e.Error != null)

return;

XElement xmlTweets = XElement.Parse(e.Result);

lstTwitter.ItemsSource =

from tweet in xmlTweets.Descendants("status")

select new TwitterItem

{

ImageSource = tweet.Element("user").Element("profile_image_url").Value,

Message = tweet.Element("text").Value

};

}

Page 36: Mobile Software Engineering Crash Course - C06 WindowsPhone

Project attached

Page 37: Mobile Software Engineering Crash Course - C06 WindowsPhone

Navigation >>

Page 38: Mobile Software Engineering Crash Course - C06 WindowsPhone

Navigation

void GoToPage2_Click(object sender, RoutedEventArgs e)

{

NavigationService.Navigate(

new Uri("/Page2.xaml", UriKind.Relative)

);

}

Page 39: Mobile Software Engineering Crash Course - C06 WindowsPhone

Windows Azure Toolkit

for Windows Phonehttp://watwp.codeplex.com

Page 40: Mobile Software Engineering Crash Course - C06 WindowsPhone

into the Cloud..

Page 41: Mobile Software Engineering Crash Course - C06 WindowsPhone

XNAGames

Page 42: Mobile Software Engineering Crash Course - C06 WindowsPhone

Creators Clubhttp://create.msdn.com/en-US/

Page 43: Mobile Software Engineering Crash Course - C06 WindowsPhone

http://create.msdn.com/en-US/

Page 44: Mobile Software Engineering Crash Course - C06 WindowsPhone

XNA Development

Page 45: Mobile Software Engineering Crash Course - C06 WindowsPhone

Game LoopOnUpdate(), OnDraw()

Page 46: Mobile Software Engineering Crash Course - C06 WindowsPhone

PracticeParticle Engine with Touch Events!

Page 47: Mobile Software Engineering Crash Course - C06 WindowsPhone

What’s a Particle EngineImplementation

Page 48: Mobile Software Engineering Crash Course - C06 WindowsPhone

Touch

Page 49: Mobile Software Engineering Crash Course - C06 WindowsPhone

Touching Events

MouseState ms = Mouse.GetState();if(ms.LeftButton == ButtonState.Pressed){

DoSomething();}

TouchCollection touches = TouchPanel.GetState();foreach(TouchLocation touch in touches){

if(touch.State == TouchLocationState.Pressed|| touch.State == TouchLocationState.Moved)

{DoSomething();break;

}}

OR

Page 50: Mobile Software Engineering Crash Course - C06 WindowsPhone

Particle engine with touch events!

Page 51: Mobile Software Engineering Crash Course - C06 WindowsPhone

Project attached – play around!