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: 11496" data-attributes="member: 10535"><p>Ok,</p><p></p><p>I also wrote it in C#. I guess that this is better.</p><p></p><p>[code]</p><p>using System;</p><p>using System.Collections;</p><p>using System.Threading;</p><p>using System.Windows.Forms;</p><p>using MediaPortal.GUI.Library;</p><p>using MediaPortal.Util;</p><p>using MediaPortal.Dialogs;</p><p></p><p>namespace MPProgressPlugin</p><p>{</p><p> /// <summary></p><p> /// Zusammenfassung für Class1.</p><p> /// </summary></p><p> public class ProgressPlugin: IPlugin, ISetupForm</p><p> {</p><p> public ProgressPlugin()</p><p> {</p><p> //</p><p> // TODO: Fügen Sie hier die Konstruktorlogik hinzu</p><p> //</p><p> }</p><p></p><p></p><p> public void Start()</p><p> {</p><p> ProgressDialog();</p><p> }</p><p></p><p> void ProgressDialog()</p><p> {</p><p> try</p><p> {</p><p> GUIDialogProgress dlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS);</p><p> if (dlgProgress != null)</p><p> {</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> }</p><p></p><p> }</p><p> catch(Exception e)</p><p> { </p><p> MessageBox.Show(e.ToString(), "Error",</p><p> MessageBoxButtons.OK, MessageBoxIcon.Exclamation);</p><p> Log.Write(e.ToString());</p><p> }</p><p></p><p></p><p> }</p><p></p><p> public void Stop()</p><p> { </p><p> }</p><p></p><p> #region ISetupForm Members</p><p></p><p> public bool CanEnable()</p><p> {</p><p> return true;</p><p> }</p><p></p><p> public string PluginName()</p><p> {</p><p> return "Progress Dialog";</p><p> }</p><p></p><p> public bool HasSetup()</p><p> {</p><p> return true;</p><p> }</p><p> public bool DefaultEnabled()</p><p> {</p><p> return true;</p><p> }</p><p></p><p> public int GetWindowId()</p><p> {</p><p> return 23002;</p><p> }</p><p></p><p> public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)</p><p> {</p><p> strButtonText = "Progress Dialog";</p><p> strButtonImage = "";</p><p> strButtonImageFocus = "";</p><p> strPictureImage = "";</p><p> return false;</p><p> }</p><p></p><p> public string Author()</p><p> {</p><p> return "STSC";</p><p> }</p><p></p><p> public string Description()</p><p> {</p><p> return "Progress Dialog";</p><p> }</p><p></p><p> public void ShowPlugin() // show the setup dialog</p><p> {</p><p> } </p><p></p><p> #endregion</p><p> }</p><p>}</p><p>[/code]</p><p></p><p>But this line</p><p></p><p>[code]GUIDialogProgress dlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS);</p><p>[/code]</p><p></p><p>still causes an System.InvalidCastException?</p><p></p><p>[USER=10277]frodo[/USER]: Do you know why it doesn't work?</p></blockquote><p></p>
[QUOTE="STSC, post: 11496, member: 10535"] Ok, I also wrote it in C#. I guess that this is better. [code] using System; using System.Collections; using System.Threading; using System.Windows.Forms; using MediaPortal.GUI.Library; using MediaPortal.Util; using MediaPortal.Dialogs; namespace MPProgressPlugin { /// <summary> /// Zusammenfassung für Class1. /// </summary> public class ProgressPlugin: IPlugin, ISetupForm { public ProgressPlugin() { // // TODO: Fügen Sie hier die Konstruktorlogik hinzu // } public void Start() { ProgressDialog(); } void ProgressDialog() { try { GUIDialogProgress dlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); if (dlgProgress != null) { 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); } } catch(Exception e) { MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Log.Write(e.ToString()); } } public void Stop() { } #region ISetupForm Members public bool CanEnable() { return true; } public string PluginName() { return "Progress Dialog"; } public bool HasSetup() { return true; } public bool DefaultEnabled() { return true; } public int GetWindowId() { return 23002; } public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) { strButtonText = "Progress Dialog"; strButtonImage = ""; strButtonImageFocus = ""; strPictureImage = ""; return false; } public string Author() { return "STSC"; } public string Description() { return "Progress Dialog"; } public void ShowPlugin() // show the setup dialog { } #endregion } } [/code] But this line [code]GUIDialogProgress dlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); [/code] still causes an System.InvalidCastException? [USER=10277]frodo[/USER]: Do you know why it doesn't work? [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
WindowsProgressDialog in process plugin
Contact us
RSS
Top
Bottom