Esempio n. 1
0
        /// <summary>
        /// The text property changed, deal with it
        /// </summary>
        /// <param name="dependancy">The dependancy.</param>
        /// <param name="args">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        private static void TextPropertyChanged(DependencyObject dependancy, DependencyPropertyChangedEventArgs args)
        {
            MatrixLedCharacter instance = dependancy as MatrixLedCharacter;

            if (instance != null)
            {
                if (instance.Text != null && instance.DashboardLoaded)
                {
                    instance.UpdateLedsFromCharacter();
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// The color property has changed, deal with it
        /// </summary>
        /// <param name="dependancy">The dependancy.</param>
        /// <param name="args">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        private static void ColorPropertyChanged(DependencyObject dependancy, DependencyPropertyChangedEventArgs args)
        {
            MatrixLedCharacter instance = dependancy as MatrixLedCharacter;

            instance.LedColorChanged();

            if (instance != null && instance.DashboardLoaded)
            {
                if (instance.LedOnColor != null)
                {
                    instance.UpdateLedsFromState();
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// We know we are not motionless so we animate
        /// </summary>
        private void AnimanteNonMotionless()
        {
            MatrixLedCharacter first = this.characters[this.characters.Count - 1];

            if (!this.textExists)
            {
                first.ScrollOne(null, new MatrixScrollEventArgs(new List <bool> {
                    false, false, false, false, false, false
                }));
            }
            else
            {
                first.ScrollOne(null, this.GetNextVerticalStrip());
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Fill the control with the required number of panels
        /// </summary>
        private void UpdatePanels()
        {
            _stackpanel.Children.Clear();
            this.characters.Clear();
            for (int i = 0; i < this.Panels; i++)
            {
                MatrixLedCharacter ch = new MatrixLedCharacter();
                ch.DashboardLoaded = true;
                ch.LedOnColor      = this.LedOnColor;
                ch.LedOffColor     = this.LedOffColor;
                this.characters.Add(ch);
                _stackpanel.Children.Add(ch);

                if (this.characters.Count > 1)
                {
                    MatrixLedCharacter prev = this.characters[i - 1];
                    ch.ScrollOut += new EventHandler <MatrixScrollEventArgs>(prev.ScrollOne);
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Initialize all columns from a definition in the Character defintion
        /// </summary>
        internal void SetLedsFromCharacter(string t, MatrixLedCharacter matrixLedCharacter)
        {
            byte[] bytes = MatrixLedCharacterDefinitions.GetDefinition(t);
            _matrixLedCharacter = matrixLedCharacter;

            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,
                };
                columns.Add(n);
            }
            SetLedsFromState();
        }
        /// <summary>
        /// Fill the control with the required number of panels
        /// </summary>
        private void UpdatePanels()
        {
            _stackpanel.Children.Clear();
            this.characters.Clear();
            for (int i = 0; i < this.Panels; i++)
            {
                MatrixLedCharacter ch = new MatrixLedCharacter();
                ch.DashboardLoaded = true;
                ch.LedOnColor = this.LedOnColor;
                ch.LedOffColor = this.LedOffColor;
                this.characters.Add(ch);
                _stackpanel.Children.Add(ch);

                if (this.characters.Count > 1)
                {
                    MatrixLedCharacter prev = this.characters[i - 1];
                    ch.ScrollOut += new EventHandler<MatrixScrollEventArgs>(prev.ScrollOne);
                }
            }
        }