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.Text;
- using System.Windows.Forms;
- using System.IO;
- using WMPLib;
- namespace Mp3Player
- {
- public partial class Form1 : Form
- {
- IWMPMedia WmpMedia;
- public Form1()
- {
- InitializeComponent();
- Player.uiMode = "None";
- }
- private void btnAdd_Click(object sender, EventArgs e)
- {
- if (openFileDialog1.ShowDialog() == DialogResult.OK)
- {
- string[] FileN = openFileDialog1.FileNames;
- foreach (string N in FileN)
- {
- lbPlaylist.Items.Add(Path.GetFileNameWithoutExtension(N));
- WmpMedia = Player.newMedia(N);
- Player.currentPlaylist.appendItem(WmpMedia);
- }
- Player.Ctlcontrols.play();
- Player.URL = "";
- }
- }
- private void btnNext_Click(object sender, EventArgs e)
- {
- Player.Ctlcontrols.next();
- }
- private void btnPre_Click(object sender, EventArgs e)
- {
- Player.Ctlcontrols.previous();
- }
- private void btnPlay_Click(object sender, EventArgs e)
- {
- Player.Ctlcontrols.play();
- }
- private void btnPause_Click(object sender, EventArgs e)
- {
- Player.Ctlcontrols.pause();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- tbVol.Value = Player.settings.volume;
- }
- private void tbVol_Scroll(object sender, EventArgs e)
- {
- Player.settings.volume = tbVol.Value;
- }
- private void Player_MediaError(object sender, AxWMPLib._WMPOCXEvents_MediaErrorEvent e)
- {
- MessageBox.Show("Can't play this file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- private void Player_CurrentItemChange(object sender, AxWMPLib._WMPOCXEvents_CurrentItemChangeEvent e)
- {
- lbPlay.Text = Player.currentMedia.name + " " + Player.currentMedia.durationString;
- }
- private void btnFF_Click(object sender, EventArgs e)
- {
- try
- {
- Player.settings.rate++;
- }
- catch
- {
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- Player.settings.rate--;
- }
- catch
- {
- }
- }
- private void lbPlaylist_DoubleClick(object sender, EventArgs e)
- {
- try
- {
- int idx = lbPlaylist.SelectedIndex;
- WmpMedia = Player.currentPlaylist.get_Item(idx);
- if (Player.currentMedia.name != WmpMedia.name)
- {
- Player.Ctlcontrols.playItem(WmpMedia);
- }
- }
- catch
- {
- }
- }
- private void lbPlaylist_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement