Upload
mohammad-shaker
View
756
Download
3
Tags:
Embed Size (px)
DESCRIPTION
Citation preview
Mobile
Software
Engineering
L06 – Windows Phone
Mohammad Shaker
FIT of Damascus - AI dept.
Mobile SE – August 2012
Take a look
http://bit.ly/e-76phone
Free Developer Account
Code Samples for Windows Phone
Downloading the SDKbit.ly/wp7sdktools
Downloading the SDK
Silverlight and Mango
Emulator
.NET Support
Tutorialhttp://jesseliberty.com/tutorials/
Design PatternsMVC and MVVC Models
MVVM
Model-View View-Model
MVVMtargeted at modern UI development platforms
which support Event-driven programming
MVVMHTML5, WPF, Silverlight, … etc.
MVVMmore @ https://en.wikipedia.org/wiki/MVVM
MVVM – Microsoft Prismhttp://msdn.microsoft.com/en-us/library/cc707819.aspx
http://msdn.microsoft.com/en-us/practices/default.aspx
Straight into the Action!“Live test”
MVVMBinding Awesomeness
Binding Awesomeness<TextBlock Text="{Binding Message}" Margin="10“TextWrapping="Wrap" FontSize="18" Width="350" />
Project attached
Deleting with ItemSource sethttp://stackoverflow.com/questions/6422378/listbox-operation-not-supported-on-read-only-collection
this.UserListBox.Items.RemoveAt(this.UserListBox.SelectedIndex);
Expression BlendDesigner Tool
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>
XML Revisited - Twitter Binding!http://www.netmagazine.com/tutorials/build-your-first-windows-phone-7-app
WebClientWhat a line of code can do!
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));
}
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));
}
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
};
}
Project attached
Navigation >>
Navigation
void GoToPage2_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(
new Uri("/Page2.xaml", UriKind.Relative)
);
}
Windows Azure Toolkit
for Windows Phonehttp://watwp.codeplex.com
into the Cloud..
XNAGames
Creators Clubhttp://create.msdn.com/en-US/
http://create.msdn.com/en-US/
XNA Development
Game LoopOnUpdate(), OnDraw()
PracticeParticle Engine with Touch Events!
What’s a Particle EngineImplementation
Touch
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
Particle engine with touch events!
Project attached – play around!