Exemplo n.º 1
0
        /// <summary>
        /// 控件的值发生变化时调用的方法
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DigitalPanelControl leds = d as DigitalPanelControl;
            string newValue          = (string)e.NewValue;

            leds.DisplayData(newValue);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 当Led数量发生变化时调用的方法
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnDigitalCountPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DigitalPanelControl leds = d as DigitalPanelControl;

            leds.digitalsList.Clear();

            if (leds.rootPanel != null)
            {
                leds.rootPanel.Children.Clear();
                leds.DrawDigitals((int)e.NewValue);
                //将Digitals 加入到rootPanel中
                foreach (DigitalControl digital in leds.digitalsList)
                {
                    leds.rootPanel.Children.Add(digital);
                }

                //显示值
                leds.DisplayData(leds.Value);
            }
        }