[solved] Latest Media Handler Additional facade controls (2 Viewers)

ajs

Development Group
  • Team MediaPortal
  • February 29, 2008
    16,039
    11,112
    Kyiv
    Home Country
    Ukraine Ukraine
    At startup, the plugin can not find the facade
    Very strange ...
    I create test function for facade determine,
    C#:
    facade = gw.GetControl(ControlID) as GUIFacadeControl;
    if facade == null, then function print all children control and i get:
    On startup:
    Code:
    22-Jan-2018 22:46:25 Debug [LatestMyVideosHandle]: *** InitFacade: LatestMyVideos: 1 
    22-Jan-2018 22:46:26 Debug [               Utils]: GetLatestsFacade: Unable to find facade control [id:919198710].
    In Children List no control with ID = 919198710 :(

    But if i switch to Home window and back, i give:
    Code:
    22-Jan-2018 23:02:53 Debug [               Utils]: GetLatestsFacade II: Control [id:919198710] - MediaPortal.GUI.Library.GUIFacadeControl - MediaPortal.GUI.Library.GUIFacadeControl 
    ...
    22-Jan-2018 23:02:53 Debug [               Utils]: GetLatestsFacade: Found facade control [id:919198710]. 
    ...
    22-Jan-2018 23:02:53 Debug [               Utils]: *** UpdateFacade: 919198710 - Filmstrip
    And all work fine ...
    upload_2018-1-22_22-32-8.png

    @Developers @Sebastiii need help, why on startup not all control in Children list?
    May be MP1-4887 made some changes, and it is necessary to define something like that on another. Previously it worked perfectly. But in what version I do not remember.

    C#:
        /// <summary>
        /// Check if Window fully loaded
        /// </summary>
        /// <param name="self"></param>
        public static bool WindowIsLoaded(this GUIWindow self)
        {
          int _focused = self.GetFocusControlId();
          // logger.Debug("*** WindowIsLoaded: W: {0}  - {1}:{2}", self.GetID, self.WindowLoaded, _focused > 0);
          return self.WindowLoaded && _focused >= 0;
        }
    
        internal static GUIFacadeControl GetLatestsFacade(int ControlID)
        {
          if (GUIWindowManager.ActiveWindow <= (int)GUIWindow.Window.WINDOW_INVALID)
          {
            return null;
          }
    
          GUIWindow gw = null;
          lock (lockObject)
          {
            try
            {
              do
              {
                gw = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow);
                if (gw == null)
                {
                  return null;
                }
    
                ThreadToSleep();
              }
              while (!gw.WindowIsLoaded());
            }
            catch (Exception ex)
            {
              logger.Debug("GetLatestsFacade: " + GUIWindowManager.ActiveWindow);
              logger.Error("GetLatestsFacade: " + ex);
            }
    
            int i = 0;
            GUIFacadeControl facade = null;
            try
            {
              bool bReady;
              do
              {
                facade = gw.GetControl(ControlID) as GUIFacadeControl;
                if (facade == null)
                {
                  i++;
                  bReady = false;
                  Thread.Sleep(100);
                }
                else
                {
                  bReady = true;
                }
              }
              while (i < 5 && !bReady);
            }
            catch (Exception ex)
            {
              logger.Debug("GetLatestsFacade: " + GUIWindowManager.ActiveWindow + " - " + ControlID);
              logger.Error("GetLatestsFacade: " + ex);
            }
    
            if (facade == null)
            {
              logger.Debug("GetLatestsFacade: Unable to find facade control [id:{0}].", ControlID);
              facade = gw.Children.GetControlById(ControlID) as GUIFacadeControl;
              if (facade == null)
              {
                foreach (GUIControl c in gw.Children)
                {
                  if (c.GetID > 0)
                  {
                    logger.Debug("GetLatestsFacade II: Control [id:{0}] - {1} - {2}", c.GetID, c, c.GetType());
                  }
                  if (c.GetID == ControlID)
                  {
                    facade = c as GUIFacadeControl;
                    if (facade == null)
                    {
                      logger.Debug("GetLatestsFacade III: Unable to find facade control [id:{0}].", ControlID);
                    }
                    else
                    {
                      logger.Debug("GetLatestsFacade III: Found facade control [id:{0}].", ControlID);
                    }
                  }
                }
              }
              else
              {
                logger.Debug("GetLatestsFacade II: Found facade control [id:{0}].", ControlID);
              }
            }
            else
            {
              logger.Debug("GetLatestsFacade: Found facade control [id:{0}].", ControlID);
            }
            return facade;
          }
        }
     

    wizard123

    Retired Team Member
  • Premium Supporter
  • January 24, 2012
    2,569
    2,680
    Home Country
    United Kingdom United Kingdom
    • Thread starter
    • Moderator
    • #53
    Very strange, i hope the guys can help you because this has huge potential for skin designs.
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,039
    11,112
    Kyiv
    Home Country
    Ukraine Ukraine
    There are 2 commits for it. Yep maybe this is MP1-4887 that breaking it, so to be sure, this need to be tested against the change.
    All LMH controls in Titanius skin in include xml ...
    XML:
    <include condition="#(plugin.isenabled('Latest Media Handler'))">BasicHome.LatestMyVideosFacade.xml</include>
    Maybe delay load? Or? Background in thread?
    I dont Debug MP with LMH on my test computer :( ...
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,039
    11,112
    Kyiv
    Home Country
    Ukraine Ukraine
    Implemented in LatestMediaHandler 2.4.0.66 :):whistle::coffee:
     

    Users who are viewing this thread

    Similar threads

    Hi, I'll move this into an own thread under "feature requests". I like the idea, but I think we can currently not implement this with further changes. I've checked the models and there are no variables, that could be easily called.
    Hi, I'll move this into an own thread under "feature requests". I like the idea, but I think we can currently not implement this...
    MP2 is great, but I‘d rely one change. I can have optional help texts, which are nice for a first time use, but then do not have...
    Replies
    1
    Views
    2K
    Yes, unfortunately, this would need a code change to support it. Next time I'm doing something on the plugin I'll try and remember to add support for this sort order.
    Yes, unfortunately, this would need a code change to support it. Next time I'm doing something on the plugin I'll try and...
    Hi, I was wondering if there is anyone who might be able to help me out. Is there a way to either use the sort feature and/or a...
    Replies
    6
    Views
    1K
    • Sticky
    Software Developer C# The MediaPortal 2 team is seeking committed people to strengthen its developer basis Are you interested in driving the development of an advanced HTPC software? Would you like new features get implemented faster? Well, then join us! What we offer: Almost unlimited creative leeway The possibility to closely...
    Software Developer C# The MediaPortal 2 team is seeking committed people to strengthen its developer basis Are you interested in...
    Software Developer C# The MediaPortal 2 team is seeking committed people to strengthen its developer basis Are you interested in...
    Replies
    0
    Views
    6K
    I have all of my media on a NAS. I guess it might just be a network issue, then.
    I have all of my media on a NAS. I guess it might just be a network issue, then.
    Whenever I go into the back end for Moving Pictures, it almost immediately hangs on the Movie Importer tab. If I want to go into...
    Replies
    4
    Views
    971
    If anyone ever experiences the above, I found a fix. Removing and reinstalling MP-TVSeries fixed it. It must have gotten corrupted during the reinstall of MP. I also had to do the same with TRAKT which had some issues too that were not apparent at the time. All is well once again. :cool:
    If anyone ever experiences the above, I found a fix. Removing and reinstalling MP-TVSeries fixed it. It must have gotten corrupted...
    After much trial and error and comparing this computer with another that was working, I finally found out that Fanarthandler...
    Replies
    1
    Views
    1K
    Top Bottom