Ejemplo n.º 1
0
        private void ArticleClicked(object sender, ItemClickEventArgs e)
        {
            var articleIndex = Array.IndexOf(ViewModel.Articles, e.ClickedItem);

            var container = ArticlesGridView.ContainerFromItem(e.ClickedItem) as GridViewItem;

            if (container != null)
            {
                var root  = (FrameworkElement)container.ContentTemplateRoot;
                var image = (UIElement)root.FindName("Image");

                ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("Image", image);
            }

            // Add a fade out effect
            Transitions = new TransitionCollection();
            Transitions.Add(new ContentThemeTransition());

            Frame.Navigate(typeof(ArticlePage), _navigatedIndex = articleIndex);
        }
Ejemplo n.º 2
0
        public void FadeInPage()
        {
            if (!Service.Platform.AnimationsEnabled)
            {
                return;
            }
            var openLeft  = ConnectedAnimationService.GetForCurrentView().GetAnimation("openL");
            var openRight = ConnectedAnimationService.GetForCurrentView().GetAnimation("openR");

            if (openLeft != null || openRight != null)
            {
                ImagesRoot.SetVisualOpacity(1);
            }
            else
            {
                FadeIn.Start(ImagesRoot);
            }
            openLeft?.TryStart(LeftImage);
            openRight?.TryStart(RightImage);
        }
Ejemplo n.º 3
0
        private void ItemsRepeater_Loaded(object sender, RoutedEventArgs e)
        {
            var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("backAnimation");

            if (animation != null)
            {
                //var element = ItemsRepeater.GetOrCreateElement(_index);
                //// ensure the item is given a valid position
                //element.UpdateLayout();


                //element.StartBringIntoView(new BringIntoViewOptions()
                //{

                //});

                //var image = element.GetFirstDescendantOfType<Image>();
                //animation.TryStart(image);
            }
        }
Ejemplo n.º 4
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.Animation.ConnectedAnimationService"))
     {
         var anim = ConnectedAnimationService.GetForCurrentView().GetAnimation("QuestionRoot");
         if (anim != null)
         {
             anim.TryStart(grdQuestion);
         }
         else
         {
             anim = ConnectedAnimationService.GetForCurrentView().GetAnimation("ProfilePicture");
             if (anim != null)
             {
                 anim.TryStart(App.ViewModelLocator.Question.LastClickedProfilePic);
             }
         }
     }
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var articleIndex = (int)e.Parameter;

            ViewModel.LoadArticle(articleIndex);

            var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("Image");

            //if (animation != null)
            //{
            //    animation.TryStart(Image);
            //    Image.Opacity = 1;
            //}

            Image.Opacity = 1;
            animation.TryStart(Image);


            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = Frame.CanGoBack ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed;
        }
Ejemplo n.º 6
0
        protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            _persistedPosition = ListViewPersistenceHelper.GetRelativeScrollPosition(itemGridView, GetKey);
            base.OnNavigatingFrom(e);

            if (e.Cancel)
            {
                return;
            }
            if (e.NavigationMode == NavigationMode.Back)
            {
                _persistedPosition = null;
                var animation = ConnectedAnimationService.GetForCurrentView()
                                .PrepareToAnimate(CONNECTED_ANIMATION_HOSTED_CONFIG_NAME, hostedConfigNameTextBlock);
                if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.Animation.DirectConnectedAnimationConfiguration"))
                {
                    animation.Configuration = new DirectConnectedAnimationConfiguration();
                }
            }
        }
        private void MemoryGridView_OnItemClick(object sender, ItemClickEventArgs e)
        {
            MemoryModel item = e.ClickedItem as MemoryModel;

            if (item == null)
            {
                return;
            }
            // 进入街景界面
            var rootFrame = Window.Current.Content as Frame;

            // connected animation
            ConnectedAnimationService.GetForCurrentView().DefaultDuration = TimeSpan.FromSeconds(0.5);
            var gridView = sender as GridView;

            // TODO 14393 15063
            gridView?.PrepareConnectedAnimation("CoverImage", item, "CoverImage");
            rootFrame?.Navigate(typeof(MemoryDetailPage), item);
            Window.Current.Content = rootFrame;
        }
