Help with TV Server plugin settings page (1 Viewer)

ears

Portal Member
October 7, 2008
162
87
Hi,

Thanks to help on previous posts I now have my plugin up and running - MP TV server accepts it and displays it, I can enable and disable it.

My next step is to get a settings page up and running but I seem to have immediately run into a problem - MP TV server doesn't show the form that I've created in the project.

So the plugin itself has the following lines in it

public SetupTv.SectionSettings Setup
{
get
{
return new SetupTV.Sections.SetupSkyGrabber();
}
}

And the form itself is a rather basic hello world type affair - highlights here

public partial class SetupSkyGrabber : SetupTv.SectionSettings
{
private System.Windows.Forms.TextBox tbTest;
private System.Windows.Forms.Button button1;

Then some standard VS inserted intialise components

And then my simple button1_click method that puts some text in the box.

Problem is this form isn't being displayed on the MP plugin settings page and there's nothing in the logs to indicate why - does anyone have any clever ideas about where I should be looking?

Thanks in advance
 

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hello

    Problem is this form isn't being displayed on the MP plugin settings page...
    You mean the TV Server configuration page, right?

    What happens when you enable your plugin and attempt to view the settings section? Does TV Server configuration just continue to show the previous section?

    It is possibly your plugin is throwing an exception when trying to load the settings section... or maybe you haven't implemented OnSectionActivated()?

    Posting the full code from your SetupSkyGrabber class might help...

    Regards,
    mm
     

    ears

    Portal Member
    October 7, 2008
    162
    87
    Ooh I definitely don't have an OnSectionActivated implemented - sorry i haven't seen any documentation about that - is there anywhere you can point me? When I enable the plugin and try to view the settings section I just get a blank page. The title at the top is the correct name of the plugin. I'll dig the code out and post it.
     

    ears

    Portal Member
    October 7, 2008
    162
    87
    OK so this is it so far - just wanted to keep it simple. I'm hoping that once I've learnt the intricacies of MP and its requirements I'll get up to speed a bit better and stop bothering all of you!

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace SetupTV.Sections
    {
    public partial class SetupSkyGrabber : SetupTv.SectionSettings
    {
    private System.Windows.Forms.TextBox tbTest;
    private System.Windows.Forms.Button button1;

    private void InitializeComponent()
    {
    this.button1 = new System.Windows.Forms.Button();
    this.tbTest = new System.Windows.Forms.TextBox();
    this.SuspendLayout();
    //
    // button1
    //
    this.button1.Location = new System.Drawing.Point(21, 26);
    this.button1.Name = "button1";
    this.button1.Size = new System.Drawing.Size(75, 23);
    this.button1.TabIndex = 0;
    this.button1.Text = "Do it";
    this.button1.UseVisualStyleBackColor = true;
    this.button1.Click += new System.EventHandler(this.button1_Click);
    //
    // tbTest
    //
    this.tbTest.Location = new System.Drawing.Point(18, 71);
    this.tbTest.Name = "tbTest";
    this.tbTest.Size = new System.Drawing.Size(95, 20);
    this.tbTest.TabIndex = 1;
    //
    // SetupSkyGrabber
    //
    this.Controls.Add(this.tbTest);
    this.Controls.Add(this.button1);
    this.Name = "SetupSkyGrabber";
    this.Size = new System.Drawing.Size(300, 243);
    this.ResumeLayout(false);
    this.PerformLayout();

    }

    private void button1_Click(object sender, EventArgs e)
    {
    tbTest.Text = "Something happened";
    }
    }
    }
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hello again

    i haven't seen any documentation about that - is there anywhere you can point me?
    I don't think there is any documentation. The ITvServerPlugin and SectionSettings interfaces are very simple, so devs are usually able to figure out how to get them working without any trouble. I suggest you take a look at the code for the plugins that come with TV Server:
    https://github.com/MediaPortal/MediaPortal-1/tree/master/TvEngine3/TVLibrary/Plugins

    The ConflictsManager and ComSkipLauncher plugins are particularly simple.

    OK so this is it so far...
    It looks to me like you're editing the designer code, which is usually a "no-no". That stuff is auto-generated and generally not meant to be touched.
    In the solution explorer in Visual Studio, right click on your class and click "view code". That's where your code and SectionSettings implementation should be.

    Regards,
    mm
     

    ears

    Portal Member
    October 7, 2008
    162
    87
    Hmm thanks - something's going on - but that is the code view - it's put the onclick function in there, not me. Maybe I'll have a go in VS2010, I'm more comfortable in there and have maybe set something odd off in VS2012. Thanks for the pointers.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    but that is the code view
    The code view I'm used to [with c# development] definitely doesn't contain the Initialize() function. The Initialize() function is always in the designer.

    For example:
    upload_2014-10-30_12-2-1.png


    If I open CardAnalog.Designer.cs I find the code that is auto-generated for me, including the Initialize function and all the component definitions.
    If I right click on CardAnalog.cs and select "view code" (instead of double clicking... which shows me the GUI interface/layout) I see the event handlers and other custom code that I've written.

    Maybe VB is different. Never liked VB... ;)

    Regards,
    mm
     

    ears

    Portal Member
    October 7, 2008
    162
    87
    I'm using C#. I think it's in the way I'm creating the form. I was creating it as a class, then setting the inheritance - it worked in a sense, in that I could view the form and drop objects onto it, but it didn't create a .designer file, so dropped all the auto generated code straight into the class.

    I've now tried it the other way around, creating a Windows form then setting inheritance. It likes it a bit more but since I added the inheritance it's taken a dislike to the simple constructor - public SetupSkyImporter() - saying the method must return a type.
     

    ears

    Portal Member
    October 7, 2008
    162
    87
    Sorry - ignore the constructor bit - just me being silly. Once I start getting confused about the stuff I don't know, I seem to then spend a lot of time getting the stuff I do know wrong!
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    I'm using C#. I think it's in the way I'm creating the form. I was creating it as a class, then setting the inheritance - it worked in a sense, in that I could view the form and drop objects onto it, but it didn't create a .designer file, so dropped all the auto generated code straight into the class.

    I've now tried it the other way around, creating a Windows form then setting inheritance.
    Ahhh, I see. Yes, you should create the Windows form, then set inheritance in the code view (not the designer).

    It likes it a bit more but since I added the inheritance it's taken a dislike to the simple constructor - public SetupSkyImporter() - saying the method must return a type.
    You need to call the base SectionSettings constructor which takes a string as a parameter.
     

    Users who are viewing this thread

    Top Bottom