Questions on writing my first plugin (1 Viewer)

morpheus_xx

Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    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
    Home Country
    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

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    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
    Home Country
    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

    Top Bottom