Ejemplo n.º 8
0
        private async void MainGridView_Loaded(object sender, RoutedEventArgs e)
        {
            if (_storeditem != null)
            {
                MainGridView.ScrollIntoView(_storeditem, ScrollIntoViewAlignment.Default);
                MainGridView.UpdateLayout();

                ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("BackConnectedAnimation");
                if (animation != null)
                {
                    animation.IsScaleAnimationEnabled = true;
                    animation.Configuration           = new DirectConnectedAnimationConfiguration();
                    animation.Completed += (_sender, _e) =>
                    {
                        MainGridView.ContainerFromItem(_storeditem).SetValue(OpacityProperty, 1.0d);
                    };
                    await MainGridView.TryStartConnectedAnimationAsync(animation, _storeditem, "PlaceImage");
                }
            }
        }
Ejemplo n.º 9
0
        private void FunctionList_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!(e.ClickedItem is FunctionData function))
            {
                return;
            }

            // Don't animate the first item since it is already in its final position on the EditBar.
            if (function.Id != 1 && FunctionList.ContainerFromItem(function) is UIElement container)
            {
                ConnectedAnimationService.GetForCurrentView().PrepareToAnimate(BeginEditAnimationName, container);
            }

            AppTelemetry.Current.TrackEvent(
                TelemetryEvents.EditFunction,
                TelemetryProperties.Function,
                function.Name);

            OnFunctionEdited(function);
        }
        void PlayConnectedAnimation()
        {
            if (NavigationRootPage.Current.PageHeader != null)
            {
                var connectedAnimation = ConnectedAnimationService.GetForCurrentView().GetAnimation("controlAnimation");

                if (connectedAnimation != null)
                {
                    var target = NavigationRootPage.Current.PageHeader.TitlePanel;

                    // Setup the "basic" configuration if the API is present.
                    if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
                    {
                        connectedAnimation.Configuration = new BasicConnectedAnimationConfiguration();
                    }

                    connectedAnimation.TryStart(target, new UIElement[] { descriptionText });
                }
            }
        }
Ejemplo n.º 11
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (Frame.CanGoBack)
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                Frame.GoBack();
            }

            ConnectedAnimation imageAnimation     = ConnectedAnimationService.GetForCurrentView().GetAnimation("image");
            ConnectedAnimation rpAnimation        = ConnectedAnimationService.GetForCurrentView().GetAnimation("buttonLogin");
            ConnectedAnimation logoAnimation      = ConnectedAnimationService.GetForCurrentView().GetAnimation("logo");
            ConnectedAnimation loginTextAnimation = ConnectedAnimationService.GetForCurrentView().GetAnimation("loginText");

            imageAnimation?.TryStart(cityDest);
            rpAnimation?.TryStart(rp_principal);
            logoAnimation?.TryStart(logoDest);
            loginTextAnimation?.TryStart(t_loginTextDest);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 播放视频列表
 /// </summary>
 /// <param name="aid">AV号</param>
 /// <param name="videoList">播放列表</param>
 public void PlayVideoList(int aid, object sender, List <VideoDetail> videoList)
 {
     CurrentSubPageControl.CheckSubReplyPage();
     SelectedSideMenuItem = null;
     if (sender != null && IsEnableAnimation)
     {
         var image = VisualTreeExtension.VisualTreeFindName <FrameworkElement>((FrameworkElement)sender, "VideoCover");
         ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("VideoConnectedAnimation", image);
     }
     if (App._isTabletMode)
     {
         CurrentTopPanel.SetSelectedItem(AppMenuItemType.Line);
         TabletMainPage.Current.NavigateToPage(AppMenuItemType.VideoPlayer, new Tuple <int, List <VideoDetail> >(aid, videoList));
     }
     else
     {
         CurrentSidePanel.SetSelectedItem(AppMenuItemType.Line);
         CurrentPagePanel.NavigateToPage(AppMenuItemType.VideoPlayer, new Tuple <int, List <VideoDetail> >(aid, videoList));
     }
 }
Ejemplo n.º 13
0
        private async void back_to_main_Click(object sender, RoutedEventArgs e)
        {
            ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("backwardsAnimation", destinationElement);

            // Collapse the smoke when the animation completes.
            animation.Completed += Animation_Completed;

            // If the connected item appears outside the viewport, scroll it into view.
            servers.ScrollIntoView(_storedItem, ScrollIntoViewAlignment.Default);
            servers.UpdateLayout();

            // Use the Direct configuration to go back (if the API is available).
            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
            {
                animation.Configuration = new DirectConnectedAnimationConfiguration();
            }

            // Play the second connected animation.
            await servers.TryStartConnectedAnimationAsync(animation, _storedItem, "connectedElement");
        }
