private void NavigationFrame_Navigated(object sender, NavigatingCancelEventArgs e) { var ta = new ThicknessAnimation(); ta.Duration = TimeSpan.FromSeconds(1); QuadraticEase EasingFunction = new QuadraticEase(); EasingFunction.EasingMode = EasingMode.EaseOut; ta.EasingFunction = EasingFunction; ta.DecelerationRatio = 0.7; ta.To = new Thickness(0, 0, 0, 0); if (!NavigateWithAnimationBool) { if (e.NavigationMode == NavigationMode.New) { ta.From = new Thickness(0, 0, 0, 0); } else if (e.NavigationMode == NavigationMode.Back) { ta.From = new Thickness(0, 0, 0, 0); } } else if (NavigateWithAnimationBool) { if (e.NavigationMode == NavigationMode.New) { ta.From = new Thickness(0, 500, 0, 0); } else if (e.NavigationMode == NavigationMode.Back) { ta.From = new Thickness(0, 0, 500, 0); } } var ta2 = new DoubleAnimation(); ta2.To = 1; ta2.From = 0; QuadraticEase EasingFunction2 = new QuadraticEase(); EasingFunction2.EasingMode = EasingMode.EaseOut; ta.EasingFunction = EasingFunction2; NavigateWithAnimationBool = false; //(e.Content as Page).BeginAnimation(MarginProperty, ta); NavigationFrame.BeginAnimation(MarginProperty, ta); NavigationFrame.BeginAnimation(OpacityProperty, ta2); }
private void NavigationFrame_Navigating(object sender, NavigatingCancelEventArgs e) { if (!inNavigation) { e.Cancel = true; navArgs = e; DoubleAnimation animation = new DoubleAnimation(); animation.From = 1f; animation.To = 0f; animation.Duration = new Duration(TimeSpan.FromMilliseconds(200)); animation.Completed += Animation_Completed; NavigationFrame.BeginAnimation(OpacityProperty, animation); inNavigation = true; } }
private void Animation_Completed(object sender, EventArgs e) { switch (navArgs.NavigationMode) { case NavigationMode.New: if (navArgs.Uri == null) { NavigationFrame.Navigate(navArgs.Content); } else { NavigationFrame.Navigate(navArgs.Uri); } break; case NavigationMode.Back: NavigationFrame.GoBack(); break; case NavigationMode.Forward: NavigationFrame.GoBack(); break; case NavigationMode.Refresh: NavigationFrame.GoBack(); break; default: break; } inNavigation = false; DoubleAnimation animation = new DoubleAnimation(); animation.From = 0f; animation.To = 1f; animation.Duration = new Duration(TimeSpan.FromMilliseconds(200)); NavigationFrame.BeginAnimation(OpacityProperty, animation); }
private void NavigationFrame_Navigating(object sender, NavigatingCancelEventArgs e) { if (inNavigation) { return; } e.Cancel = true; navArgs = e; var animation = new DoubleAnimation { From = 1f, To = 0f, Duration = new Duration(TimeSpan.FromMilliseconds(200)) }; animation.Completed += Animation_Completed; NavigationFrame.BeginAnimation(OpacityProperty, animation); inNavigation = true; }
public void changemainframeleft(int mainframekey) { Debug.Print("changemainframeleft called"); var lefttransfrommain = new ThicknessAnimation() { From = new Thickness(4000, 0, 0, 0), To = new Thickness(6000, 0, 0, 0), Duration = TimeSpan.FromMilliseconds(500), }; var lefttranstomain = new ThicknessAnimation() { From = new Thickness(2000, 0, 0, 0), To = new Thickness(4000, 0, 0, 0), Duration = TimeSpan.FromMilliseconds(500) }; var leftopacityfrommain = new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromMilliseconds(500) }; var leftopacitytomain = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromMilliseconds(500) }; Debug.Print("Animations built"); // mainframekey: 1 is settingscreen, 2 is navigation, 3 is drivescreen, 4 is fitnessscreen switch (mainframekey) // gibt an welcher screen angezeigt wird { case 0: Debug.Print("case 0 called"); break; case 1: // von setting nach fitness SettingFrame.BeginAnimation(Frame.MarginProperty, lefttransfrommain); FitnessFrame.BeginAnimation(Frame.MarginProperty, lefttranstomain); SettingFrame.BeginAnimation(Frame.OpacityProperty, leftopacityfrommain); FitnessFrame.BeginAnimation(Frame.OpacityProperty, leftopacitytomain); Debug.Print("Case 1"); break; case 2: // von navigation nach setting NavigationFrame.BeginAnimation(Frame.MarginProperty, lefttransfrommain); SettingFrame.BeginAnimation(Frame.MarginProperty, lefttranstomain); NavigationFrame.BeginAnimation(Frame.OpacityProperty, leftopacityfrommain); SettingFrame.BeginAnimation(Frame.OpacityProperty, leftopacitytomain); Debug.Print("Case 2"); break; //case 3: // von drive nach navigation DriveFrame.BeginAnimation(Frame.MarginProperty, lefttransfrommain); NavigationFrame.BeginAnimation(Frame.MarginProperty, lefttranstomain); DriveFrame.BeginAnimation(Frame.OpacityProperty, leftopacityfrommain); NavigationFrame.BeginAnimation(Frame.OpacityProperty, leftopacitytomain); Debug.Print("Case 3"); break; case 4: // von fitness nach drive FitnessFrame.BeginAnimation(Frame.MarginProperty, lefttransfrommain); DriveFrame.BeginAnimation(Frame.MarginProperty, lefttranstomain); FitnessFrame.BeginAnimation(Frame.OpacityProperty, leftopacityfrommain); DriveFrame.BeginAnimation(Frame.OpacityProperty, leftopacitytomain); Debug.Print("Case 4"); break; default: Debug.Print("no case called"); break; } }
public void changemainframeright(int mainframekey) // int direction (1 or 2) 1 is right 2 is left { var righttransfrommain = new ThicknessAnimation() { From = new Thickness(4000, 0, 0, 0), To = new Thickness(2000, 0, 0, 0), Duration = TimeSpan.FromMilliseconds(500) }; var righttranstomain = new ThicknessAnimation() { From = new Thickness(6000, 0, 0, 0), To = new Thickness(4000, 0, 0, 0), Duration = TimeSpan.FromMilliseconds(500) }; var rightopacityfrommain = new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromMilliseconds(500) }; var rightopacitytomain = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromMilliseconds(500) }; // mainframekey: 1 is settingscreen, 2 is navigation, 3 is drivescreen, 4 is fitnessscreen //right -> nach links gewischt switch (mainframekey) { case 1: //von setting nach navigation SettingFrame.BeginAnimation(Frame.MarginProperty, righttransfrommain); NavigationFrame.BeginAnimation(Frame.MarginProperty, righttranstomain); SettingFrame.BeginAnimation(Frame.OpacityProperty, rightopacityfrommain); NavigationFrame.BeginAnimation(Frame.OpacityProperty, rightopacitytomain); break; case 2: //von navigation nach drive NavigationFrame.BeginAnimation(Frame.MarginProperty, righttransfrommain); DriveFrame.BeginAnimation(Frame.MarginProperty, righttranstomain); NavigationFrame.BeginAnimation(Frame.OpacityProperty, rightopacityfrommain); DriveFrame.BeginAnimation(Frame.OpacityProperty, rightopacitytomain); break; case 3: // von drive nach fitness DriveFrame.BeginAnimation(Frame.MarginProperty, righttransfrommain); FitnessFrame.BeginAnimation(Frame.MarginProperty, righttranstomain); DriveFrame.BeginAnimation(Frame.OpacityProperty, rightopacityfrommain); FitnessFrame.BeginAnimation(Frame.OpacityProperty, rightopacitytomain); break; case 4: // von fitness nach setting FitnessFrame.BeginAnimation(Frame.MarginProperty, righttransfrommain); SettingFrame.BeginAnimation(Frame.MarginProperty, righttranstomain); FitnessFrame.BeginAnimation(Frame.OpacityProperty, rightopacityfrommain); SettingFrame.BeginAnimation(Frame.OpacityProperty, rightopacitytomain); break; } }
public void changemainframein(int mainframekey, int direction) // direction 1 is right 2 is left { ThicknessAnimation moveinright = new ThicknessAnimation() { From = new Thickness(6200, 0, 0, 50), To = new Thickness(4200, 0, 0, 50), Duration = TimeSpan.FromMilliseconds(500), AccelerationRatio = 0.4 }; ThicknessAnimation moveinleft = new ThicknessAnimation() { From = new Thickness(2200, 0, 0, 50), To = new Thickness(4200, 0, 0, 50), Duration = TimeSpan.FromMilliseconds(500), AccelerationRatio = 0.4 }; DoubleAnimation blendin = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromMilliseconds(300) }; switch (mainframekey) { case 1: //setting if (direction == 1) { SettingFrame.BeginAnimation(Frame.MarginProperty, moveinleft); } else if (direction == 2) { SettingFrame.BeginAnimation(Frame.MarginProperty, moveinright); } SettingFrame.BeginAnimation(Frame.OpacityProperty, blendin); break; case 2: //navigation if (direction == 1) { NavigationFrame.BeginAnimation(Frame.MarginProperty, moveinleft); } else if (direction == 2) { NavigationFrame.BeginAnimation(Frame.MarginProperty, moveinright); } NavigationFrame.BeginAnimation(Frame.OpacityProperty, blendin); break; case 3: //drive if (direction == 1) { DriveFrame.BeginAnimation(Frame.MarginProperty, moveinleft); } else if (direction == 2) { DriveFrame.BeginAnimation(Frame.MarginProperty, moveinright); } DriveFrame.BeginAnimation(Frame.OpacityProperty, blendin); break; case 4: //fitness if (direction == 1) { FitnessFrame.BeginAnimation(Frame.MarginProperty, moveinleft); } else if (direction == 2) { FitnessFrame.BeginAnimation(Frame.MarginProperty, moveinright); } FitnessFrame.BeginAnimation(Frame.OpacityProperty, blendin); break; default: Debug.Print("no case called"); break; } }