Exemplo n.º 1
0
        public void Playlist_Rename(object sender, RoutedEventArgs e,
                                    TreeView treePlaylist, String fgList)
        {
            MenuItem mi = sender as MenuItem;

            if (mi != null)
            {
                ContextMenu cm = mi.CommandParameter as ContextMenu;
                if (cm != null)
                {
                    TextBlock item = cm.PlacementTarget as TextBlock;
                    if (item != null)
                    {
                        String newName = MyDialog.Prompt("Change playlist name", "Enter the new name :", MyDialog.Size.Normal);
                        if (String.IsNullOrEmpty(newName))
                        {
                            MessageBox.Show("Incorrect name", "Error renaming playlist", MessageBoxButton.OK);
                            return;
                        }
                        _playlistManager.RenamePlaylist(item.Text, newName);
                        _playlistManager.RefreshPlaylists(treePlaylist, fgList);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void ListView_AddPlaylist(object sender, RoutedEventArgs routedEventArgs,
                                         MediaElement media, TreeView treePlaylist, ListView list, String fgList, bool diapo)
        {
            String caption;

            if (diapo)
            {
                caption = "diaporama";
            }
            else
            {
                caption = "playlist";
            }
            String name = MyDialog.Prompt("Create a " + caption, "Enter the " + caption + "'s name", MyDialog.Size.Normal);

            if (String.IsNullOrEmpty(name))
            {
                MessageBox.Show("Incorrect name", "Error creating " + caption, MessageBoxButton.OK);
                return;
            }
            IList selectedListViewItems = list.SelectedItems;
            var   items = selectedListViewItems.Cast <IMyMedia>();

            foreach (var item in items)
            {
                _playlistManager.AddElem(name, item.Path.Replace("\\", "/").Replace(" ", "%20"));
            }
            _playlistManager.RefreshPlaylists(treePlaylist, fgList);
        }
Exemplo n.º 3
0
        /*
         * Event Handler
         */
        public void ChangeTheme_Click(ListView listMusic, ListView listVideo, ListView listImage, TreeView treePlaylist)
        {
            String theme = MyDialog.Prompt("Change theme", "Enter the name of the desired theme", MyDialog.Size.Big);

            if (theme.Equals(""))
            {
                return;
            }
            _templateEngine.SetTheme(theme);
            listMusic.Visibility    = Visibility.Collapsed;
            listVideo.Visibility    = Visibility.Collapsed;
            listImage.Visibility    = Visibility.Collapsed;
            treePlaylist.Visibility = Visibility.Collapsed;
        }
Exemplo n.º 4
0
        public void Playlist_Add(object sender, RoutedEventArgs routedEventArgs,
                                 MediaElement media, TreeView treePlaylist, String fgList)
        {
            String playlistName = MyDialog.Prompt("Add current media to playlist", "Enter the playlist's name", MyDialog.Size.Normal);

            if (String.IsNullOrEmpty(playlistName) || media.Source == null ||
                String.IsNullOrEmpty(media.Source.AbsolutePath))
            {
                MessageBox.Show("Incorrect name", "Error adding to playlist", MessageBoxButton.OK);
                return;
            }
            _playlistManager.AddElem(playlistName, media.Source.AbsolutePath);
            _playlistManager.RefreshPlaylists(treePlaylist, fgList);
        }
Exemplo n.º 5
0
        public void Media_ChangeSpeedRatio(object sender, RoutedEventArgs routedEventArgs, MediaElement media)
        {
            String value = MyDialog.Prompt("Change media settings", "Enter speed ratio desired (0-1) :", MyDialog.Size.Big).Replace(".", ",");

            if (String.IsNullOrEmpty(value))
            {
                return;
            }
            Double tmp = 1;

            try
            {
                tmp = Convert.ToDouble(value);
            }
            catch (Exception e) { Console.WriteLine(e.Message); }
            media.SpeedRatio = tmp;
        }
Exemplo n.º 6
0
        /*
         * Youtube
         */
        public async void Open_Youtube(object sender, RoutedEventArgs routedEventArgs, MediaElement media)
        {
            String videoId = MyDialog.Prompt("Enter the youtube video id",
                                             "for https://www.youtube.com/watch?v=DfKcEehLwm0\n-> Enter \"DfKcEehLwm0\"", MyDialog.Size.Big);

            try
            {
                var url = await YouTube.GetVideoUriAsync(videoId, YouTubeQuality.Unknown);

                if (url != null && url.Uri != null && url.HasVideo)
                {
                    Media.Source = url.Uri;
                    MediaPlayNormal();
                    Console.WriteLine("Open from youtube OK");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error youtube api");
                MessageBox.Show(e.Message, "Error youtube api", MessageBoxButton.OK);
            }
        }
Exemplo n.º 7
0
        public void Music_SearchAlbum(String fgList)
        {
            String search = MyDialog.Prompt("Custom search", "Enter the string to search", MyDialog.Size.Big);

            _library.ApplySearchAlbum(search);
        }