Esempio n. 1
0
 /// <summary>
 /// Stops the text scrolling on the screen.
 /// </summary>
 /// <param name="ResetText">If true will reset the scrolling text pos.</param>
 public void StopScroll(bool ResetText)
 {
     this._scrolling = false;
     this._scrollingThread.Abort();
     if (ResetText)
     {
         _display.WriteLine(this.Line, this.Text.Substring(0, 20), 0, false);
     }
 }
        /// <summary>
        /// This code is based off code from Programming 32-bit Microcontrollers in C By: Lucio Di Jasio
        /// </summary>
        private void updateProgress()
        {
            //Scale the bar base on size.
            int _width = 0;

            try
            {
                _width = _value * (BarSize * 5) / MaxValue;
            }
            //We really don't care if we divide by zero
            catch (DivideByZeroException ex)
            {
            }

            int _remainder = _width % 5;

            string _strToWrite = "";

            if (AddOutline)
            {
                _strToWrite += @"\250";
            }

            //Here we loop for each 5 in the value we add a full block
            try
            {
                for (int _count = _width / 5; _count > 0; _count--)
                {
                    _strToWrite += @"\208";
                }
            }
            //We really don't care if we divide by zero
            catch (DivideByZeroException ex)
            {
            }

            //If we have a remainder we add the right bar
            switch (_remainder)
            {
            case 1:
                _strToWrite += @"\212";
                break;

            case 2:
                _strToWrite += @"\211";
                break;

            case 3:
                _strToWrite += @"\210";
                break;

            case 4:
                _strToWrite += @"\209";
                break;
            }

            //Calc if we need to pad (This is to clear any other chars that might be in our space
            int _pad = BarSize - (_strToWrite.Length / 4);

            //the padd  function
            for (int _count = 0; _count < _pad; _count++)
            {
                _strToWrite += @"\032";
            }

            if (AddOutline)
            {
                _strToWrite += @"\252";
            }

            //Lastly we write the string out
            _display.WriteLine(DisplayLine, _strToWrite, BarOffset, false);
        }