MediaPortal.ProcessPlugins.MiniDisplayPlugin.DisplayHandler.DisplayLines C# (CSharp) Method

DisplayLines() public method

public DisplayLines ( ) : void
return void
    public void DisplayLines()
    {
      if (Settings.Instance.ExtensiveLogging)
      {
        Log.Info("MiniDisplayPlugin.DisplayHandler.DisplayLines(): Sending lines to display.");
      }
      try
      {
        if (this.display.SupportsGraphics)
        {
          this.SendGraphics();
        }
        if (this.display.SupportsText && !this.forceGraphicText)
        {
          this.SendText();
        }
      }
      catch (Exception exception)
      {
        Log.Error(
          "MiniDisplayPlugin.DisplayHandler.DisplayLines(): CAUGHT EXCEPTION {0}\n\n{1}\n\n", exception.Message,
          new object[] {exception.StackTrace});
      }
    }

Usage Example

Ejemplo n.º 1
0
    //Render thread entry point
    public void Run()
    {
      SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(this.SystemEvents_PowerModeChanged);
      bool flag2 = false;
      Settings.Instance.LogInfo("MiniDisplay.Run(): Entering MiniDisplay run loop.");
      try
      {
        Settings.Instance.LogInfo("MiniDisplay.Run(): Creating MiniDisplay displayhandler.");
        this.handler = new DisplayHandler(this.display);
        Settings.Instance.LogInfo("MiniDisplay.Run(): Starting MiniDisplay displayhandler.");
        this.handler.Start();
        while (!this.stopRequested)
        {
          if (!Settings.Instance.Type.Equals("MCEDisplay"))
          {
            try
            {
              // It's not safe to call this method in other states than running, since
              // it calls the window manager. It might cause a dead lock in other states
              if (GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.RUNNING)
              {
                DoWork();
              }
            }
            catch (Exception exception)
            {
              Log.Debug("MiniDisplay.Run(): CAUGHT EXCEPTION in DoWork() - {0}", exception);
              if (exception.Message.Contains("ThreadAbortException"))
              {
                this.stopRequested = true;
              }
            }
            try
            {
                // It's not safe to call this method in other states than running, since
                // it calls the window manager. It might cause a dead lock in other states
                if (GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.RUNNING)
                {
                    //Is it time for us to scroll our texts?                    
                    if ((DateTime.Now - this.lastScroll).TotalMilliseconds >= Settings.Instance.ScrollDelay)
                    {
                        this.lastScroll = DateTime.Now; //Mark the time
                        //Take care of scrolling our texts
                        handler.DisplayLines();
                    }

                    //Do update regardless of whether or not we scrolled our texts
                    handler.Update();
                }
            }
            catch (Exception exception2)
            {
              Log.Debug("MiniDisplay.Run(): CAUGHT EXCEPTION in handler.DisplayLines() - {0}", exception2);
              if (exception2.Message.Contains("ThreadAbortException"))
              {
                this.stopRequested = true;
              }
            }
            Settings.Instance.LogDebug("MiniDisplay.Run(): MiniDisplay Sleeping...");
            Thread.Sleep(Settings.Instance.UpdateDelay);
            Settings.Instance.LogDebug("MiniDisplay.Run(): MiniDisplay Sleeping... DONE");         
          }
          else
          {
            Thread.Sleep(100);
          }
        }

        Settings.Instance.LogInfo("MiniDisplay.Run(): Stopping MiniDisplay displayhandler.");
        flag2 = true;
        this.handler.Stop();
      }
      catch (ThreadAbortException)
      {
        Log.Error("MiniDisplay.Run(): CAUGHT ThreadAbortException");
        if (!flag2)
        {
          this.handler.Stop();
          flag2 = true;
        }
      }
      catch (Exception exception3)
      {
        Log.Error("MiniDisplay.Run(): CAUGHT EXCEPTION: {0}", exception3);
      }
      Settings.Instance.LogInfo("MiniDisplay.Run(): Exiting MiniDisplay run loop.");
    }
All Usage Examples Of MediaPortal.ProcessPlugins.MiniDisplayPlugin.DisplayHandler::DisplayLines