Need help to create my first plugin (1 Viewer)

MaxMan23

MP Donator
  • Premium Supporter
  • September 8, 2007
    380
    48
    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.
     

    Attachments

    • Folie1.JPG
      Folie1.JPG
      29.3 KB
    • Folie2.JPG
      Folie2.JPG
      38.9 KB
    • Folie3.JPG
      Folie3.JPG
      30.2 KB
    • Folie4.JPG
      Folie4.JPG
      30.2 KB
    • Folie5.JPG
      Folie5.JPG
      32.1 KB

    doug

    MP Donator
  • Premium Supporter
  • September 22, 2010
    81
    12
    Calgary
    Home Country
    Canada Canada
    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;
    }
     

    Users who are viewing this thread

    Top Bottom