Пример #1
0
        private void PlayListMethod(Object obj)
        {
            System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
            dialog.Multiselect = true;
            dialog.Filter      =
                "Audio Files (*.mp3,*.m4a,*.wav,*.aac)|*.mp3|Video Files(*.mp4,*.wmv,*.3gp,*.mkv)|*.mp4|All Files(*.*)|*.*";
            dialog.FilterIndex = 2;
            // MediaPlayerButtonObj = obj as MediaElement;
            dialog.Title = "Add Media Files To PlayList";
            System.Windows.Forms.DialogResult dialogResult = dialog.ShowDialog();

            if (dialogResult == System.Windows.Forms.DialogResult.OK)
            {
                int count_files = 0;
                foreach (string file in dialog.FileNames)
                {
                    try
                    {
                        MediaSource = new Uri(file);
                        playlistLookupDictionary.Add(dialog.SafeFileNames[count_files], MediaSource);
                        PlayListViewCollection.Add(new Uri(dialog.SafeFileNames[count_files], UriKind.Relative));
                        count_files++;
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
        }
Пример #2
0
        private void OpenFileMethod(object obj)
        {
            System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
            dialog.Filter =
                "Audio Files (*.mp3,*.m4a,*.wav,*.aac)|*.mp3|Video Files(*.mp4,*.wmv,*.3gp,*.mkv)|*.mp4|All Files(*.*)|*.*";
            dialog.FilterIndex = 2;
            // MediaPlayerButtonObj = obj as MediaElement;

            System.Windows.Forms.DialogResult dialogResult = dialog.ShowDialog();
            if (dialogResult == System.Windows.Forms.DialogResult.OK)
            {
                MediaSource = new Uri(dialog.FileName);
                try
                {
                    playlistLookupDictionary.Add(dialog.SafeFileName, MediaSource);
                    PlayListViewCollection.Add(new Uri(dialog.SafeFileName, UriKind.Relative));
                }
                catch (Exception e)
                {
                }
            }
        }
Пример #3
0
        private void OpenFileMethod(object obj)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter      = "Audio Files (*.mp3,*.m4a,*.wav,*.aac)|*.mp3|Video Files(*.mp4,*.wmv,*.3gp,*.mkv)|*.mp4|All Files(*.*)|*.*";
            dialog.FilterIndex = 1;
            dialog.Multiselect = true;
            // MediaPlayerButtonObj = obj as MediaElement;

            DialogResult dialogResult = dialog.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                foreach (var filesName in dialog.SafeFileNames)
                {
                    if (playlistLookupDictionary.ContainsKey(filesName))
                    {
                    }
                    playlistLookupDictionary.Add(filesName, MediaSource);
                    PlayListViewCollection.Add(new Uri(filesName, UriKind.Relative));
                }
                MediaSource = new Uri(dialog.FileName);
            }
        }