Пример #1
0
        private void PolarPanel_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            PolarPanel panel   = sender as PolarPanel;
            bool       visible = (bool)e.NewValue;

            OnPanelVisibilityChanged(panel, visible);
        }
Пример #2
0
 private void OnPanelVisibilityChanged(PolarPanel panel, bool visible)
 {
     if (visible)
     {
         Animate(panel);
     }
     else
     {
         StopAnimating(panel);
     }
 }
Пример #3
0
        private void StopAnimating(PolarPanel panel)
        {
            currentAnimatingCircles.Remove(panel);
            panels.Remove(panel);

            foreach (Shape shape in panel.Children)
            {
                shape.Fill.BeginAnimation(SolidColorBrush.ColorProperty, null);
            }

            if (currentAnimatingCircles.Count == 0)
            {
                Timer.Stop();
            }
        }
Пример #4
0
        private void Animate(PolarPanel panel)
        {
            if (currentAnimatingCircles.ContainsKey(panel))
            {
                return;
            }

            if (animation == null)
            {
                animation = this["animation"] as ColorAnimation;
            }

            panels.Add(panel);
            currentAnimatingCircles[panel] = -1;
            if (!Timer.IsEnabled)
            {
                timer.Start();
            }
        }
Пример #5
0
        private void PolarPanel_Loaded(object sender, RoutedEventArgs e)
        {
            PolarPanel panel = sender as PolarPanel;

            if (brush == null)
            {
                brush = this["brush"] as Brush;
            }

            foreach (Shape shape in panel.Children)
            {
                if (shape.Fill != null)
                {
                    break;
                }

                shape.Fill = brush.Clone();
            }

            ProcessingContentControl parent = panel.TemplatedParent as ProcessingContentControl;

            OnPanelVisibilityChanged(panel, panel.IsVisible);
        }