Date post: | 15-Jan-2017 |
Category: |
Software |
Upload: | mohammad-shaker |
View: | 339 times |
Download: | 0 times |
Swiftlet tutorialTeam = 60 let editorialTeam = 17 let totalTeam = tutorialTeam + editorialTeam
// Explicit vs. Inferred Typinglet tutorialTeam: Int = 60let tutorialTeam = 60
// functionsfunc powerOfTwo(sum: Double) -‐> Double { return sum * sum}
Binding Awesomeness<TextBlock Text="{Binding Message}" Margin="10“TextWrapping="Wrap" FontSize="18" Width="350" />
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>
WebClient
private void button2_Click(object sender, RoutedEventArgs e){
WebClient twitter = new WebClient();
// Handle downloaded data when finishedtwitter.DownloadStringCompleted += new
DownloadStringCompletedEventHandler(twitter_DownloadStringCompleted);
// Set the sitetwitter.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};}
Navigationvoid GoToPage2_Click(object sender, RoutedEventArgs e){
NavigationService.Navigate(new Uri("/Page2.xaml", UriKind.Relative));}