Advertisement
DrAungWinHtut

MediaPlayer Testing in CS

Mar 14th, 2022
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.IO;
  11. using System.Diagnostics;
  12.  
  13. namespace MyMediaPlayer
  14. {
  15. public partial class frmPlayer : Form
  16. {
  17. string sPath;
  18. public frmPlayer()
  19. {
  20. InitializeComponent();
  21. }
  22.  
  23. private void btnLoadFileList_Click(object sender, EventArgs e)
  24. {
  25. sPath = txtPath .Text;
  26. string[] saSplited;
  27. int iSize = 0;
  28. if (Directory .Exists(sPath))
  29. {
  30. string[] saFileList = Directory.GetFiles(sPath);
  31. foreach (string sFile in saFileList)
  32. {
  33. saSplited = sFile .Split ('\\');
  34. iSize = saSplited .Length;
  35. lstFileList.Items.Add(saSplited [iSize -1]);
  36. }
  37. }
  38. else
  39. {
  40. MessageBox.Show("Error!, Invalid path, try again!");
  41. txtPath .SelectAll();
  42. txtPath .Focus ();
  43. }
  44.  
  45. }
  46.  
  47. private void lstFileList_SelectedIndexChanged(object sender, EventArgs e)
  48. {
  49. string pathVLC = @"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe";
  50. //wmpPlayer .URL = sPath + "\\" + lstFileList .SelectedItem .ToString ();
  51. // Process.Start(@"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe", @"D:\Kid Lesson 1 - Hello World.mp4");
  52. //Process VLC = new Process();
  53. //VLC.StartInfo.FileName = pathVLC;
  54. //VLC.StartInfo.Arguments = "\"" + sPath + "\\" + lstFileList.SelectedItem.ToString() + "\"";
  55. //VLC.Start();
  56.  
  57. Process.Start(@"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe", "\"" + sPath + "\\" + lstFileList.SelectedItem.ToString() + "\"");
  58. }
  59. }
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement