Exemplo n.º 1
0
 private async void SharedItem_Tapped(object sender, TappedRoutedEventArgs e)
 {
     try {
         Grid grid = sender as Grid;
         SharedItemsListElement item = grid.DataContext as SharedItemsListElement;
         if (item.UserID == App.DataClient.GetMyFacebookUserID())
         {
             MessageDialog dialog = new MessageDialog("Would you like to view your item or delete it?");
             dialog.Commands.Add(new UICommand("View", new UICommandInvokedHandler((cmd) => LaunchURL(item.URL))));
             dialog.Commands.Add(new UICommand("Delete", new UICommandInvokedHandler((cmd) => DeleteAndClosePopup(item))));
             dialog.Commands.Add(new UICommand("Cancel"));
             await dialog.ShowAsync();
         }
         else
         {
             MessageDialog dialog = new MessageDialog("Would you like to view this item?");
             dialog.Commands.Add(new UICommand("View", new UICommandInvokedHandler((cmd) => LaunchURL(item.URL))));
             dialog.Commands.Add(new UICommand("Cancel"));
             await dialog.ShowAsync();
         }
     } catch (Exception) {
         MessageDialog dialog = new MessageDialog("Error occurred when getting shared item!");
         dialog.Commands.Add(new UICommand("Ok"));
         dialog.ShowAsync();
     }
 }
Exemplo n.º 2
0
 private void DeleteAndClosePopup(SharedItemsListElement item)
 {
     App.DataClient.DeleteItem(item.SharedItem);
     HideUserDetailsPopup();
 }