Home » » C# – Windows Media Player uygulaması

C# – Windows Media Player uygulaması



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;// eğer bunu eklmezsek program hata verir

namespace WindowsFormsApplication4
{
 public partial class Form1 : Form
 {
 public Form1()
 {
 InitializeComponent();
 }
 string yollar;
 private void button1_Click(object sender, EventArgs e)
 {
 // folderbroserdialogta ok tuşuna basıldımı diye kontrol eder oka basıldıysa altaki kodlar geçekleşir
 if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
 {
 // seçilen dosyanın uzantısını bulur örnek D:\MÜZİKLER
 yollar = folderBrowserDialog1.SelectedPath;
 //bulunan uzantının içindeki dosya bilgilerini alır örnek şarkı adı.....MP3
 DirectoryInfo uzantıbilgisi = new DirectoryInfo(yollar);
 //dosya bilgisini diziye atıyoruz
 FileInfo[] dosyabilgisi=uzantıbilgisi.GetFiles();
 //dosya bilgisini diziye yazdırdık
 listBox1.Items.AddRange(dosyabilgisi);
 }
 }

 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
 string a, b;
 // şarkı...MP3 bilsini  \şarkı....MP3  yaptık
 a = "\\" + listBox1.Text;
 // budada dosya uzantısıyla a değişkenin birleştirdik D:\MÜZİKLER\ŞARKI....MP3 OLDU
 b = yollar + a;
 //uzantıyı çalmsı için media playere yolladık
 axWindowsMediaPlayer1.URL = b;
 }
 }
}
 
Support : Vaganzi
Copyright © 2013. Visual Studio Kod Bankası - All Rights Reserved
Powered By Vaganzi