Example #1
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.Child = 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)
                {
                    if (!adRotatorControl.adRotatorRefreshIntervalSet)
                    {
                        adRotatorControl.StartAdTimer();
                    }
                }

                //Work out how to position Ad off screen (set hidden = true) on startup
            }
            OnAdRotatorReady();

            adRotatorControl.isLoaded = true;
        }
Example #2
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);
            }
        }
        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 = System.Windows.VerticalAlignment.Center
                });
            }
            else
            {
                adRotatorControl.AdAvailable += adRotatorControl_AdAvailable;
                if (AutoStartAds)
                {
                    adRotatorControl.GetConfig();
                    if (!adRotatorControl.adRotatorRefreshIntervalSet)
                    {
                        adRotatorControl.StartAdTimer();
                    }
                }
            }

            adRotatorControl.isLoaded = true;
        }