How to retrieve Facebook image description - windows-phone-8

I am developing windows phone application. I am retrieving event images from Facebook.
Problem:
how to take detail information about the event like date place of image by clicking on that image

If you are using listbox then
private void YourList_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
FaceBookClass fbc = YourEventList.SelectedItem as FaceBookClass ;
String date=fbc.Date;
String place=fbc.Place;
}

Related

share option in windows phone app

i wanna provide share option from my windows app to another apps in my windows phone, like android develpement. please any one tell, is it possible in windows phone. (using RT, not in silver Light) Thank You in advance.
For example: like the below image
I am using below code using "How to use ShareLinkTask namespace in Windows Phone 8.1?" link.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
DataTransferManager dtManager = DataTransferManager.GetForCurrentView();
dtManager.DataRequested += dtManager_DataRequested;
}
private async void dtManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
e.Request.Data.Properties.Title = "Code Samples";
e.Request.Data.Properties.Description = "Here are some great code samples for Windows Phone.";
e.Request.Data.SetWebLink(new Uri("http://code.msdn.com/wpapps"));
}
// Click Button to share Web Link
private void btnShareLink_Click(object sender, RoutedEventArgs e)
{
Windows.ApplicationModel.DataTransfer.DataTransferManager.ShowShareUI();
}
but it displays a progress bar with a message Preparing content to share and then it disappears, with no UI for sharing.
what should I do.please help me.

How to keep AutoSuggestBox suggestion box open in Windows Phone 8.1

