Questions on writing my first plugin | Page 3

Discussion in 'Plugin Development' started by huha, March 20, 2012.

  1. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    To help you, I need more of the log.


     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. huha
    • Premium Supporter

    huha Extension Developer

    Joined:
    January 3, 2008
    Messages:
    890
    Likes Received:
    550
    Gender:
    Male
    Ratings:
    +622 / 0
    Home Country:
    Germany Germany
    Show System Specs
    Albert,
    attached the complete log files and the plugin.xml of the hello world plugin with a dependency on the slim tv plugin.
    I would be interested if the error can be reproduced on another system or it is only me.
    Thanks in advance for your help!
     

    Attached Files:

    • Debug MP2.zip
      File size:
      4.7 KB
      Uploaded:
      June 26, 2012
      Views:
      94
    Last edited: June 26, 2012
    • Like Like x 2
  4. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    huha, the plugin manager was one of our most stable components for about 4 years now.
    You're the first one (excluding me) who found a bug in the plugin manager :)
    Fixed in branch dev. Thanks very much!
     
    • Like Like x 2
  5. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    Oh, I just see I forgot to push my change to github. It's available there now.
     
    • Like Like x 1
  6. huha
    • Premium Supporter

    huha Extension Developer

    Joined:
    January 3, 2008
    Messages:
    890
    Likes Received:
    550
    Gender:
    Male
    Ratings:
    +622 / 0
    Home Country:
    Germany Germany
    Show System Specs
    Albert,
    glad i could help :) and thanks for fixing. I have not changed yet to another version (still on the Easter built).

    Another thing I observed is that about one out of 40 times the Client does not close correctly. The window is closing, but another process is still running. I need to open the process explorer to kill it. If this is unknown i will try to catch a log the next time it happens. I thaugt originally its me with a plugin, but this came at to many different situations.

    I have started now to work on TvWishlist after I have collected all my code pieces and I am making good progress. But there is still a long way ahead.
    greetings, huha
     
    • Like Like x 2
  7. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    It might be the case that the inproper closure of the client is already fixed in the current dev version. Some weeks ago, I did some bugfixes in the UPnP library which could lead to inproper close orders.
     
    • Like Like x 1
  8. huha
    • Premium Supporter

    huha Extension Developer

    Joined:
    January 3, 2008
    Messages:
    890
    Likes Received:
    550
    Gender:
    Male
    Ratings:
    +622 / 0
    Home Country:
    Germany Germany
    Show System Specs
    I am nearly done with tvwishlist, but i am running into a roadblock on the last task. I am trying to implement the "Pog" button, where I can "steal" from another screen information and transfer to TvWishlist.
    I tried to modify the SlimTv DialogprogramActionsFull.xaml and added successfully another button.
    This button should call a function in a different model (and later transfer via parameter the selected program from the EPG guide)



    Show Spoiler

    <?xml version="1.0" encoding="utf-8"?>
    <Include
    xmlns="www.team-mediaportal.com/2008/mpf/directx"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Source="screens\simple_dialog_menu.xaml"
    >
    <Include.Resources>
    <Service x:Key="ScreenManager" InterfaceName="ScreenManager"/>

    <!-- Dialog title -->
    <ResourceWrapper x:Key="Dialog_Header_Text" Resource="[SlimTvClient.ChooseProgramAction]"/>

    <!-- SlimTvMultiChannelGuide model -->
    <Model x:Key="SlimTvMultiChannelGuide" Id="5054408D-C2A9-451f-A702-E84AFCD29C10"/>
    <Model x:Key="MyTestPluginSlimTv" Id="023c44f2-3329-4781-9b4a-c974444c0b0d"/>


    <!-- Command -->
    <CommandStencil x:Key="Execute_Command_Stencil"
    Source="{StaticResource SlimTvMultiChannelGuide}" Path="ExecProgramAction"/>


    <ControlTemplate x:Key="Contents_Template">


    <DockPanel Context="{Model Id=5054408D-C2A9-451f-A702-E84AFCD29C10}" LastChildFill="False">

    <Grid HorizontalAlignment="Stretch">
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto"/>

    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
    <RowDefinition Height="Auto"/>
    <RowDefinition Height="*"/>

    </Grid.RowDefinitions>
    <ListView Name="DialogMenu" Grid.Column="0" Grid.Row="0" ItemsSource="{Binding Source={StaticResource SlimTvMultiChannelGuide},Path=ProgramActions,Mode=OneTime}" Style="{ThemeResource MenuListViewStyle}">

    </ListView>


    <!--<Command Source="{Service ScreenManager}" Path="ShowDialog" Parameters="dialogWeatherSearchResult"/>-->
    <!--<Command Path="SearchLocations" Parameters="{LateBoundValue BindingValue={Binding Path=SearchCity}}"/>-->
    <!--Command="{Command Source={Service WorkflowManager},Path=NavigatePop,Parameters=1}"/>-->
    <!--Command="{Command Source={Service WorkflowManager},Path=NavigatePush,Parameters={StaticResource EditShareNameStateId}}"/>-->

    <Button Style="{ThemeResource DialogButtonStyle}" Grid.Column="0" Grid.Row="1" Context="{Model Id=023c44f2-3329-4781-9b4a-c974444c0b0d}" Content="TvWish" HorizontalAlignment="Center">
    <Button.Command>
    <CommandList>
    <Command Source="{StaticResource MyTestPluginSlimTv}" Path="SlimTv"/>
    <Command Source="{Service ScreenManager}" Path="CloseTopmostDialog"/>
    </CommandList>
    </Button.Command>
    </Button>

    </Grid>

    </DockPanel>
    </ControlTemplate>
    </Include.Resources>
    </Include>


    I have modified the skin in the following way, that I defined first a second Model reference MyTestPluginSlimTV pointing to MyTestPlugin and defined then a button calling a function SlimTv() in my test plugin. The function in the MyTestPlugin model is simply to log the event

    public void SlimTv()
    {
    HelloString = "message from slimtv";
    mylogger.Debug("SlimTv called");
    }

    The error message is
    [InputMgr ] [WARN ] - CommandBaseMarkupExtension: Could not find method, could not execute command ({Command Source=MyTestPlugin.Models.MyTestPlugin,Path=SlimTv})
    It looks like it cannot find the actual instance of the model. The complete log file is attached. Any ideas how this can be done?
     
    Last edited: August 8, 2012
  9. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    Hmm, strange. For me it all looks fine. I guess the code above is located in file "DialogProgramActionsFull.xaml" and your "MyTestPlugin" is a model which is correctly registered in "plugin.xml" and that class is located in plugin "TvWishListMP2".
    The model seems to be found by the workflow manager, the log output of the Command markup extension writes down the namespace of your model class. The only thing I could imagine is that you run another code of the model class which doesn't contain the "SlimTv" method yet or with another signature.
     
    • Like Like x 1
  10. huha
    • Premium Supporter

    huha Extension Developer

    Joined:
    January 3, 2008
    Messages:
    890
    Likes Received:
    550
    Gender:
    Male
    Ratings:
    +622 / 0
    Home Country:
    Germany Germany
    Show System Specs
    Albert,
    a big thanks for your help again. You were right on your suspicion with the model. I got it to work now and will continue with the parameters.
     
    • Like Like x 1
  11. huha
    • Premium Supporter

    huha Extension Developer

    Joined:
    January 3, 2008
    Messages:
    890
    Likes Received:
    550
    Gender:
    Male
    Ratings:
    +622 / 0
    Home Country:
    Germany Germany
    Show System Specs
    It's Working! :):):)

    Changing the test plugin function to
    Show Spoiler
    public void SlimTv(string text)
    {
    HelloString = "message from slimtv="+text;
    mylogger.Debug("SlimTv called parameter="+text);
    }


    and using

    Show Spoiler
    <?xml version="1.0" encoding="utf-8"?>
    <Include
    xmlns="www.team-mediaportal.com/2008/mpf/directx"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Source="screens\simple_dialog_menu.xaml"
    >
    <Include.Resources>
    <Service x:Key="ScreenManager" InterfaceName="ScreenManager"/>

    <!-- Dialog title -->
    <ResourceWrapper x:Key="Dialog_Header_Text" Resource="[SlimTvClient.ChooseProgramAction]"/>

    <!-- SlimTvMultiChannelGuide model -->
    <Model x:Key="SlimTvMultiChannelGuide" Id="5054408D-C2A9-451f-A702-E84AFCD29C10"/>
    <Model x:Key="MyTestPluginSlimTv" Id="023c44f2-3329-4781-9b4a-c974444c0b0d"/>


    <!-- Command -->
    <CommandStencil x:Key="Execute_Command_Stencil"
    Source="{StaticResource SlimTvMultiChannelGuide}" Path="ExecProgramAction"/>


    <ControlTemplate x:Key="Contents_Template">


    <DockPanel Context="{Model Id=5054408D-C2A9-451f-A702-E84AFCD29C10}" LastChildFill="False">

    <Grid HorizontalAlignment="Stretch">
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto"/>

    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
    <RowDefinition Height="Auto"/>
    <RowDefinition Height="*"/>

    </Grid.RowDefinitions>
    <ListView Name="DialogMenu" Grid.Column="0" Grid.Row="0" ItemsSource="{Binding Source={StaticResource SlimTvMultiChannelGuide},Path=ProgramActions,Mode=OneTime}" Style="{ThemeResource MenuListViewStyle}">

    </ListView>


    <Button Style="{ThemeResource DialogButtonStyle}" Grid.Column="0" Grid.Row="1" Content="TvWish" HorizontalAlignment="Center">
    <Button.Command>
    <CommandList>

    <!--<Command Source="{StaticResource MyTestPluginSlimTv}" Path="SlimTv" Parameters="huhatest"/>-->
    <!--Parameters="{LateBoundValue BindingValue={Binding Path=SearchCity}}"/>-->

    <Command Source="{StaticResource MyTestPluginSlimTv}" Path="SlimTv" Parameters="{LateBoundValue BindingValue={Binding Source={StaticResource SlimTvMultiChannelGuide},Path=CurrentProgram.Title}}"/>
    <Command Source="{Service ScreenManager}" Path="CloseTopmostDialog"/>
    </CommandList>
    </Button.Command>
    </Button>

    </Grid>

    </DockPanel>
    </ControlTemplate>
    </Include.Resources>
    </Include>


    is transferring now the selected program title from SlimTv to MyTestplugin via parameters.
     
    Last edited: August 9, 2012
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!