Ejemplo n.º 14
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (e.Parameter != null)
            {
                playList = (NCPlayList)e.Parameter;
            }

            Task.Run((() =>
            {
                Invoke(() =>
                {
                    LoadSongListDetail();
                    LoadSongListItem();
                });
            }));
            ConnectedAnimation anim = ConnectedAnimationService.GetForCurrentView().GetAnimation("SongListExpand");

            anim?.TryStart(RectangleImage);
        }
Ejemplo n.º 15
0
        private void Top3_Click(object sender, RoutedEventArgs e)
        {
            // Pre-fall creator has different image loading order
            // unable to share same connected animation code without breaking the UI
            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5))
            {
                var root  = (Button)sender;
                var image = ((UIElement)((Border)root.Content).Child) as ImageCropper;

                ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("PreviewImage", image.ImageInside);
            }



            if ((sender as Button).DataContext is Post post)
            {
                ImagePage.PostDataStack.Push(null);
                (Window.Current.Content as AppShell).AppFrame.Navigate(typeof(ImagePage), post.ToXml(), new SuppressNavigationTransitionInfo());
            }
        }
Ejemplo n.º 16
0
        private void CoverImageOnImageProcessed(object sender, RoutedEventArgs routedEventArgs)
        {
            CoverImage.ImageProcessed -= CoverImageOnImageProcessed;
            var coverAnim = ConnectedAnimationService.GetForCurrentView().GetAnimation(ConnectedAnimationKeys.CoverTransition);

            coverAnim?.TryStart(CoverGrid);

            var titleAnim = ConnectedAnimationService.GetForCurrentView().GetAnimation(ConnectedAnimationKeys.TitleTransition);

            titleAnim?.TryStart(AccentTitleTextBlock);

            var subtitleAnim = ConnectedAnimationService.GetForCurrentView().GetAnimation(ConnectedAnimationKeys.SubtitleTransition);

            subtitleAnim?.TryStart(SubtitleTextBlock);

            CoverGrid.Opacity = 1;

            AccentTitleTextBlock.GetVisual().Opacity = 1;
            SubtitleTextBlock.GetVisual().Opacity    = 1;
        }
Ejemplo n.º 17
0
        private void StoriesList_ItemClick(object sender, ItemClickEventArgs e)
        {
            var item = ((InstaReelFeed)e.ClickedItem);

            if (item.User.UserName is "You")
            {
                if (item.Items.Count is 0)
                {
                    PivotView.SelectedIndex = 0;
                    return;
                }
            }

            GridViewItem itemAnimation = (GridViewItem)StoriesList.ContainerFromItem(item);

            itemList = itemAnimation;
            ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("image", itemAnimation);
            StoryFr.Navigate(typeof(StoryView.StoryViews), item);
            MainPage.Bar.Visibility = Visibility.Collapsed;
        }
        private void ItemsGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            var container = ItemsGridView.ContainerFromItem(e.ClickedItem) as GridViewItem;

            if (container != null)
            {
                var root  = (FrameworkElement)container.ContentTemplateRoot;
                var image = (UIElement)root.FindName("Image");

                ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("Image", image);
            }

            var item = (Thumbnail)e.ClickedItem;

            // Add a fade out effect
            Transitions = new TransitionCollection();
            Transitions.Add(new ContentThemeTransition());

            Frame.Navigate(typeof(ConnectedAnimationDetail), _navigatedUri = item.ImageUrl);
        }
        private void Frame_Navigating(object sender, Windows.UI.Xaml.Navigation.NavigatingCancelEventArgs e)
        {
            var parameter = e.Parameter != null && !(e.Parameter is string str && string.IsNullOrEmpty(str)) ? e.Parameter : null;

            var cas = ConnectedAnimationService.GetForCurrentView();

            var page = (sender as Frame).Content as Page;
            var connectedAnimationsProps = Connected.GetPageConnectedAnimationProperties(page);

            foreach (var props in connectedAnimationsProps.Values)
            {
                if (props.IsListAnimation && parameter != null && ApiInformationHelper.IsCreatorsUpdateOrAbove)
                {
                    foreach (var listAnimProperty in props.ListAnimProperties)
                    {
                        if (listAnimProperty.ListViewBase.ItemsSource is IEnumerable <object> items &&
                            items.Contains(e.Parameter))
                        {
                            try
                            {
                                listAnimProperty.ListViewBase.PrepareConnectedAnimation(props.Key, e.Parameter, listAnimProperty.ElementName);
                            }
                            catch
                            {
                                // Ignore
                            }
                        }
                    }
                }
                else if (!props.IsListAnimation)
                {
                    cas.PrepareToAnimate(props.Key, props.Element);
                }
                else
                {
                    continue;
                }

                _previousPageConnectedAnimationProps[props.Key] = props;
            }
        }
