منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
كيفية عمل History في ميديا بلير - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : كيفية عمل History في ميديا بلير (/showthread.php?tid=9845)



كيفية عمل History في ميديا بلير - W XP 2003 - 30-07-13

اريد عمل History يعمل في ميديا بلير ؟
هذا كان استخدم كود : AxWindowsMediaPlayer1.URL = "..."
حيث ان عندي ادوات :

TreeView1 : يكون فيها قنوات , واريد اي قناة تعمل في ميدابلير تسجل في ListBox1


كيفية عمل History في ميديا بلير - W XP 2003 - 31-07-13

ممكن مساعده


كيفية عمل History في ميديا بلير - kslawy - 31-07-13

السلام عليكم ورحمة الله وبركاته

هذه فكرة عامة لعمل ذلك :

كود :
Public Class Form1


    Dim historyPath As String = Application.StartupPath & "\history.txt"


    Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
        Dim ofd As New OpenFileDialog
        If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
            Me.AxWindowsMediaPlayer1.URL = ofd.FileName
            Me.AxWindowsMediaPlayer1.Ctlcontrols.play()
            Add2History(ofd.FileName) ' إضافة الملف المفتوح للهيستوري
            LoadHistroy()
        End If
    End Sub


    Private Sub Add2History(ByVal fname As String) ' دالة إضافة ملف للهيستوري
        Try
            If IO.File.Exists(historyPath) = False Then
                IO.File.CreateText(historyPath).Close()  ' إذا لم يُعثر علي الملف سيتم إنشاءه ثم إغلاقه
            End If
            My.Computer.FileSystem.WriteAllText(historyPath, fname & vbCrLf, True)
        Catch ex As Exception
            MsgBox(ex.Message, 48, "Add2History")
        End Try
    End Sub


    Private Sub LoadHistroy() ' دالة تحميل ملفات الهيستوري وإضافتها لأداة الليست بوكس
        Try
            If IO.File.Exists(historyPath) = False Then
                IO.File.CreateText(historyPath).Close()  ' إذا لم يُعثر علي الملف سيتم إنشاءه ثم إغلاقه
            End If
            Dim files() As String = IO.File.ReadAllLines(historyPath) 'قراءة جميع الملفات المحفوظة في ملف الهيستوري
            If files.Length > 0 Then '
                Me.ListBox1.Items.Clear()
                For Each itm As String In files
                    If itm <> "" Then
                        Me.ListBox1.Items.Add(itm) ' إضافة الملفات لأداة الليست بوكس
                    End If
                Next
            End If
        Catch ex As Exception
            MsgBox(ex.Message, 48, "LoadHistroy")
        End Try
    End Sub


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadHistroy() ' تحميل الهيستوري عند فتح النموذج
    End Sub


    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        Try ' لتشغيل الملفات الموجودة في الهيستوري
            If Me.ListBox1.Items.Count > 0 Then
                If Me.ListBox1.SelectedItems IsNot Nothing Then
                    Me.AxWindowsMediaPlayer1.URL = Me.ListBox1.SelectedItem.ToString
                    Me.AxWindowsMediaPlayer1.Ctlcontrols.play()
                End If
            End If
        Catch ex As Exception
            MsgBox(ex.Message, 48, "Play from Histroy")
        End Try
    End Sub
End Class

****
***
**
*


كيفية عمل History في ميديا بلير - W XP 2003 - 01-08-13

يااخي ما يعمل الكود معي


كيفية عمل History في ميديا بلير - kslawy - 01-08-13

إذا كنت بتعمل علي ويندوز 7 اعطي برنامج صلاحيات مدير النظام