public MainWindow() { int prC = 0; // предотвращаем запуск нескольких копий приложения foreach (Process pr in Process.GetProcesses()) { if (pr.ProcessName == "calc") { prC++; } } if (prC > 1) { Process.GetCurrentProcess().Kill(); } InitializeComponent(); if (!File.Exists(@"E:\calculations.txt")) { File.Create(@"E:\calculations.txt"); } var ripple = new DoubleAnimation // анимация тени { To = 0, AutoReverse = true, Duration = TimeSpan.FromMilliseconds(2500), RepeatBehavior = RepeatBehavior.Forever, AccelerationRatio = 0.4, DecelerationRatio = 0.3 }; Storyboard.SetTarget(ripple, b_shadow); Storyboard.SetTargetProperty(ripple, new PropertyPath("Effect.Opacity")); var storyboard = new Storyboard { Children = new TimelineCollection { ripple } }; storyboard.Begin(); DoubleAnimation WinAnimation = new DoubleAnimation(); // анимация появления окна this.Opacity = 0; WinAnimation.From = this.Opacity; WinAnimation.To = 1; WinAnimation.Duration = TimeSpan.FromMilliseconds(1100); this.BeginAnimation(Window.OpacityProperty, WinAnimation); }
public Story() { InitializeComponent(); var ripple = new DoubleAnimation // анимация тени { To = 0, AutoReverse = true, Duration = TimeSpan.FromMilliseconds(2500), RepeatBehavior = RepeatBehavior.Forever, AccelerationRatio = 0.4, DecelerationRatio = 0.3 }; Storyboard.SetTarget(ripple, b_shadow); Storyboard.SetTargetProperty(ripple, new PropertyPath("Effect.Opacity")); var storyboard = new Storyboard { Children = new TimelineCollection { ripple } }; storyboard.Begin(); string[] strok = File.ReadAllLines(@"E:\calculations.txt"); if (strok.Length != 0) { FromStory(); } if (Bot_field.Text == "") { scrolling.Visibility = Visibility.Hidden; } else { scrolling.Visibility = Visibility.Visible; } }