using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Threading;
namespace EE_Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
axWindowsMediaPlayer1.StatusChange += new EventHandler(axWindowsMediaPlayer1_StatusChange);
}
void axWindowsMediaPlayer1_StatusChange(object sender, EventArgs e)
{
// Restart playing all items in playlist
axWindowsMediaPlayer1.Ctlcontrols.play();
}
private void button1_Click(object sender, EventArgs e)
{
//ProcessStartInfo startInfo = new ProcessStartInfo();
//startInfo.FileName = "CCleaner.EXE";
////startInfo.Arguments = f;
//Process.Start(startInfo);
}
private void btnPlay_Click(object sender, EventArgs e)
{
// Creating PlayList
WMPLib.IWMPPlaylist plist = axWindowsMediaPlayer1.newPlaylist("MyPlayList", "");
DirectoryInfo di = new DirectoryInfo(@"D:\Zodes");
foreach (FileInfo file in di.GetFiles("*", SearchOption.AllDirectories))
{
if (file.Extension.Equals(".bmp") || file.Extension.Equals(".jpg") ||
file.Extension.Equals(".mpeg") || file.Extension.Equals(".wmv") || file.Extension.Equals(".avi"))
{
plist.appendItem(axWindowsMediaPlayer1.newMedia(file.FullName));
axWindowsMediaPlayer1.currentPlaylist = plist;
}
if (axWindowsMediaPlayer1.currentPlaylist.count > 0)
{
axWindowsMediaPlayer1.Ctlcontrols.playItem(axWindowsMediaPlayer1.currentPlaylist.get_Item(0));
}
}
}
}
}
|