Skip to content

Instantly share code, notes, and snippets.

View anuith's full-sized avatar
💭
Hello World

Thiwakorn anuith

💭
Hello World
View GitHub Profile
@anuith
anuith / gist:2984677
Created June 24, 2012 19:57
Windows Phone Hackathon : Facebook & Instagram Sample - Facebook Page Code - FacebookItem class
public class FacebookItem
{
public string id { get; set; }
public string message { get; set; }
public string picture { get; set; }
public string link { get; set; }
public DateTime created_time { get; set; }
public DateTime updated_time { get; set; }
public int likesCount { get; set; }
public int commentsCount { get; set; }
@anuith
anuith / gist:2984688
Created June 24, 2012 20:00
Windows Phone Hackathon : Facebook & Instagram Sample - Facebook Page Code - Get Feed and ReadFeed()
private void ButtonGo_Click(object sender, RoutedEventArgs e) {
string facebookname = TextBox_FBName.Text;
// Reset textblocks, image, and listbox
Image_Cover.Source = null;
TextBlock_Desc.Text = "";
TextBlock_Name.Text = "";
ListBox_Photos.Items.Clear();
// Initializes new Facebook Client
@anuith
anuith / gist:2984700
Created June 24, 2012 20:04
Windows Phone Hackathon : Facebook & Instagram Sample - Instagram Code - InstagramItem class
public class InstagramItem
{
public struct InstagramUser {
public string username { get; set; }
public string website { get; set; }
public string bio { get; set; }
public string profile_picture { get; set; }
public string full_name { get; set; }
public string id { get; set; }
}
@anuith
anuith / gist:2984704
Created June 24, 2012 20:05
Windows Phone Hackathon : Facebook & Instagram Sample - Instagram Page Code - Variables
// Application Identity for Esaan Hackathon
private const string appid = "87d4d37f54fe4553873407e4c087b513";
private const string appsecret = "a212d013f20b42afbc136d3a40a4ece4";
@anuith
anuith / gist:2984706
Created June 24, 2012 20:06
Windows Phone Hackathon : Facebook & Instagram Sample - Instagram Code - Get Feed (Incompleted; continue https://gist.github.com/2984709 )
private void GetFeedAsync() {
string url = string.Format(
@"https://api.instagram.com/v1/media/popular?client_id={0}",
appid);
Uri endpointUri = new Uri(url);
WebClient webclient = new WebClient();
webclient.DownloadStringCompleted +=
new DownloadStringCompletedEventHandler(webclient_DownloadStringCompleted);
@anuith
anuith / gist:2984709
Created June 24, 2012 20:07
Windows Phone Hackathon : Facebook & Instagram Sample - Instagram Code - Get Feed (continued from https://gist.github.com/2984706 )
private void DisplayFeed(JToken data)
{
List<InstagramItem> items = new List<InstagramItem>();
foreach (JToken token in data)
{
InstagramItem item = new InstagramItem();
item.id = token["id"].Value<string>();
item.commentsCount = token["comments"]["count"].Value<int>();
item.likesCount = token["likes"]["count"].Value<int>();
@anuith
anuith / gist:2984714
Created June 24, 2012 20:08
Windows Phone Hackathon : Facebook & Instagram Sample - Instagram Code - SelectionChanged
private void ListBox_Feed_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
ListBox listbox = sender as ListBox;
App currentApp = App.Current as App;
currentApp.CurrentInstagramItem = listbox.SelectedItem as InstagramItem;
NavigationService.Navigate(
new Uri("/InstagramItemPage.xaml", UriKind.Relative));
}
@anuith
anuith / gist:2984722
Created June 24, 2012 20:10
Windows Phone Hackathon : Facebook & Instagram Sample - Instagram Code - Instagram Item Page Loaded
public InstagramItemPage()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(InstagramItemPage_Loaded);
}
private void InstagramItemPage_Loaded(object sender, RoutedEventArgs e)
{
App currentApp = App.Current as App;
this.DataContext = currentApp.CurrentInstagramItem;
@anuith
anuith / gist:2984726
Created June 24, 2012 20:11
Windows Phone Hackathon : Facebook & Instagram Sample - ShareTask UI
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle"
@anuith
anuith / gist:2984728
Created June 24, 2012 20:11
Windows Phone Hackathon : Facebook & Instagram Sample - ShareTask Code
private void ShareStatus_Click(object sender, System.Windows.RoutedEventArgs e)
{
ShareStatusTask task = new ShareStatusTask();
task.Status = TextBox_Status.Text; // get status text from TextBox_Status
task.Show();
}
private void ShareLink_Click(object sender, System.Windows.RoutedEventArgs e)
{
ShareLinkTask task = new ShareLinkTask();