home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
WindowsProgressDialog in process plugin
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="STSC" data-source="post: 11454" data-attributes="member: 10535"><p>Hi,</p><p></p><p>does anybody know how to call a WindowsProgressDialog in a process plugin?</p><p></p><p>I always get this error: System.InvalidCastException: Specified cast is not valid. </p><p></p><p>Here is my code:</p><p></p><p>[code]</p><p>Imports MediaPortal.Dialogs</p><p></p><p>Public Class DialogProgressPlugin</p><p> Implements MediaPortal.GUI.Library.IPlugin, MediaPortal.GUI.Library.ISetupForm</p><p></p><p> Public Const WINDOW_DialogProgressPLUGIN = 6202 'a window ID shouldn't be needed when a non visual plugin ?!</p><p> Private EPGTimer As System.Threading.Timer</p><p></p><p> Public Sub Start() Implements MediaPortal.GUI.Library.IPlugin.Start</p><p> Dim timerDelegate As System.Threading.TimerCallback = AddressOf WindowsProgressDialog</p><p> EPGTimer = New System.Threading.Timer(timerDelegate, Nothing, 500, 15000)</p><p></p><p> End Sub</p><p></p><p> Public Sub WindowsProgressDialog(ByVal stateInfo As Object)</p><p></p><p> 'Create dialog to show progress</p><p> Try</p><p> Dim dlgProgress As MediaPortal.Dialogs.GUIDialogProgress = CType(MediaPortal.GUI.Library.GUIWindowManager.GetWindow(CType(MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_DIALOG_PROGRESS, Integer)), MediaPortal.Dialogs.GUIDialogProgress)</p><p> If (Not dlgProgress Is Nothing) Then</p><p> dlgProgress.SetHeading("DialogHeading")</p><p> dlgProgress.SetLine(1, "DialogLine1")</p><p> dlgProgress.SetLine(2, "DialogLine2")</p><p> dlgProgress.SetLine(3, "DialogLine3")</p><p> dlgProgress.StartModal(MediaPortal.GUI.Library.GUIWindowManager.ActiveWindow)</p><p> dlgProgress.SetPercentage(0)</p><p> dlgProgress.Progress()</p><p> dlgProgress.ShowProgressBar(True)</p><p> End If</p><p></p><p> Dim iCounter As Integer = 0</p><p></p><p> While iCounter <= 100</p><p> dlgProgress.SetPercentage(iCounter)</p><p> Threading.Thread.Sleep(100)</p><p> iCounter += 1</p><p> End While</p><p></p><p></p><p> dlgProgress.Close()</p><p></p><p> Catch ex As Exception</p><p> MsgBox(ex.ToString)</p><p></p><p> End Try</p><p></p><p> End Sub</p><p> Public Sub [Stop]() Implements MediaPortal.GUI.Library.IPlugin.Stop</p><p></p><p> End Sub</p><p></p><p> Public Function Author() As String Implements MediaPortal.GUI.Library.ISetupForm.Author</p><p> Return "STSC"</p><p> End Function</p><p></p><p> Public Function CanEnable() As Boolean Implements MediaPortal.GUI.Library.ISetupForm.CanEnable</p><p> Return True</p><p> End Function</p><p></p><p> Public Function DefaultEnabled() As Boolean Implements MediaPortal.GUI.Library.ISetupForm.DefaultEnabled</p><p> Return True</p><p> End Function</p><p></p><p> Public Function Description() As String Implements MediaPortal.GUI.Library.ISetupForm.Description</p><p> Return "DialogProgress"</p><p> End Function</p><p></p><p> Public Function GetHome(ByRef strButtonText As String, ByRef strButtonImage As String, ByRef strButtonImageFocus As String, ByRef strPictureImage As String) As Boolean Implements MediaPortal.GUI.Library.ISetupForm.GetHome</p><p> strButtonText = "DialogProgress"</p><p> strButtonImage = ""</p><p> strButtonImageFocus = ""</p><p> strPictureImage = ""</p><p> Return False</p><p> End Function</p><p></p><p> Public Function GetWindowId() As Integer Implements MediaPortal.GUI.Library.ISetupForm.GetWindowId</p><p> Return WINDOW_DialogProgressPLUGIN</p><p> End Function</p><p></p><p> Public Function HasSetup() As Boolean Implements MediaPortal.GUI.Library.ISetupForm.HasSetup</p><p> Return False</p><p> End Function</p><p></p><p> Public Function PluginName() As String Implements MediaPortal.GUI.Library.ISetupForm.PluginName</p><p> Return "DialogProgress"</p><p> End Function</p><p></p><p> Public Sub ShowPlugin() Implements MediaPortal.GUI.Library.ISetupForm.ShowPlugin</p><p> 'no setup form, therefore nothing to do</p><p> End Sub</p><p>End Class</p><p></p><p>[/code]</p><p></p><p>It seeme that this line causes trouble:</p><p></p><p></p><p></p><p></p><p>What's wrong?</p><p></p><p>Thanks!!</p></blockquote><p></p>
[QUOTE="STSC, post: 11454, member: 10535"] Hi, does anybody know how to call a WindowsProgressDialog in a process plugin? I always get this error: System.InvalidCastException: Specified cast is not valid. Here is my code: [code] Imports MediaPortal.Dialogs Public Class DialogProgressPlugin Implements MediaPortal.GUI.Library.IPlugin, MediaPortal.GUI.Library.ISetupForm Public Const WINDOW_DialogProgressPLUGIN = 6202 'a window ID shouldn't be needed when a non visual plugin ?! Private EPGTimer As System.Threading.Timer Public Sub Start() Implements MediaPortal.GUI.Library.IPlugin.Start Dim timerDelegate As System.Threading.TimerCallback = AddressOf WindowsProgressDialog EPGTimer = New System.Threading.Timer(timerDelegate, Nothing, 500, 15000) End Sub Public Sub WindowsProgressDialog(ByVal stateInfo As Object) 'Create dialog to show progress Try Dim dlgProgress As MediaPortal.Dialogs.GUIDialogProgress = CType(MediaPortal.GUI.Library.GUIWindowManager.GetWindow(CType(MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_DIALOG_PROGRESS, Integer)), MediaPortal.Dialogs.GUIDialogProgress) If (Not dlgProgress Is Nothing) Then dlgProgress.SetHeading("DialogHeading") dlgProgress.SetLine(1, "DialogLine1") dlgProgress.SetLine(2, "DialogLine2") dlgProgress.SetLine(3, "DialogLine3") dlgProgress.StartModal(MediaPortal.GUI.Library.GUIWindowManager.ActiveWindow) dlgProgress.SetPercentage(0) dlgProgress.Progress() dlgProgress.ShowProgressBar(True) End If Dim iCounter As Integer = 0 While iCounter <= 100 dlgProgress.SetPercentage(iCounter) Threading.Thread.Sleep(100) iCounter += 1 End While dlgProgress.Close() Catch ex As Exception MsgBox(ex.ToString) End Try End Sub Public Sub [Stop]() Implements MediaPortal.GUI.Library.IPlugin.Stop End Sub Public Function Author() As String Implements MediaPortal.GUI.Library.ISetupForm.Author Return "STSC" End Function Public Function CanEnable() As Boolean Implements MediaPortal.GUI.Library.ISetupForm.CanEnable Return True End Function Public Function DefaultEnabled() As Boolean Implements MediaPortal.GUI.Library.ISetupForm.DefaultEnabled Return True End Function Public Function Description() As String Implements MediaPortal.GUI.Library.ISetupForm.Description Return "DialogProgress" End Function Public Function GetHome(ByRef strButtonText As String, ByRef strButtonImage As String, ByRef strButtonImageFocus As String, ByRef strPictureImage As String) As Boolean Implements MediaPortal.GUI.Library.ISetupForm.GetHome strButtonText = "DialogProgress" strButtonImage = "" strButtonImageFocus = "" strPictureImage = "" Return False End Function Public Function GetWindowId() As Integer Implements MediaPortal.GUI.Library.ISetupForm.GetWindowId Return WINDOW_DialogProgressPLUGIN End Function Public Function HasSetup() As Boolean Implements MediaPortal.GUI.Library.ISetupForm.HasSetup Return False End Function Public Function PluginName() As String Implements MediaPortal.GUI.Library.ISetupForm.PluginName Return "DialogProgress" End Function Public Sub ShowPlugin() Implements MediaPortal.GUI.Library.ISetupForm.ShowPlugin 'no setup form, therefore nothing to do End Sub End Class [/code] It seeme that this line causes trouble: What's wrong? Thanks!! [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
WindowsProgressDialog in process plugin
Contact us
RSS
Top
Bottom