private void InitalizeBattlefield() { Thread InitThread = new Thread(() => { CurrentRoom.Battlefield = new Battlefield(); CurrentRoom.Battlefield.Init(CurrentRoom); this.Dispatcher.Invoke(() => { var ProgressAnimation = new DoubleAnimation() { From = 0, To = 100, Duration = TimeSpan.FromSeconds(2), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseInOut } }; ProgressAnimation.Completed += delegate { LeaveAction = delegate { MainWindow.Instance.EnterBattlefield(CurrentRoom.Battlefield); }; this.PageLeave(); }; Progress.BeginAnimation(RangeBase.ValueProperty, ProgressAnimation); }); }) { Name = "初始化战场进程" }; InitThread.Start(); }
private void SplashWindowLoaded(object sender, RoutedEventArgs e) { DoubleAnimation anim = new DoubleAnimation() { From = 0, To = 100, Duration = TimeSpan.FromMilliseconds(1000) }; anim.Completed += ProgressCompleted; Progress.BeginAnimation(System.Windows.Controls.Primitives.RangeBase.ValueProperty, anim); var relics = Repository <Relic> .Get(); var vm = new MainWindowViewModel() { Plugins = LoadPlugins() }; var cp = vm.CurrentPlugin; var cc = vm.CurrentContent; mainWindow = new MainWindow() { DataContext = vm }; Application.Current.MainWindow = mainWindow; }
public void SetValue(double value) { DoubleAnimation animation = new DoubleAnimation(value, new TimeSpan(0, 0, 0, 0, 200)); animation.AccelerationRatio = .5; animation.DecelerationRatio = .5; Progress.BeginAnimation(ProgressBar.ValueProperty, animation); }
private void AdvanceProgressValue() { DoubleAnimation da = new DoubleAnimation(); da.To = Progress.Value + 1; da.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 200)); Progress.BeginAnimation(System.Windows.Controls.ProgressBar.ValueProperty, da); }