Need help to create my first plugin

Discussion in 'General Support' started by MaxMan23, February 24, 2012.

  1. MaxMan23
    • Premium Supporter

    MaxMan23 MP Donator

    Joined:
    September 8, 2007
    Messages:
    380
    Likes Received:
    36
    Ratings:
    +45 / 0
    Home Country:
    Germany Germany
    Hi,

    i need help by coding my first plugin (Motion Interpolation). I only want to open a DialogMenu in a fullscreen Video Window. (I used the wiki lesson)
    But i get the Main Window of the plugin when i click on the button.



    Look at the pictures


    Here is the code but i dont know what to change to get what i want
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    using System.Runtime.InteropServices;
    using System.Diagnostics;
    using System.Windows.Forms;
    using MediaPortal.GUI.Library;
    using MediaPortal.Dialogs;
    using MediaPortal.Common.Utils;
    [assembly: CompatibleVersion("1.1.7.0")]
    [assembly: UsesSubsystem("MP.SkinEngine")]
    [assembly: UsesSubsystem("MP.Config")]

    namespace Motion_Interpolation
    {
    public class Class1 : GUIWindow, ISetupForm
    {
    [SkinControlAttribute(2)]
    protected GUIButtonControl buttonOne = null;

    [DllImport("User32.dll")]
    public static extern bool SetForegroundWindow(IntPtr hWnd);
    [DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
    public static extern IntPtr FindWindow(string lpClassName,
    string lpWindowName);
    [DllImport("user32.dll")]
    static extern void keybd_event(byte bVk, byte bScan, uint dwFlags,
    int dwExtraInfo);
    public const byte VK_LSHIFT = 0xA0; // left shift key
    public const byte VK_CONTROL = 0x11;
    public const byte VK_P = 0x50;
    public const int KEYEVENTF_EXTENDEDKEY = 0x01;
    public const int KEYEVENTF_KEYUP = 0x02;


    public Class1()
    {

    }

    #region ISetupForm Members

    // Returns the name of the plugin which is shown in the plugin menu
    public string PluginName()
    {
    return "Motion Interpolation";
    }

    // Returns the description of the plugin is shown in the plugin menu
    public string Description()
    {
    return "Motion Interpolation";
    }

    // Returns the author of the plugin which is shown in the plugin menu
    public string Author()
    {
    return "MaxMan23";
    }

    // 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 6785;
    }

    // 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;
    }

    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 6785;
    }

    set
    {
    }
    }

    #endregion

    public override bool Init()
    {
    return Load(GUIGraphicsContext.Skin + @"\Motion_Interpolation.xml");
    }


    protected override void OnClicked(int controlId, GUIControl control,MediaPortal.GUI.Library.Action.ActionType actionType)
    //protected override void OnPageLoad()

    {
    GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
    if (dlgMenu != null)
    {

    dlgMenu.Reset();
    dlgMenu.SetHeading("Header");
    dlgMenu.Add("Off");
    dlgMenu.Add("Normal");
    dlgMenu.Add("Motion Interpolation");
    dlgMenu.DoModal(GetID);

    switch (dlgMenu.SelectedLabel)
    ...



    After click on the Button Motion Interpolation the

    GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

    should opens. I hope someone can explain me what to do. I am a totally beginner in c# but i want to learn it.
     

    Attached Files:

    • Folie1.JPG
      Folie1.JPG
      File size:
      29.3 KB
      Uploaded:
      February 24, 2012
      Views:
      50
    • Folie2.JPG
      Folie2.JPG
      File size:
      38.9 KB
      Uploaded:
      February 24, 2012
      Views:
      46
    • Folie3.JPG
      Folie3.JPG
      File size:
      30.2 KB
      Uploaded:
      February 24, 2012
      Views:
      39
    • Folie4.JPG
      Folie4.JPG
      File size:
      30.2 KB
      Uploaded:
      February 24, 2012
      Views:
      44
    • Folie5.JPG
      Folie5.JPG
      File size:
      32.1 KB
      Uploaded:
      February 24, 2012
      Views:
      42
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. doug
    • Premium Supporter

    doug MP Donator

    Joined:
    September 22, 2010
    Messages:
    81
    Likes Received:
    12
    Occupation:
    Formerly in Telecom. Now a full-time dad
    Location:
    Calgary
    Ratings:
    +12 / 0
    Home Country:
    Canada Canada
    Show System Specs
    The first dialog contains the choice of Off/Normal/Motion Interpolation. Are you then trying to display a second dialog? If so...

    GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); //this is your original dialog
    if (dlgMenu != null)
    {

    dlgMenu.Reset();
    dlgMenu.SetHeading("Header");
    dlgMenu.Add("Off");
    dlgMenu.Add("Normal");
    dlgMenu.Add("Motion Interpolation");
    dlgMenu.DoModal(GetID);

    switch (dlgMenu.SelectedLabel) //dlgMenu.SelectedLabel now contains a numerical value corresponding to the menu item selected
    {
    case 1: //Off is selected
    //do stuff
    return;
    case 2: //Normal is selected
    //do stuff
    return;
    case 3: //Motion Interpolation is selected
    GUIDialogMenu NewdlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); //this is a new dialog
    if (NewdlgMenu != null)
    {
    NewdlgMenu.Reset();
    NewdlgMenu.SetHeading("Header#2");
    NewdlgMenu.Add("More Items");
    dlgMenu.DoModal(GetID); }
    return;
    }
     
  4. MaxMan23
    • Premium Supporter

    MaxMan23 MP Donator

    Joined:
    September 8, 2007
    Messages:
    380
    Likes Received:
    36
    Ratings:
    +45 / 0
    Home Country:
    Germany Germany
    Ok thanks, i will try at home :)
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!