ExecuteWhenLoaded() private static method

private static ExecuteWhenLoaded ( FlipView flipview, System.Action body ) : void
flipview FlipView
body System.Action
return void
Example #1
0
        private static void OnIsBannerEnabledPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FlipView flipView = (FlipView)d;

            if (!flipView.IsLoaded)
            {
                FlipView.ExecuteWhenLoaded(flipView, () => {
                    flipView.ApplyTemplate();
                    if (!(bool)e.NewValue)
                    {
                        flipView.HideBanner();
                        return;
                    }
                    flipView.ChangeBannerText(flipView.BannerText);
                    flipView.ShowBanner();
                });
                return;
            }
            if (!(bool)e.NewValue)
            {
                flipView.HideBanner();
                return;
            }
            flipView.ChangeBannerText(flipView.BannerText);
            flipView.ShowBanner();
        }
Example #2
0
        private void ChangeBannerText(string value = null)
        {
            if (!this.IsBannerEnabled)
            {
                FlipView.ExecuteWhenLoaded(this, () => this.bannerLabel.Content = value ?? this.BannerText);
                return;
            }
            string str = value ?? this.BannerText;

            if (str == null)
            {
                return;
            }
            if (this.hideControlStoryboardCompletedHandler != null)
            {
                this.hideControlStoryboard.Completed -= this.hideControlStoryboardCompletedHandler;
            }
            this.hideControlStoryboardCompletedHandler = (object sender, EventArgs e) => {
                try
                {
                    this.hideControlStoryboard.Completed -= this.hideControlStoryboardCompletedHandler;
                    this.bannerLabel.Content              = str;
                    this.bannerLabel.BeginStoryboard(this.showControlStoryboard, HandoffBehavior.SnapshotAndReplace);
                }
                catch (Exception exception)
                {
                }
            };
            this.hideControlStoryboard.Completed += this.hideControlStoryboardCompletedHandler;
            this.bannerLabel.BeginStoryboard(this.hideControlStoryboard, HandoffBehavior.SnapshotAndReplace);
        }
Example #3
0
 public void ShowControlButtons()
 {
     this.controlsVisibilityOverride = false;
     FlipView.ExecuteWhenLoaded(this, () => {
         this.backButton.Visibility    = System.Windows.Visibility.Visible;
         this.forwardButton.Visibility = System.Windows.Visibility.Visible;
     });
 }
Example #4
0
 public void HideControlButtons()
 {
     this.controlsVisibilityOverride = true;
     FlipView.ExecuteWhenLoaded(this, () => {
         this.backButton.Visibility    = System.Windows.Visibility.Hidden;
         this.forwardButton.Visibility = System.Windows.Visibility.Hidden;
     });
 }
Example #5
0
 static FlipView()
 {
     Class6.yDnXvgqzyB5jw();
     FlipView.UpTransitionProperty         = DependencyProperty.Register("UpTransition", typeof(TransitionType), typeof(FlipView), new PropertyMetadata((object)TransitionType.Up));
     FlipView.DownTransitionProperty       = DependencyProperty.Register("DownTransition", typeof(TransitionType), typeof(FlipView), new PropertyMetadata((object)TransitionType.Down));
     FlipView.LeftTransitionProperty       = DependencyProperty.Register("LeftTransition", typeof(TransitionType), typeof(FlipView), new PropertyMetadata((object)TransitionType.LeftReplace));
     FlipView.RightTransitionProperty      = DependencyProperty.Register("RightTransition", typeof(TransitionType), typeof(FlipView), new PropertyMetadata((object)TransitionType.RightReplace));
     FlipView.MouseOverGlowEnabledProperty = DependencyProperty.Register("MouseOverGlowEnabled", typeof(bool), typeof(FlipView), new PropertyMetadata(true));
     FlipView.OrientationProperty          = DependencyProperty.Register("Orientation", typeof(System.Windows.Controls.Orientation), typeof(FlipView), new PropertyMetadata((object)System.Windows.Controls.Orientation.Horizontal));
     FlipView.IsBannerEnabledProperty      = DependencyProperty.Register("IsBannerEnabled", typeof(bool), typeof(FlipView), new UIPropertyMetadata(true, new PropertyChangedCallback(FlipView.OnIsBannerEnabledPropertyChangedCallback)));
     FlipView.BannerTextProperty           = DependencyProperty.Register("BannerText", typeof(string), typeof(FlipView), new FrameworkPropertyMetadata("Banner", FrameworkPropertyMetadataOptions.AffectsRender, (DependencyObject d, DependencyPropertyChangedEventArgs e) => FlipView.ExecuteWhenLoaded((FlipView)d, () => ((FlipView)d).ChangeBannerText((string)e.NewValue))));
     FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(FlipView), new FrameworkPropertyMetadata(typeof(FlipView)));
 }