Ejemplo n.º 20
0
        public Shell()
        {
            this.InitializeComponent();

            WindowThemeHelper.HideTitleBar();
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            ShellSplitView.PaneClosed += ShellSplitView_PaneClosed;
            this.SizeChanged          += Shell_SizeChanged;
            MenuButton.Click          += MenuButton_Click;

            Window.Current.CoreWindow.Activated += (sender, args) =>
            {
                if (args.WindowActivationState == CoreWindowActivationState.Deactivated)
                {
                    PaneBlur.Value   = 0;
                    WindowBlur.Value = 0;
                }
                else
                {
                    PaneBlur.Value   = 1;
                    WindowBlur.Value = 1;
                }
            };

            this.Loaded += Shell_Loaded;
            MenuListView.ItemsSource = _navigationItems;
            MenuListView.ItemClick  += NavigationListView_ItemClick;

            BottomMenuListView.ItemsSource = _bottmNavigationItems;
            BottomMenuListView.ItemClick  += NavigationListView_ItemClick;

            _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

            var connectedAnimationService = ConnectedAnimationService.GetForCurrentView();

            connectedAnimationService.DefaultDuration       = TimeSpan.FromSeconds(0.4);
            connectedAnimationService.DefaultEasingFunction = _compositor.CreateCubicBezierEasingFunction(
                new Vector2(0.41f, 0.52f),
                new Vector2(0.00f, 0.94f));
        }
        private async void OnPlanTripClick(object sender, RoutedEventArgs e)
        {
            PlanTrip.IsEnabled = false;

            var bitmap = new RenderTargetBitmap();
            await bitmap.RenderAsync(HeroImage);

            HeroImageMirror.Source = bitmap;
            ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("storePlace", HeroImageMirror);

            var mainPage = this.FindAscendant <MainPage>();

            if (!mainPage.PickedPlaces.Contains(SelectedPlace))
            {
                mainPage.PickedPlaces.Add(SelectedPlace);
            }

            var navView = mainPage.FindDescendant <WinUI.NavigationView>();

            if (navView.PaneCustomContent.FindDescendantByName("PlaceStore") is Button placeStoreButton)
            {
                var dot = placeStoreButton.FindDescendant <Ellipse>();

                var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("storePlace");
                animation?.TryStart(dot);
                dot.Visibility = Visibility.Visible;

                // JL: Need to figutre out why the first time the animation doesn't run although animation returns true.
                if (_firstTimeAnimation)
                {
                    _firstTimeAnimation = false;
                    await Task.Delay(50);

                    ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("storePlace", HeroImageMirror);
                    var animation1 = ConnectedAnimationService.GetForCurrentView().GetAnimation("storePlace");
                    animation1?.TryStart(dot);
                }
            }

            PlanTrip.IsEnabled = true;
        }
Ejemplo n.º 22
0
        private void ArticlesGridView_OnLoaded(object sender, RoutedEventArgs e)
        {
            if (_navigatedIndex != null)
            {
                // May be able to perform backwards Connected Animation
                var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("Image");
                if (animation != null)
                {
                    var item = ViewModel.Articles[_navigatedIndex.Value];

                    ArticlesGridView.ScrollIntoView(item, ScrollIntoViewAlignment.Default);
                    ArticlesGridView.UpdateLayout();

                    var container = ArticlesGridView.ContainerFromItem(item) as GridViewItem;
                    if (container != null)
                    {
                        var root  = (FrameworkElement)container.ContentTemplateRoot;
                        var image = (Image)root.FindName("Image");

                        image.Opacity = 0;

                        // this never fires
                        //image.ImageOpened += (sender_, e_) =>
                        //{
                        //    image.Opacity = 1;
                        //    animation.TryStart(image);
                        //};

                        // Have to run this directly
                        image.Opacity = 1;
                        animation.TryStart(image);
                    }
                    else
                    {
                        animation.Cancel();
                    }
                }

                _navigatedIndex = null;
            }
        }
