DSF.Net/Controllers/Process/RotateProcessHalf.xaml.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using DSF.Net.Controllers.Theme;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace DSF.Net.Controllers.Process
{
    public partial class RotateProcessHalf : UserControl,IUserTheme
    {
        public RotateProcessHalf()
        {
            InitializeComponent();
            DataContext = this;
        }
        public double Value
        {
            get { return (double)GetValue(ValueProperty); }
            set { SetValue(ValueProperty, value); }
        }

        private static readonly DependencyProperty ArcAnimationProperty =
            DependencyProperty.Register("ArcAnimation", typeof(double), typeof(RotateProcessHalf), new PropertyMetadata(0d, (s, e) =>
            {
                var c = s as RotateProcessHalf;
                var value = (double)e.NewValue;
                var full = c.Interval * 7;
                c.Arc.EndAngle = -120.5 + 240 * value / full;
            }));

        private static readonly DependencyProperty PointerAnimationProperty =
            DependencyProperty.Register("PointerAnimation", typeof(double), typeof(RotateProcessHalf), new PropertyMetadata(0d, (s, e) =>
            {
                var c = s as RotateProcessHalf;
                var value = (double)e.NewValue;
                var full = c.Interval * 7;
                c.Pointer.RenderTransform = new RotateTransform(-120 + 240 * value / full);
            }));
        private static readonly DependencyProperty ValueAnimationProperty =
            DependencyProperty.Register("ValueAnimation", typeof(double), typeof(RotateProcessHalf), new PropertyMetadata(0d, (s, e) =>
            {
                var c = s as RotateProcessHalf;
                var value = (double)e.NewValue;
                c.Speed.Content = $"{(int)value}{c.Unit}";
            }));
        // Using a DependencyProperty as the backing store for Value.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ValueProperty =
            DependencyProperty.Register("Value", typeof(double), typeof(RotateProcessHalf), new PropertyMetadata(0d, (s, e) =>
            {
                var c = s as RotateProcessHalf;
                var animate = new DoubleAnimation
                {
                    From = (double)e.OldValue,
                    To = (double)e.NewValue,
                    Duration = new Duration(new TimeSpan(0, 0, 0, 0, 800)),
                    EasingFunction = new QuarticEase()
                };
                c.BeginAnimation(ArcAnimationProperty, animate);
                c.BeginAnimation(PointerAnimationProperty, animate);
                c.BeginAnimation(ValueAnimationProperty, animate);
后面还有 65 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。