Update() 공개 메소드

public Update ( ) : void
리턴 void
예제 #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.");
    }
예제 #2
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.");
        }