private async Task rollBackAnimation()
        {
            status.Visibility = Visibility.Collapsed;
            BindableMargin margin = new Views.BindableMargin(image);

            margin.Top = -Window.Current.Bounds.Height / 4;
            DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames();

            animation.EnableDependentAnimation = true;
            EasingDoubleKeyFrame f1 = new EasingDoubleKeyFrame();

            f1.Value   = -Window.Current.Bounds.Height / 4;
            f1.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.2));
            animation.KeyFrames.Add(f1);
            EasingDoubleKeyFrame f2 = new EasingDoubleKeyFrame();

            f2.EasingFunction = new PowerEase()
            {
                EasingMode = EasingMode.EaseInOut, Power = 4
            };
            f2.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.8));
            f2.Value   = -315;
            animation.KeyFrames.Add(f2);
            Storyboard.SetTarget(animation, margin);
            Storyboard.SetTargetProperty(animation, "Top");
            //Windows Phones do not need the animation
            //if (DeviceTypeHelper.GetDeviceFormFactorType() != DeviceFormFactorType.Phone)
            {
                storyboard2.Children.Add(animation);
                //storyboard.Children.Add(animation2);
            }
            //Only phones should have this step
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                //var appview = ApplicationView.GetForCurrentView();
                //appview.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
                var statusbar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
                statusbar.ForegroundColor   = Colors.White;
                statusbar.BackgroundOpacity = 0;
                await statusbar.HideAsync();
            }
            storyboard2.Completed += delegate
            {
                //Main animation finish
                BindableMargin margin2 = new Views.BindableMargin(image);
                image.Opacity = 100;
                margin2.Top   = -315;
                Data.AppDataHelper.SetValue("upasswd", "");
                //Data.AppDataHelper.SetValue("uname", "");
                Data.AppDataHelper.SetValue("isauto", false.ToString());
                Data.AppDataHelper.SetValue("isrem", false.ToString());
                Frame.Navigate(typeof(LoginPage));
            };
            storyboard2.Begin();
        }
        private void Storyboard_Completed(object sender, object e)
        {
            //Main animation finish
            BindableMargin margin2 = new Views.BindableMargin(logoimage_animated);

            logoimage_animated.Opacity = 100;
            margin2.Top           = 0;
            Data.TmpData.Username = txt_UserName.Text;
            Data.TmpData.Password = txt_Password.Password;
            storeData();
            (Window.Current.Content as Frame).Navigate(typeof(LoadingPage));
        }
        private async Task logoAnimation()
        {
            //Perform the animations
            BindableMargin margin = new Views.BindableMargin(logoimage_animated);

            margin.Top = -315;
            DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames();

            animation.EnableDependentAnimation = true;
            EasingDoubleKeyFrame f1 = new EasingDoubleKeyFrame();

            f1.Value   = -315;
            f1.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.2));
            animation.KeyFrames.Add(f1);
            EasingDoubleKeyFrame f2 = new EasingDoubleKeyFrame();

            f2.EasingFunction = new PowerEase()
            {
                EasingMode = EasingMode.EaseInOut, Power = 4
            };
            f2.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.8));
            f2.Value   = 0;
            animation.KeyFrames.Add(f2);
            Storyboard.SetTarget(animation, margin);
            Storyboard.SetTargetProperty(animation, "Top");
            //Windows Phones do not need the animation
            //if (DeviceTypeHelper.GetDeviceFormFactorType() != DeviceFormFactorType.Phone)
            {
                storyboard.Children.Add(animation);
            }
            //Only phones should have this step
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                //var appview = ApplicationView.GetForCurrentView();
                //appview.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);//不能这样做,这样做可能会导致无法适应虚拟导航栏
                var statusbar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
                statusbar.ForegroundColor   = Colors.White;
                statusbar.BackgroundOpacity = 0;
                await statusbar.HideAsync();
            }
            storyboard.Completed += Storyboard_Completed;
            storyboard.Begin();
        }
 public LoadingPage(string Username, string Password)
 {
     this.InitializeComponent();
     //settitlecolor();
     Loaded += async delegate
     {
         //Perform the animations
         BindableMargin margin = new Views.BindableMargin(image);
         DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames();
         animation.EnableDependentAnimation = true;
         EasingDoubleKeyFrame f1 = new EasingDoubleKeyFrame();
         f1.Value   = 0;
         f1.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.2));
         animation.KeyFrames.Add(f1);
         EasingDoubleKeyFrame f2 = new EasingDoubleKeyFrame();
         f2.EasingFunction = new PowerEase()
         {
             EasingMode = EasingMode.EaseInOut, Power = 4
         };
         f2.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.8));
         f2.Value   = -Window.Current.Bounds.Height / 4;
         animation.KeyFrames.Add(f2);
         Storyboard.SetTarget(animation, margin);
         Storyboard.SetTargetProperty(animation, "Top");
         //DoubleAnimation animation2 = new DoubleAnimation();
         //Storyboard.SetTarget(animation2, image);
         //Storyboard.SetTargetProperty(animation2, "Opacity");
         //animation2.Duration = new Duration(TimeSpan.FromSeconds(1));
         //animation2.From = 0;
         //animation2.To = 100;
         //Windows Phones do not need the animation
         //if (DeviceTypeHelper.GetDeviceFormFactorType() != DeviceFormFactorType.Phone)
         {
             storyboard.Children.Add(animation);
             //storyboard.Children.Add(animation2);
         }
         //Only phones should have this step
         if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
         {
             //var appview = ApplicationView.GetForCurrentView();
             //appview.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
             var statusbar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
             statusbar.ForegroundColor   = Colors.White;
             statusbar.BackgroundOpacity = 0;
             await statusbar.HideAsync();
         }
         storyboard.Completed += delegate
         {
             //Main animation finish
             BindableMargin margin2 = new Views.BindableMargin(image);
             image.Opacity = 100;
             margin2.Top   = -Window.Current.Bounds.Height / 4;
             ring.IsActive = true;
             BeginLoading(Username, Password);
         };
         storyboard.Begin();
     };
     SizeChanged += delegate
     {
         if (!isLoaded)
         {
             isLoaded = true;
             return;
         }
         BindableMargin margin = new Views.BindableMargin(image);
         storyboard.Stop();
         image.Opacity = 100;
         margin.Top    = -Window.Current.Bounds.Height / 4;
     };
 }