Beispiel #1
0
        private DigitalParameter GetDigitalParameter()
        {
            DigitalParameter dp = new DigitalParameter();

            dp.BevelWidth       = BevelWidth;
            dp.SegmentInterval  = SegmentInterval;
            dp.SegmentThickness = DigitalThickness;
            dp.DigitalHeight    = DigitalHeight;
            dp.DigitalWidth     = DigitalWidth;

            return(dp);
        }
Beispiel #2
0
        /// <summary>
        /// 调用模板时的方法
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            //获取根容器
            _rootPanel = GetTemplateChild("PART_Root") as Panel;

            //初始化数字片段生成器
            DigitalParameter dp = GetDigitalParameter();

            _segementCreator = new BaseLedDigitalSegmentCreator(dp);

            //初始化数字
            InitAllDigitalSegments();

            //设置初始值
            SetDisplayDigitalValue(Value);
        }
Beispiel #3
0
        /// <summary>
        /// 当led形状参数发生变化时调用的方法
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnSizePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LedDigital led = d as LedDigital;

            if (led == null || led._rootPanel == null)
            {
                return;
            }

            led._rootPanel.Children.Clear();

            //初始化数字片段生成器
            DigitalParameter dp = led.GetDigitalParameter();

            led._segementCreator = new BaseLedDigitalSegmentCreator(dp);

            //初始化数字
            led.InitAllDigitalSegments();

            //设置初始值
            led.SetDisplayDigitalValue(led.Value);
        }
Beispiel #4
0
 public BaseLedDigitalSegmentCreator(DigitalParameter parameter)
 {
     _parameter = parameter;
 }