85 lines
2.1 KiB
C#
85 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Animation;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace F4SDicons.User_Controls
|
|
{
|
|
public partial class ZoomViewer : UserControl
|
|
{
|
|
public ZoomViewer()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
#region Variables
|
|
|
|
bool zoomReachedMinimum = false;
|
|
|
|
#endregion
|
|
|
|
#region Value
|
|
|
|
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
|
{
|
|
double iconZoom = e.NewValue / 100;
|
|
currentIcon.IconHeight = 100 * iconZoom;
|
|
currentIcon.IconWidth = 100 * iconZoom;
|
|
|
|
if (iconZoom == 0.5)
|
|
{
|
|
zoomReachedMinimum = true;
|
|
}
|
|
|
|
if (zoomReachedMinimum == true && iconZoom == 2.0)
|
|
{
|
|
RotateEasterEgg();
|
|
zoomReachedMinimum = false;
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region RotateIcon
|
|
|
|
private void RotateEasterEgg()
|
|
{
|
|
Storyboard storyboard = new Storyboard();
|
|
|
|
DoubleAnimation animation = new DoubleAnimation();
|
|
animation.From = 0;
|
|
animation.To = 360;
|
|
animation.Duration = new Duration(TimeSpan.FromSeconds(1));
|
|
storyboard.Children.Add(animation);
|
|
|
|
|
|
Storyboard.SetTarget(animation, currentIcon);
|
|
Storyboard.SetTargetProperty(animation, new PropertyPath("(Control.RenderTransform).(RotateTransform.Angle)"));
|
|
|
|
storyboard.Begin();
|
|
}
|
|
|
|
internal void ZoomSlider_ButtonUp(object sender, MouseButtonEventArgs e)
|
|
{
|
|
zoomReachedMinimum = false;
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|