Using the new AutoSuggestBox control in Windows Phone 8.1 (WinRT XAML), I am trying to keep the suggestion box open all the time -- even after the user clicks a suggestion.
I have no problem starting with the suggestion box open by programmatically setting AutoSuggestBox.IsSuggestionListOpen = true;
Then I hook the SuggestionChosen event like this:
private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args) {
sender.Text = args.SelectedItem.ToString();
sender.IsSuggestionListOpen = true;
}
But unfortunately the suggestion box still closes after selecting an item, even though I set IsSuggestionListOpen to true.
Any help with getting it to stay open after a selection would be appreciated.
The solution I found to this is to hook the LayoutUpdated event.
I have the AutoSuggestBox in a PickerFlyout, so I only want the suggestion box open if the PickerFlyout is open (obviously). So I set a Tag property on the button that opens the PickerFlyout to identify if the PickerFlyout is open or closed. Then in the LayoutUpdated event of the AutoSuggestBox I set the IsSuggestionListOpen property to true if the PickerFlyout is open (and false if it's not).
The code:
private void PickerFlyout_Opened(object sender, object e) {
ActivatePickerFlyoutButton.Tag = "open";
}
private void PickerFlyout_Closed(object sender, object e) {
ActivatePickerFlyoutButton.Tag = "closed";
}
private void AutoSuggestBox_LayoutUpdated(object sender, object e) {
AutoSuggestBox.IsSuggestionListOpen = ((ActivatePickerFlyoutButton.Tag as string).Equals("open"));
}
That is the only place I need to set the IsSuggestionListOpen property, since the LayoutUpdated event fires at all the right times.

How do you debug PhotoTaskChooser in WP8 on a physical device?

I have the simplest possible app. The UI is a page with nothing on it but a Tap method on a grid.
The code-behind looks like this...
public partial class MainPage : PhoneApplicationPage
{
private PhotoChooserTask _photoChooser;
// Constructor
public MainPage()
{
InitializeComponent();
_photoChooser.Completed += OnPhotoChosen;
}
private void OnTap(object sender, System.Windows.Input.GestureEventArgs e)
{
_photoChooser.Show();
}
private void OnPhotoChosen(object sender, PhotoResult result)
{
}
}
Now, what happens is that when I debug this application ON THE DEVICE, it briefly shows the photo chooser but then immediately deactivates...I assume because the photo chooser has taken focus. But from everything I've read, this should NOT be happening because the PhotoChooserTask's Completed event has been wired up in the constructor for my page, which should explicitly prevent my app from deactivating when the photochooser is active.
What's even more confusing is that the app seems to work when I'm NOT debugging it. Once I've selected a photo in this scenario, my app regains the foreground.
Is this a bug with the debugger or something else?
So it turns out the solution is to debug using "Start New Instance" in Visual Studio rather than just hitting F5.

Button in ListBox sending parameters from JSON

In the Windows Phone 7.5 application I'm creating, I've got a problem with binding a navigationservice to a button. The button is inside a ListBox datatemplate in XAML, which is populated from codebehind from a JSON deserializer:
void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error != null)
{
return;
}
List<JSON> newslistJson = JsonConvert.DeserializeObject<List<JSON>>(e.Result);
this.NewsList.ItemsSource = newslistJson;
}
The NewsList listbox is here populated via the code above, and a class file containing and the "getters" and "setters". However, inside the ListBox and it's DataTemplate, as stated earlier, there's a button:
<Button x:Name="toNewsSite" Grid.Row="1" Content="Read MoreĀ»" Height="auto" Width="auto" FontSize="19" Foreground="#FFFFFF"/>
This button should, via the first code snippet, navigate to each of the items' news_id, which is a string in the class file handling the public getters and setters.
So my dream scenario here would be, in codebehind, something like this inside the webClient_DownloadString...():
toNewsSite.NavigateService = ("TheNewPage.xaml/news?id={0}", JSON.news_id);
Aaand from there each of the news items in the listbox will have an individual button with a parameter stating which news_id it has, which will be fetched on the "TheNewPage" page.
Would this actually work?
First of all, Button control do not have any NavigationService. Inorder to navigate to navigate to a new page, you need to call NavigationService.Navigate() method
So, What i would do is to bind the id to the Tag of the Button
<Button x:Name="toNewsSite" Grid.Row="1" Click="OnButtonClick" Tag="{Binding news_id}" Content="Read MoreĀ»" Height="auto" Width="auto" FontSize="19" Foreground="#FFFFFF"/>
private void OnButtonClick(object sender, RoutedEventArgs e)
{
Button bt = (Button)sender;
NavigationService.Navigate(new Uri("TheNewPage.xaml/news?id=" + bt.Tag.ToString(), UriKind.Relative));
}
In the click handler for the button grab the DataContext of the button and you'll be able to access the
private void OnButtonClick(object sender, RoutedEventArgs e)
{
JSON item = (sender as FrameworkElement).DataContext;
NavigationService.Navigate(new Uri("TheNewPage.xaml/news?id=" + item.news_id, UriKind.Relative));
}
As a further improvement, rather than adding a button to the ItemTemplate, I'd handle the tap event of whatever you put at the root of the DataTemplate (I'd guess a Grid or StackPanel).

how to display a video from a JList?

I am currently doing an application using Swing and i am stuck at a certain point. In my function, i have to link videos from a JList. The problem is i am not sure how to link the videos from the JList. I am using an OpenBrowser class to link the video to the internet. I did consider using JButton but i would have to hardcode it and that would be ugly. Is there any other alternatives to do this? I am in desperate need and would be eternally grateful to whoever that can help me.
Safa :)
If you don't want to open a browser with the video using a selection listener, you can consider the idea of launching it with a double click on a JList entry.
sample code
String[] items = {"i1", "i2", "i3", "i4"};
JList list = new JList(items);
list.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
JList list = (JList)evt.getSource();
if (evt.getClickCount() == 2) { //check if it is a Double-click
int index = list.locationToIndex(evt.getPoint());
// do whatever you want with the entry at that index
}
}
});
Desktp classes to browse some site (sample code):
if (desktop.isSupported(Desktop.Action.BROWSE)) {
URI uri = new URI("http://www.google.com");
desktop.browse(uri);
}
The desktop.browse() call will open your favourite browser with the given URL.