Ejemplo n.º 23
0
        private async void FadeOut_Completed(object sender, object e)
        {
            using (var stream = await DisplayFile.OpenAsync(FileAccessMode.Read))
            {
                var bitmap = new BitmapImage();
                DisplayImage.Source = bitmap;
                await bitmap.SetSourceAsync(stream);
            }

            try
            {
                ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("PhotoAnimation");
                animation?.TryStart(DisplayImage);
            }
            catch (Exception) { }
            finally
            {
                FadeIn.Begin();
                DisplayImage.Opacity = 1;
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (e.NavigationMode == NavigationMode.New)
            {
                var places = (Place[])e.Parameter;
                Place1 = places[0];
                Place2 = places[1];

                var aniamtion1 = ConnectedAnimationService.GetForCurrentView().GetAnimation("place1Forward");
                aniamtion1?.TryStart(Place1Image);
                var aniamtion2 = ConnectedAnimationService.GetForCurrentView().GetAnimation("place2Forward");
                aniamtion2?.TryStart(Place2Image);
            }
            else if (e.NavigationMode == NavigationMode.Back && _selectedPlaceImage != null)
            {
                var aniamtion = ConnectedAnimationService.GetForCurrentView().GetAnimation("detailToComparison");
                aniamtion?.TryStart(_selectedPlaceImage);
            }
        }
Ejemplo n.º 25
0
        protected override void OnBackRequestedOverride(object sender, HandledEventArgs e)
        {
            Dispose();

            Layer.Visibility  = Visibility.Collapsed;
            TopBar.Visibility = Visibility.Collapsed;

            var animation = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("FullScreenPicture", Surface);

            if (animation != null && _closing != null)
            {
                animation.TryStart(_destructed ? Window.Current.Content : _closing());
            }

            DataContext = null;
            Bindings.StopTracking();

            Hide();

            e.Handled = true;
        }
Ejemplo n.º 26
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            AlbumImage.ImageOpened -= AlbumImage_ImageOpened;

            if (e.NavigationMode == NavigationMode.Back)
            {
                ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("AlbumBackAnimation", AlbumImage);
            }

            if (e.SourcePageType.Name != "MusicDetail" && e.SourcePageType.Name != "MusicMV")
            {
                AlbumCollection.Clear();
                AlbumCollection = null;
                AlbumSong       = null;
                IsSame          = false;
            }
            else
            {
                IsSame = true;
            }
        }
Ejemplo n.º 27
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            MainPageViewModel.Current.NeedShowBack = true;


            var ani = ConnectedAnimationService.GetForCurrentView().GetAnimation(Consts.ArtistPageInAnimation);

            if (ani != null)
            {
                ani.TryStart(Title, new UIElement[] { Details });
            }

            if (Context.SongsList.IsNullorEmpty())
            {
                await Context.InitAsync();
            }

            SortBox.SelectionChanged -= ComboBox_SelectionChanged;
            SortBox.SelectedIndex     = Context.SortIndex;
            SortBox.SelectionChanged += ComboBox_SelectionChanged;
        }
Ejemplo n.º 28
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            var album = e.Parameter as Viewmodels.AlbumViewmodel;

            this.DataContext = album;
            var cover = ConnectedAnimationService.GetForCurrentView().GetAnimation("forwardAnimationCover");

            if (cover != null)
            {
                cover.TryStart(this.cover);
            }
            var name = ConnectedAnimationService.GetForCurrentView().GetAnimation("forwardAnimationName");

            if (name != null)
            {
                name.TryStart(this.name);
            }

            await this.SetCover(album);
        }
Ejemplo n.º 29
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (e.Parameter is ImageSource src)
            {
                DesImage.Source = src;
            }
            else if (e.Parameter is string srcS)
            {
                DesImage.Source = new BitmapImage(new Uri(@"ms-appx:///" + srcS));
            }
            else
            {
                return;
            }

            var ani = ConnectedAnimationService.GetForCurrentView().GetAnimation("Image");

            ani?.TryStart(DesImage);
        }
Ejemplo n.º 30
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("ToDetailAnimation");
                if (animation != null)
                {
                    animation.TryStart(GridBack);
                }
            }
            catch (Exception) { }

            BackBlurBrush.Amount = 0;
            BackBlurTicker.Start();

            if (MusicPage.ThisPage.MediaControl.MediaPlayer.PlaybackSession.PlaybackState == MediaPlaybackState.Playing)
            {
                EllStoryboard.Begin();
                RollTicker.Start();
            }
        }