Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- using System.Diagnostics;
- namespace PlayerTest
- {
- public partial class frmPlayer : Form
- {
- string sPath;
- public frmPlayer()
- {
- InitializeComponent();
- }
- private void btnLoadFileList_Click(object sender, EventArgs e)
- {
- sPath = txtPath .Text;
- if(Directory.Exists(sPath))
- {
- string[] saFileList = Directory.GetFiles(sPath);
- string[] saSplitPath;
- foreach (string sFile in saFileList)
- {
- saSplitPath = sFile.Split('\\');
- int iLength = saSplitPath.Length;
- lstFileList.Items.Add(saSplitPath [iLength -1]);
- }
- }
- else
- {
- MessageBox.Show("Invalid Path");
- txtPath .SelectAll ();
- txtPath .Focus ();
- }
- }
- private void lstFileList_SelectedIndexChanged(object sender, EventArgs e)
- {
- string sVlcPath = @"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe";
- string sSelectedVideo = lstFileList.SelectedItem.ToString ();
- string sVideoFile = sPath + "\\" + sSelectedVideo;
- string sVideoFileVlc = "\"" + sPath + "\\" + sSelectedVideo + "\"";
- //wmpPlayer .URL = sVideoFile;
- Process.Start(sVlcPath , sVideoFileVlc);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement