Advertisement
DrAungWinHtut

Video Player

Mar 15th, 2022
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 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 PlayerTest
  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. if(Directory.Exists(sPath))
  27. {
  28. string[] saFileList = Directory.GetFiles(sPath);
  29. string[] saSplitPath;
  30. foreach (string sFile in saFileList)
  31. {
  32. saSplitPath = sFile.Split('\\');
  33. int iLength = saSplitPath.Length;
  34. lstFileList.Items.Add(saSplitPath [iLength -1]);
  35. }
  36. }
  37. else
  38. {
  39. MessageBox.Show("Invalid Path");
  40. txtPath .SelectAll ();
  41. txtPath .Focus ();
  42. }
  43.  
  44. }
  45.  
  46. private void lstFileList_SelectedIndexChanged(object sender, EventArgs e)
  47. {
  48. string sVlcPath = @"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe";
  49. string sSelectedVideo = lstFileList.SelectedItem.ToString ();
  50. string sVideoFile = sPath + "\\" + sSelectedVideo;
  51. string sVideoFileVlc = "\"" + sPath + "\\" + sSelectedVideo + "\"";
  52. //wmpPlayer .URL = sVideoFile;
  53. Process.Start(sVlcPath , sVideoFileVlc);
  54. }
  55. }
  56. }
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement