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
Development
General Development (no feature request here!)
file.exists problem
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="IanJ" data-source="post: 751186" data-attributes="member: 107764"><p>Hi,</p><p></p><p>Yes thats exactly what I'm trying to do.</p><p></p><p>However, more progress..............so, I managed to modify the buttons to do what I wanted them to do, but the code I added for remembering the last pressed doesn't work because where I put it isn't being run.......!</p><p>I am basically using the demo here and thought I had identified a part of the code that was repeatedly being run, a main loop if you will......but obviously not!</p><p></p><p>So, can anyone tell me what part of the following code is looping when the page is accessed.....</p><p></p><p>Jings!, C# is different to C++ on Arduino's eh!.......I can't believe I am being stumped by such a small thing!!!</p><p></p><p>[CODE]</p><p>using System;</p><p>using System.Windows.Forms;</p><p>using MediaPortal.GUI.Library;</p><p>using MediaPortal.Dialogs;</p><p></p><p>namespace OurPlugin</p><p>{</p><p> public class Class1 : GUIWindow, ISetupForm</p><p> {</p><p> [SkinControlAttribute(2)] protected GUIButtonControl buttonOne=null;</p><p> [SkinControlAttribute(3)] protected GUIButtonControl buttonTwo=null;</p><p></p><p> public Class1()</p><p> {</p><p></p><p> }</p><p></p><p> #region ISetupForm Members</p><p></p><p> // Returns the name of the plugin which is shown in the plugin menu</p><p> public string PluginName()</p><p> {</p><p> return "MyFirstPlugin";</p><p> }</p><p></p><p> // Returns the description of the plugin is shown in the plugin menu</p><p> public string Description()</p><p> {</p><p> return "My First plugin tutorial";</p><p> }</p><p></p><p> // Returns the author of the plugin which is shown in the plugin menu</p><p> public string Author()</p><p> {</p><p> return "Frodo";</p><p> }</p><p></p><p> // show the setup dialog</p><p> public void ShowPlugin()</p><p> {</p><p> MessageBox.Show("Nothing to configure, this is just an example");</p><p> }</p><p></p><p> // Indicates whether plugin can be enabled/disabled</p><p> public bool CanEnable()</p><p> {</p><p> return true;</p><p> }</p><p></p><p> // Get Windows-ID</p><p> public int GetWindowId()</p><p> {</p><p> // WindowID of windowplugin belonging to this setup</p><p> // enter your own unique code</p><p> return 5678;</p><p> }</p><p></p><p> // Indicates if plugin is enabled by default;</p><p> public bool DefaultEnabled()</p><p> {</p><p> return true;</p><p> }</p><p></p><p> // indicates if a plugin has it's own setup screen</p><p> public bool HasSetup()</p><p> {</p><p> return true;</p><p> }</p><p></p><p> /// <summary></p><p> /// If the plugin should have it's own button on the main menu of Mediaportal then it</p><p> /// should return true to this method, otherwise if it should not be on home</p><p> /// it should return false</p><p> /// </summary></p><p> /// <param name="strButtonText">text the button should have</param></p><p> /// <param name="strButtonImage">image for the button, or empty for default</param></p><p> /// <param name="strButtonImageFocus">image for the button, or empty for default</param></p><p> /// <param name="strPictureImage">subpicture for the button or empty for none</param></p><p> /// <returns>true : plugin needs it's own button on home</p><p> /// false : plugin does not need it's own button on home</returns></p><p></p><p> public bool GetHome(out string strButtonText, out string strButtonImage,</p><p> out string strButtonImageFocus, out string strPictureImage)</p><p> {</p><p> strButtonText=PluginName();</p><p> strButtonImage=String.Empty;</p><p> strButtonImageFocus=String.Empty;</p><p> strPictureImage=String.Empty;</p><p> return true;</p><p> }</p><p></p><p> // With GetID it will be an window-plugin / otherwise a process-plugin</p><p> // Enter the id number here again</p><p> public override int GetID</p><p> {</p><p> get</p><p> {</p><p> return 5678;</p><p> }</p><p></p><p> set</p><p> {</p><p> }</p><p> }</p><p></p><p> #endregion</p><p></p><p> public override bool Init()</p><p> {</p><p> return Load(GUIGraphicsContext.Skin+@"\ourplugin.xml");</p><p> }</p><p></p><p> protected override void OnClicked(int controlId, GUIControl control,</p><p> MediaPortal.GUI.Library.Action.ActionType actionType)</p><p> {</p><p> if (control==buttonOne)</p><p> OnButtonOne();</p><p> if (control==buttonTwo)</p><p> OnButtonTwo();</p><p> base.OnClicked (controlId, control, actionType);</p><p> }</p><p></p><p> private void OnButtonOne()</p><p> {</p><p> GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(</p><p> (int)GUIWindow.Window.WINDOW_DIALOG_OK);</p><p> dlg.SetHeading("Button has been pressed");</p><p> dlg.SetLine(1, "You pressed button 1");</p><p> dlg.SetLine(2, String.Empty);</p><p> dlg.SetLine(3, String.Empty);</p><p> dlg.DoModal(GUIWindowManager.ActiveWindow);</p><p> }</p><p></p><p> private void OnButtonTwo()</p><p> {</p><p> GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(</p><p> (int)GUIWindow.Window.WINDOW_DIALOG_OK);</p><p> dlg.SetHeading("Button has been pressed");</p><p> dlg.SetLine(1, "You pressed button 2");</p><p> dlg.SetLine(2, String.Empty);</p><p> dlg.SetLine(3, String.Empty);</p><p> dlg.DoModal(GUIWindowManager.ActiveWindow);</p><p> }</p><p></p><p> }</p><p></p><p>}</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="IanJ, post: 751186, member: 107764"] Hi, Yes thats exactly what I'm trying to do. However, more progress..............so, I managed to modify the buttons to do what I wanted them to do, but the code I added for remembering the last pressed doesn't work because where I put it isn't being run.......! I am basically using the demo here and thought I had identified a part of the code that was repeatedly being run, a main loop if you will......but obviously not! So, can anyone tell me what part of the following code is looping when the page is accessed..... Jings!, C# is different to C++ on Arduino's eh!.......I can't believe I am being stumped by such a small thing!!! [CODE] using System; using System.Windows.Forms; using MediaPortal.GUI.Library; using MediaPortal.Dialogs; namespace OurPlugin { public class Class1 : GUIWindow, ISetupForm { [SkinControlAttribute(2)] protected GUIButtonControl buttonOne=null; [SkinControlAttribute(3)] protected GUIButtonControl buttonTwo=null; public Class1() { } #region ISetupForm Members // Returns the name of the plugin which is shown in the plugin menu public string PluginName() { return "MyFirstPlugin"; } // Returns the description of the plugin is shown in the plugin menu public string Description() { return "My First plugin tutorial"; } // Returns the author of the plugin which is shown in the plugin menu public string Author() { return "Frodo"; } // show the setup dialog public void ShowPlugin() { MessageBox.Show("Nothing to configure, this is just an example"); } // Indicates whether plugin can be enabled/disabled public bool CanEnable() { return true; } // Get Windows-ID public int GetWindowId() { // WindowID of windowplugin belonging to this setup // enter your own unique code return 5678; } // Indicates if plugin is enabled by default; public bool DefaultEnabled() { return true; } // indicates if a plugin has it's own setup screen public bool HasSetup() { return true; } /// <summary> /// If the plugin should have it's own button on the main menu of Mediaportal then it /// should return true to this method, otherwise if it should not be on home /// it should return false /// </summary> /// <param name="strButtonText">text the button should have</param> /// <param name="strButtonImage">image for the button, or empty for default</param> /// <param name="strButtonImageFocus">image for the button, or empty for default</param> /// <param name="strPictureImage">subpicture for the button or empty for none</param> /// <returns>true : plugin needs it's own button on home /// false : plugin does not need it's own button on home</returns> public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) { strButtonText=PluginName(); strButtonImage=String.Empty; strButtonImageFocus=String.Empty; strPictureImage=String.Empty; return true; } // With GetID it will be an window-plugin / otherwise a process-plugin // Enter the id number here again public override int GetID { get { return 5678; } set { } } #endregion public override bool Init() { return Load(GUIGraphicsContext.Skin+@"\ourplugin.xml"); } protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { if (control==buttonOne) OnButtonOne(); if (control==buttonTwo) OnButtonTwo(); base.OnClicked (controlId, control, actionType); } private void OnButtonOne() { GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow( (int)GUIWindow.Window.WINDOW_DIALOG_OK); dlg.SetHeading("Button has been pressed"); dlg.SetLine(1, "You pressed button 1"); dlg.SetLine(2, String.Empty); dlg.SetLine(3, String.Empty); dlg.DoModal(GUIWindowManager.ActiveWindow); } private void OnButtonTwo() { GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow( (int)GUIWindow.Window.WINDOW_DIALOG_OK); dlg.SetHeading("Button has been pressed"); dlg.SetLine(1, "You pressed button 2"); dlg.SetLine(2, String.Empty); dlg.SetLine(3, String.Empty); dlg.DoModal(GUIWindowManager.ActiveWindow); } } } [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
file.exists problem
Contact us
RSS
Top
Bottom