コード例 #1
0
        protected override void OnApplyTemplate()
#endif
        {
            base.OnApplyTemplate();
            if (IsInDesignMode)
            {
                AdRotatorRoot.Children.Add(new TextBlock()
                {
                    Text = "AdRotator in design mode, No ads will be displayed", VerticalAlignment = VerticalAlignment.Center
                });
            }
            else
            {
                adRotatorControl.AdAvailable += adRotatorControl_AdAvailable;
                adRotatorControl.AdAvailable += adRotatorControl_AdAvailable;
                if (AutoStartAds)
                {
                    adRotatorControl.GetConfig();
                    if (!adRotatorControl.adRotatorRefreshIntervalSet)
                    {
                        adRotatorControl.StartAdTimer();
                    }
                }
                InitialiseSlidingAnimations();
            }
            templateApplied = true;
            OnAdRotatorReady();
            if (adRotatorControl.isLoaded)
            {
                Invalidate(null);
            }
        }
コード例 #2
0
        void AdRotatorControl_Loaded(object sender, RoutedEventArgs e)
        {
            // This call needs to happen when the control is loaded
            // b/c dependency properties are propagated to their values at this point
            if (IsInDesignMode)
            {
                AdRotatorRoot.Children.Add(new TextBlock()
                {
                    Text = "AdRotator in design mode, No ads will be displayed", VerticalAlignment = VerticalAlignment.Center
                });
            }
            else if (templateApplied)
            {
                InitialiseSlidingAnimations();
                adRotatorControl.AdAvailable += adRotatorControl_AdAvailable;
                if (AutoStartAds)
                {
                    adRotatorControl.GetConfig();
                    if (!adRotatorControl.adRotatorRefreshIntervalSet)
                    {
                        adRotatorControl.StartAdTimer();
                    }
                }
            }
            OnAdRotatorReady();

            adRotatorControl.isLoaded = true;
        }