private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(ViewModel.GroupedFontList): if (ViewModel.IsLoadingFonts) { return; } if (ViewModel.Settings.UseSelectionAnimations && !ViewModel.IsSearchResults) { CompositionFactory.PlayEntrance(LstFontFamily, 66, 100); CompositionFactory.PlayEntrance(GroupLabel, 0, 0, 80); if (InlineLabelCount.Visibility == Visibility.Visible) { CompositionFactory.PlayEntrance(InlineLabelCount, 83, 0, 80); } } break; case nameof(ViewModel.SelectedFont): if (ViewModel.SelectedFont != null) { LstFontFamily.SelectedItem = ViewModel.SelectedFont; FontMap.PlayFontChanged(); } break; case nameof(ViewModel.FontSearch): case nameof(ViewModel.IsSearchResults): // Required to prevent crash with SemanticZoom when there // are no items in the results list if (!FontsSemanticZoom.IsZoomedInViewActive) { FontsSemanticZoom.IsZoomedInViewActive = true; } break; case nameof(ViewModel.IsLoadingFonts): case nameof(ViewModel.IsLoadingFontsFailed): UpdateLoadingStates(); break; } }
private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == nameof(ViewModel.FontList)) { if (ViewStates.CurrentState != NormalState) { GoToNormalState(); } CompositionFactory.PlayEntrance(Repeater, 0, 80, 0); // ItemsRepeater is a bit rubbish, needs to be nudged back into life. // If we scroll straight to zero, we can often end up with a blank screen // until the user scrolls. So we need to manually hack in a scroll ourselves. //ListingScroller.ChangeView(null, 2, null, true); //_ = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () => //{ // await Task.Delay(16); // ListingScroller?.ChangeView(null, 0, null, false); //}); } else if (e.PropertyName == nameof(ViewModel.SelectedFont)) { if (ViewModel.SelectedFont is null) { GoToNormalState(); } else { DetailsFontTitle.Text = ""; VisualStateManager.GoToState(this, DetailsState.Name, true); } } else if (e.PropertyName == nameof(ViewModel.Text)) { UpdateText(ViewModel.Text); } }
private void StartShowAnimation() { if (!CompositionFactory.UISettings.AnimationsEnabled) { this.GetElementVisual().Opacity = 1; this.GetElementVisual().Properties.InsertVector3(CompositionFactory.TRANSLATION, Vector3.Zero); return; } List <UIElement> elements = new() { this }; elements.AddRange(OptionsPanel.Children); CompositionFactory.PlayEntrance(elements, 0, 200); elements.Clear(); elements.AddRange(PreviewOptions.Children); elements.Add(PreviewContainer); CompositionFactory.PlayEntrance(elements, 0, 200); elements.Clear(); elements.Add(BottomLabel); elements.AddRange(BottomButtonOptions.Children); CompositionFactory.PlayEntrance(elements, 0, 200); }