Ejemplo n.º 1
0
        private static void OnColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            WetChatWaitControl w = d as WetChatWaitControl;

            if (w.lstElipse != null && w.lstElipse.Count != 0)
            {
                w.lstElipse.ForEach(x => x.Fill = w.Color);
            }
        }
Ejemplo n.º 2
0
        private static void OnIsActivePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            WetChatWaitControl w = d as WetChatWaitControl;

            w.rootGrid = w.GetTemplateChild("rootGrid") as Grid;
            if (w.IsActive && w.rootGrid != null)
            {
                w.StartAnimation(null, null);
            }
        }
Ejemplo n.º 3
0
        private static void OnRadiusPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            WetChatWaitControl w = d as WetChatWaitControl;

            w.rootGrid = w.GetTemplateChild("rootGrid") as Grid;
            if (w.rootGrid == null)
            {
                return;
            }
            OnPropertyChanged(w);
        }
Ejemplo n.º 4
0
        private static void OnPropertyChanged(WetChatWaitControl w)
        {
            bool isActive = w.IsActive;

            w.IsActive = false;//先停止动画
            int animationTime      = w.AnimationTime;
            int animationDelayTime = w.AnimationDelayTime;

            ThreadPool.QueueUserWorkItem((x) =>
            {
                if (isActive)
                {
                    Thread.Sleep((animationTime + animationDelayTime) * 2); //等待之前的动画结束
                }
                w.Dispatcher.Invoke((Action)(() =>
                {
                    w.OnApplyTemplate();
                    w.IsActive = isActive;//启动动画
                }));
            });
        }