[Approved] Patch to enhance TV notification (1 Viewer)

splatterpop

MP Donator
  • Premium Supporter
  • December 17, 2007
    177
    54
    planet ASPARAGUS
    Home Country
    Germany Germany
    Hi all,

    heres a patch to add more functionality to the TV and radio notifications.

    The original way to notify the user is to display a message that a certain program is about to begin. If the user decides to watch that program, he or she has to stop current activity, remember the channel, go to the guide or the channels page, look up the program (or even the preceding program. because the program has not started yet) and then turn on tv or radio. I found that very inconvenient!

    The new notification will ask the viewer if he wants to view or listen to the program, and if answered yes, will directly start playback.

    I used late binding, so the patch should fall back to the original method if tv server is not present. Sadly, I was not able to test that so please forgive me if any problems come up here.

    It was also necessary to patch GUIDialogYesNo and add a timeout.

    Greetings,
    splatterpop.
     

    Attachments

    • 100130_tvnotification.zip
      30.7 KB

    chemelli

    Retired Team Member
  • Premium Supporter
  • September 28, 2006
    6,159
    2,264
    49
    Milano, Italy
    Home Country
    Italy Italy
    :D for help improving MP.

    As you may now MP is currently in feature freeze so we have to postpone the validation of your patch.

    Cheers,

    Simone
     

    DieBagger

    Retired Team Member
  • Premium Supporter
  • September 11, 2007
    2,516
    1,276
    39
    Austria
    Home Country
    Austria Austria
    Hello splatterpop,

    sry for the long delay (due to the long feature freeze for 1.1), I now reviewed your patch for inclusion in MediaPortal 1.2. There are 2 problems with your patch, you use reflection to load server dlls and you don't use MP code style for naming your variables.

    + a_TvPlugin = Assembly.LoadFrom(@".\plugins\windows\tvplugin.dll");
    + a_TvBusinessLayer = Assembly.LoadFrom(@".\tvbusinesslayer.dll");
    + a_TvDatabase = Assembly.LoadFrom(@".\tvdatabase.dll");

    Here are a few suggestions from a discussion in the team forum:

    This should be handled from within TV Plugin. A simple way would be to subclass the yes/no dialog in TV plugin, and let home screen just DoModal on it. The subclassed dialog, already has access to the full codebase of TVPlugin and can start TV or Radio much easier without any use of reflection. Neat and simple.

    Another solution would be to forward the message to some TV Plugin window, which would do what is necessary.

    If you can redo the patch I would be happy to test it and try to get it submitted to svn.

    :D
     

    splatterpop

    MP Donator
  • Premium Supporter
  • December 17, 2007
    177
    54
    planet ASPARAGUS
    Home Country
    Germany Germany
    I decided to move the code to tvplugin. However I am having some trouble getting the subclassed notification dialog to work. Can somebody give me a hint on how to properly subclass the YesNo Dialog?

    I have attached the relevant part of mp.log. YesNoDialog's btnYes and btnNo variables appear to be not initialized.

    Greetings
    Splatterpop
     

    splatterpop

    MP Donator
  • Premium Supporter
  • December 17, 2007
    177
    54
    planet ASPARAGUS
    Home Country
    Germany Germany
    A quick update - GUIDialogYesNo also fails when called from tvplugin.

    GUIDialogYesNo test = new GUIDialogYesNo();
    test.SetHeading("test");
    test.SetLine(1, "me");
    test.DoModal(GUIWindowManager.ActiveWindow);

    produces the same error.

    Any ideas?
     

    DieBagger

    Retired Team Member
  • Premium Supporter
  • September 11, 2007
    2,516
    1,276
    39
    Austria
    Home Country
    Austria Austria
    Hi splatterpop,

    I think you need to create the dialog with the GUIWindowManager. From the wiki:

    Code:
    private void OnButtonTwo()
    {
      GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow(
        (int)GUIWindow.Window.WINDOW_DIALOG_OK);
      dlg.SetHeading("Button has been pressed");
      dlg.SetLine(1, "You pressed button 2");
      dlg.SetLine(2, String.Empty);
      dlg.SetLine(3, String.Empty);
      dlg.DoModal(GUIWindowManager.ActiveWindow);
    }
     

    Users who are viewing this thread

    Top Bottom