Exemple #1
0
 /// <summary>
 /// Goto the next character in the string. Usually not so tricky except when we run
 /// out of gas. Then we act accoring to the mode of the control
 /// <list type="bullet">
 /// <item>Continous - we start the string over again</item>
 /// <item>SingleShot - scroll it once then stop. We raise an event
 /// to tell the user that we are complete</item>
 /// </list>
 /// </summary>
 private void RackCharacter()
 {
     this.offset += 1;
     if (this.offset >= this.ledStates.Length)
     {
         this.offset      = 0;
         this.textOffset += 1;
         if (this.textOffset < this.Text.Length)
         {
             this.ledStates = MatrixLedCharacterDefinitions.GetDefinition(String.Empty + this.Text[this.textOffset]);
         }
         else
         {
             if (this.Mode == MarqueeMode.Continuous)
             {
                 this.textOffset = 0;
                 this.ledStates  = MatrixLedCharacterDefinitions.GetDefinition(String.Empty + this.Text[this.textOffset]);
             }
             else if (this.Mode == MarqueeMode.SingleShot)
             {
                 this.textExists = false;
                 this.OnMarqueeFinished();
             }
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// Initialize a text string that is to be animated
 /// </summary>
 private void InitializeAnimatedText()
 {
     this.offset     = 0;
     this.textOffset = 0;
     if (!String.IsNullOrEmpty(this.Text))
     {
         this.ledStates  = MatrixLedCharacterDefinitions.GetDefinition(String.Empty + this.Text[this.textOffset]);
         this.textExists = true;
     }
     else
     {
         this.textExists = false;
     }
 }
Exemple #3
0
        /// <summary>
        /// Initialize all columns from a definition in the Character defintion
        /// </summary>
        private void UpdateLedsFromCharacter()
        {
            byte[] bytes = MatrixLedCharacterDefinitions.GetDefinition(this.Text);
            this.columns.Clear();
            for (int i = 0; i < bytes.Length - 1; i++)
            {
                List <bool> n = new List <bool>
                {
                    (bytes[i] & 0x40) != 0,
                    (bytes[i] & 0x20) != 0,
                    (bytes[i] & 0x10) != 0,
                    (bytes[i] & 0x08) != 0,
                    (bytes[i] & 0x04) != 0,
                    (bytes[i] & 0x02) != 0,
                    (bytes[i] & 0x01) != 0,
                };
                this.columns.Add(n);
            }

            this.UpdateLedsFromState();
        }