示例#1
0
        private async void ExtraToolsSelected(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count > 0)
            {
                var item = (ListBoxItem)e.AddedItems[0];
                var viewMediaMetadata = (ViewMediaMetadata)item.DataContext;
                switch (item.Content)
                {
                case "Delete Media":
                    await DeleteMedia(viewMediaMetadata.YID, viewMediaMetadata.MediaType);

                    OnMediaDeleted?.Invoke(null, null);
                    break;

                case "Open LiveTile Editor": OpenImagesEditor(viewMediaMetadata); break;

                case "Pin to Start": break;

                case "Open in YouTube": OnOpenUrl.Invoke(null, new LaunchUrlEventArgs()
                    {
                        Url = $"{App.youtubeHomeUrl}/watch?v={viewMediaMetadata.YID}"
                    }); break;

                case "Copy URL to Clipboard": CopyUrlToClipboard($"{App.youtubeHomeUrl}/watch?v={viewMediaMetadata.YID}"); break;
                }
            }
            if (sender is ListBox)
            {
                ((ListBox)sender).SelectedIndex = -1;
            }
            XamlHelper.CloseFlyout(sender);
        }
示例#2
0
 private void OnPlaylistSelected(object sender, EventArgs e)
 {
     XamlHelper.CloseFlyout(sender);
     if (e is PlaylistSelectedEventArgs && sender is FrameworkElement)
     {
         var uie = (FrameworkElement)sender;
         if (uie != null && uie.DataContext is ViewMediaMetadata)
         {
             var playlistSelectedEventArgs = (PlaylistSelectedEventArgs)e;
             var viewMediaMetadata         = (ViewMediaMetadata)uie.DataContext;
             EntitiesHelper.AddPlaylistMediaMetadata(viewMediaMetadata.UniqueId, playlistSelectedEventArgs.SelectedPlaylist.UniqueId);
             OnMediaAddedToPlaylist?.Invoke(null, null);
         }
     }
 }