tify"> {
if (isOpen)
{
_command=«play MediaFile»;
if (loop)
{
_command +=« REPEAT »;
}
mciSendString (_command, null, 0, IntPtr.Zero);
isPause=false;
}
}
public void OpenMP3Player (string sFileName)
{
_command=«open " »+ sFileName +« " type mpegvideo alias MediaFile»;
mciSendString (_command, null, 0, IntPtr.Zero);
isOpen=true;
}
public void StopMP3Player ()
{
if (isOpen)
{
mciSendString («stop MediaFile», null, 0, IntPtr.Zero);
}
}
public void PauseMP3Player ()
{
/ / Якщо грає трек
if (isPause == false)
{
/ / Зупиняємо програвання
mciSendString («pause MediaFile», null, 0, IntPtr.Zero);
isPause=true;
}
}
public void CloseMP3Player ()
{
_command=«close MediaFile»;
mciSendString (_command, null, 0, IntPtr.Zero);
isOpen=false;
}
}
}
ДОДАТОК Б
Реалізація класу DMessage.cs .
namespace DPlayerClasses
{
public class DMessage
{
public enum Constants: short
{
/ / Підказки
HINT_STOP,
HINT_PLAY,
HINT_PAUSE,
HINT_EJECT,
/ / Стани відтворення
STATE_STOP,
STATE_PLAY,
STATE_PAUSE,
STATE_INITIAL_MP3NAME_H,
STATE_INITIAL_MP3NAME,
STATE_INITIAL_TIME_H
}
private readonly int MES_AMOUNT;
private string [] value;
public DMessage ()
{
MES_AMOUNT=Enum.GetValues ??(typeof (Constants)). Length;
value=new string [MES_AMOUNT];
}
public string GetMessage (short type)
{
if (type>=0 && type
{
return value [type];
}
return string.Empty;
}
public ...