Questions on writing my first plugin (1 Viewer)

morpheus_xx

Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,971
    Germany Germany
    Country flag
    Hi,

    nice to see your progress, great work (y)!

    VisualStudio automatically sets all new .xaml to "Compile", and "Page". This needs to be changed in the file properties, see screenshot here:

    build_options.png

    "Userdefined tool" (Benutzerdefiniertes Tool)needs to be removed, BuildAction should be set to "content" (Inhalt). Sorry, that my previous answer was not exact enough.

    To your questions:
    1) I don't know an answer yet, have not needed it until now. I will check this and let you know later.

    2) The hover images are coupled with the Workflow Transitions. Let's take the SlimTv client plugin as example. In the "Skin\default\workflow\SlimTvClient-actions.xaml" I defined the navigation options. The first entry is the "home menu button":

    <?xml version="1.0" encoding="utf-8"?>
    <Workflow DescriptorVersion="1.0">
    <MenuActions>
    <PushNavigationTransition Id="B4A9199F-6DD4-4bda-A077-DE9C081F7703"
    Name="Home->SlimTvClient"
    DisplayCategory="A-SlimTvClient"
    SortOrder="a"
    SourceStates="7F702D9C-F2DD-42da-9ED8-0BA92F07787F"
    TargetState="C7646667-5E63-48c7-A490-A58AC9518CFA"
    DisplayTitle="SlimTvClient"/>

    I decided to use the unique menu action ID also for hover file names. Good thing is, they are independent from plugin names or localization.
    So the related hover image you'll find in
    Reflexion\Images\B4A9199F-6DD4-4bda-A077-DE9C081F7703.jpg

    So if you have your own menu actions, simply add another image with the {guid}.jpg.

    3) The assembly version will have a common number in the next published builds. I introduced a common version file include for this. But on the other hand I would not rely to much on the .dll AssemblyVersion. Each plugin comes with it's plugin.xml descriptor:

    <Plugin
    DescriptorVersion="1.0"
    Name="SlimTvClient"
    PluginId="{63040BB4-4638-49b7-A82F-F4530D4D43B9}"
    Author="Morpheus_xx"
    Copyright="GPL"
    Description="The SlimTvClient plugin provides the GUI and Player for basic TV capabilities."
    PluginVersion="1.0">

    In the past I didn't change any version number here, but in next public build we should do this. I don't have a code part available yet, that exposes the version number, but I think it must be sth. like IPluginManager to call.

    I would recommend that you don't try to support older version of SlimTv. Until now each "release" is to be considered as unstable (project is situated in Incubator).

    4) I had never issues with settings manager, we rely on it all over MP2. Save() does write Settings immediatly to disk. Load() does the same. If the file is not available, the default values are used (see the property attributes).


    I hope this helps a bit, please continue asking! This also helps others to learn more about MP2 :)

    Morpheus
     

    huha

    Extension Developer
    January 3, 2008
    890
    556
    Germany Germany
    • Thread starter
    • Moderator
    • #42
    Hi Morpheus,
    thanks again for your help!
    - compiling works now out of one project file incliding the .xaml files. This is great.
    - the hover picture works great
    - I will use the plugin.xml version number in the future, but will wait for the next release of MP2

    - On the settings manager I am still struggling. It works fine if i change a setting within the configuration manager. Then the file is immediately writtten. However, if I am saving a setting within a model file, the .xml file is written after the client is closed.
    I had the following code used in the Result_GUI model, and it is called from the function ExitModelContext(NavigationContext oldContext, NavigationContext newContext) or Deactivate(NavigationContext oldContext, NavigationContext newContext):

    Code:
    try
                {
                    ISettingsManager settingsManager = ServiceRegistration.Get<ISettingsManager>();
                    TvWishListMP2Settings settings = settingsManager.Load<TvWishListMP2Settings>();
     
                    //settings.TvWishItemSeparator = TvWishItemSeparator;
     
                    settings.Sort = mymessages.Sort;
                    settings.SortReverse = mymessages.SortReverse;
     
                    settings.Email = mymessages.Email;
                    settings.Deleted = mymessages.Deleted;
                    Log.Debug("mymessages.Deleted=" + mymessages.Deleted.ToString());
                    settings.Conflicts = mymessages.Conflicts;
                    settings.Scheduled = mymessages.Scheduled;
                    settings.Recorded = mymessages.Recorded;
                    Log.Debug("mymessages.Recorded=" + mymessages.Recorded.ToString());
                    settings.View = mymessages.View;
     
                    settingsManager.Save(settings);
                    Log.Debug("Settings have been saved");
                }
                catch (Exception exc)
                {
                    Log.Debug("Error SaveSettings: Exception " + exc.Message);
                }
    It looks like writting the .xml setting file is delayed if the command is used outside the configuration manager. Is this a bug in MP2?
    ( I am using the official summer built release)
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,971
    Germany Germany
    Country flag
    and it is called from the function ExitModelContext(NavigationContext oldContext, NavigationContext newContext) or Deactivate(NavigationContext oldContext, NavigationContext newContext)
    I think this is the issue. Deactivate and ExitModelContext are executed when you are leaving your plugin screens, or MP2 shuts down.

    Are you reacting on some messages (mymessages)? In this case it would be better to save the settings in the message handler.

    If not, save settings directly in commands/action that you invoke.
     

    huha

    Extension Developer
    January 3, 2008
    890
    556
    Germany Germany
    • Thread starter
    • Moderator
    • #44
    I am directly calling the savesettings function when the plugin screen is left in the model. I will change that and use the message handler. Thanks!
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    Rob Hexenmeister Skinning Online Videos question OnlineVideos 2
    Rob Hexenmeister Quick question - skinning MyPics General Support 7
    Lichloathe Trakt for MP2 question General 7
    J TV Server setup question Newcomers Forum 0
    A Question about Google Drive sync Feature Requests 3
    C Looking at transitioning from SageTV, but have some questions Newcomers Forum 1
    X Question about Google Token activation of Youtube MediaPortal 1 Talk 0
    P Another Fast Forward/Rewind/Skip/Replay Question General 3
    doskabouter Skin question Skins and Plugins Installer (MPEI) 1
    S Newbie questions Newcomers Forum 17
    M Tuning channels with quad tuner question General 6
    ajs [Help Us!] Extensions plugin question MediaPortal 1 8
    J Trying out MP 1 again, have some questions and a few log files Newcomers Forum 5
    J Question about thumbnail decorations MediaPortal 1 Talk 0
    D A couple of DVD questions General 2
    J A question regarding Slingbox-like capability online General 3
    U 2 questions Newcomers Forum 1
    J silly question: where do I add my login details!! OnlineVideos for MediaPortal 2 5
    BlueMax1916 Titanium Extended Theme Screensaver Question Skins and Design 6
    mrmojo666 beginner: trying to write a plugin, need help to catch event General Development (no feature request here!) 3
    lacanox XMLTV not writing the tv schedule Electronic Program Guide 3
    M Need advice on writing plugin that modifies EPG database TV-Server 2
    joecrow 1.25.0 Radio Time plugin fails after Resume from Sleep with MP 1.25 Bugreports 4
    P MP2: US user, OTA - can NOT get SchedulesDirect plugin to work on MP1 or MP2 --> how do I get OTA schedule? General 5
    E aktuelle englische Forums Webseite von - Showtime Plugin v3 Plugins & Erweiterungen 4
    Top Bottom