コード例 #1
0
        /// <summary>
        /// This method Changes the current Banner
        /// </summary>
        public void ChangeBanner()
        {
            // do not change images while hovering, as it means someone is reading so let them finish
            // and then the next time this is called it will change
            if (!this.Hovering)
            {
                // Shuffle ten times
                this.Shuffler.Shuffle(10);

                // get a tempBanner
                BannerEnum tempBanner = GetRandomBanner();

                do
                {
                    // if the same banner was selected
                    if (tempBanner == CurrentBanner)
                    {
                        // get a tempBanner
                        tempBanner = GetRandomBanner();
                    }
                    else
                    {
                        // Set the value for TempBanner
                        CurrentBanner = tempBanner;

                        // break out of the loop
                        break;
                    }
                } while (true);
            }
        }
コード例 #2
0
 public string getString(BannerEnum bannerEnum)
 {
     if (bannerEnum.Equals(BannerEnum.BASICO))
     {
         return("<div class='banner bannerElementoColocado container-fluid' style='background-color:orange;'> Banner </div >");
     }
     else
     {
         throw new Exception("Error al seleccionar el banner");
     }
 }
コード例 #3
0
        /// <summary>
        /// This method open a browser window to the selected product (banner)
        /// </summary>
        private void OpenBrowser(BannerEnum bannerEnum)
        {
            // if the CurrentBanner exists
            if (this.HasCurrentBanner)
            {
                // get the web url for the CurrentBanner
                string webUrl = GetWebUrl(CurrentBanner);

                // If the webUrl string exists
                if (TextHelper.Exists(webUrl))
                {
                    // set the webUrl
                    System.Diagnostics.Process.Start(webUrl);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// This method returns a Random Banner
        /// </summary>
        public BannerEnum GetRandomBanner()
        {
            //// initial value
            BannerEnum randomBanner = BannerEnum.NotSet;

            // If the Shuffler object exists
            if (this.HasShuffler)
            {
                // Create a random value of 1 - 60
                int randomValue = this.Shuffler.PullNextItem(true, false, true);

                // if greater than 40
                if (randomValue > 40)
                {
                    // set to XmlMirror
                    randomBanner = BannerEnum.Teethathon;
                }
                // if 21 - 40
                else if (randomValue > 20)
                {
                    // if this app is Xml Mirror
                    if (this.ApplicationBanner == BannerEnum.XmlMirror)
                    {
                        // set to DB Compare
                        randomBanner = BannerEnum.DBCompare;
                    }
                    else if (this.ApplicationBanner == BannerEnum.DBCompare)
                    {
                        // set to Xml Mirror
                        randomBanner = BannerEnum.XmlMirror;
                    }
                }
                // 1 - 20
                else
                {
                    // set to The Libertarian Dictator
                    randomBanner = BannerEnum.LibertarianDictator;
                }
            }

            //// return value
            return(randomBanner);
        }
コード例 #5
0
        /// <summary>
        /// This method returns the Web Url
        /// </summary>
        private string GetWebUrl(BannerEnum banner)
        {
            // initial value
            string webUrl = "";

            // determine the web url based upon the banner
            switch (banner)
            {
            case BannerEnum.LibertarianDictator:

                // set the return value
                webUrl = Sponsor.WebUrl;

                // required
                break;

            case BannerEnum.DBCompare:

                // set the return value
                webUrl = "https://dbcompare.codeplex.com";

                // required
                break;

            case BannerEnum.Teethathon:

                // set the webUrl
                webUrl = "https://www.gofundme.com/teeth-a-thon";

                // required
                break;
            }

            // return value
            return(webUrl);
        }
コード例 #6
0
        /// <summary>
        /// This method returns the Banner Image
        /// </summary>
        private Image GetBannerImage(BannerEnum bannerEnum, BannerEnum applicationBanner, bool hover = false)
        {
            // initial value
            Image image = null;

            switch (bannerEnum)
            {
            case BannerEnum.LibertarianDictator:

                // if the value for hover is true
                if (hover)
                {
                    // return the back image
                    image = Properties.Resources.The_Libertarian_Dictator_Back;
                }
                else
                {
                    // return the front image
                    image = Properties.Resources.The_Libertarian_Dictator;
                }

                // required
                break;

            case BannerEnum.XmlMirror:
            case BannerEnum.DBCompare:

                // if the value for hover is true
                if (hover)
                {
                    // if the calling app is DBCompare, show Xml Mirror
                    if (applicationBanner == BannerEnum.DBCompare)
                    {
                        // Show the hover image of Xml Mirror hover
                        image = Properties.Resources.Xml_Mirror_2_0_Hover;
                    }
                    // if the calling app is Xml Mirror show DB Compare
                    else
                    {
                        // Show the hover image of DB Compare
                        image = Properties.Resources.DB_Compare_Ad_Back;
                    }
                }
                else
                {
                    // if the xmlMiror
                    if (applicationBanner == BannerEnum.DBCompare)
                    {
                        // Show the hover image of Xml Mirror hover
                        image = Properties.Resources.Xml_Mirror_2_0_Image;
                    }
                    else
                    {
                        // Show the hover image of DB Compare
                        image = Properties.Resources.DB_Compare_Ad;
                    }
                }

                // required
                break;

            case BannerEnum.Teethathon:

                // if the value for hover is true
                if (hover)
                {
                    // return the back image
                    image = Properties.Resources.Teethathon_Ad_Back_2;
                }
                else
                {
                    // return the front image
                    image = Properties.Resources.Teethathon_Ad;
                }

                // required
                break;
            }

            // return value
            return(image);
        }