Σάββατο, 26 Ιουνίου 2010

VB.NET-DVDPlayer

Public Class Form1
Private Sub ExitProgram(ByVal caption As String, ByVal text As String)
Try
Dim answer As DialogResult
answer = MessageBox.Show(text, caption, MessageBoxButtons.OKCancel)
If (answer = Windows.Forms.DialogResult.OK) Then
Application.Exit()
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
DVDPlayer.Dock = DockStyle.Fill
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
Dim about As New AboutBox1
about.Visible = True
End Sub

Private Sub ΠλήρηςΠροβολήToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΠλήρηςΠροβολήToolStripMenuItem.Click
Try
Me.WindowState = FormWindowState.Maximized
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Private Sub ΠροβολήΕμφάνισηςToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΠροβολήΕμφάνισηςToolStripMenuItem.Click
Try
Me.WindowState = FormWindowState.Normal
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Private Sub ΕξοδοςToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΕξοδοςToolStripMenuItem.Click
ExitProgram("Εξοδος στο Λειτουργικό Σύστημα", "Είσαι σίγουρος ?")
End Sub

Private Sub ΠροηγούμενοToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΠροηγούμενοToolStripMenuItem.Click
Try
DVDPlayer.Ctlcontrols.previous()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Private Sub ΕπόμενοToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΕπόμενοToolStripMenuItem.Click
Try
DVDPlayer.Ctlcontrols.next()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Private Sub ΕπαναφοράToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΕπαναφοράToolStripMenuItem.Click
Try
DVDPlayer.dvd.resume()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Private Sub ΓρήγορηΠροώθησηToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΓρήγορηΠροώθησηToolStripMenuItem.Click
Try
DVDPlayer.Ctlcontrols.fastForward()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Private Sub ΑναπαραγωγήToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΑναπαραγωγήToolStripMenuItem.Click
Try
DVDPlayer.Ctlcontrols.play()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Private Sub ΔιακοπήToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΔιακοπήToolStripMenuItem.Click
Try
DVDPlayer.Ctlcontrols.stop()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Private Sub ΑύξησηToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΑύξησηToolStripMenuItem.Click
Try
DVDPlayer.settings.volume = DVDPlayer.settings.volume + 10
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Private Sub ΜείωσηToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΜείωσηToolStripMenuItem.Click
Try
DVDPlayer.settings.volume = DVDPlayer.settings.volume - 10
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Private Sub ΣίγασηToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΣίγασηToolStripMenuItem.Click
Try
DVDPlayer.settings.mute = True
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Private Sub ΑνοιγμαToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ΑνοιγμαToolStripMenuItem.Click
Try
OpenFileDialog1.FileName = "*.vob"
OpenFileDialog1.Filter = "VOB Files|*.vob|All Files|*.*"
Dim dlg As DialogResult = OpenFileDialog1.ShowDialog()
If (dlg = Windows.Forms.DialogResult.OK) Then
DVDPlayer.URL = OpenFileDialog1.FileName
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class