private void PolarPanel_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { PolarPanel panel = sender as PolarPanel; bool visible = (bool)e.NewValue; OnPanelVisibilityChanged(panel, visible); }
private void OnPanelVisibilityChanged(PolarPanel panel, bool visible) { if (visible) { Animate(panel); } else { StopAnimating(panel); } }
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(); } }
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(); } }
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); }