Exemplo n.º 1
0
        public static void DrawConsole(int width, int height)
        {
            Console.SetWindowSize(width, height);
            Product testEventProduct = new Product();
            Ads testEventAds = new Ads();

            while (!isFinished)
            {
                testEventProduct.Promotion += Product_OnPromotionTypeChanged;
                testEventProduct.CheckForPromotion(StockRoom.ProductList());
                DrawBorders(width, height);

                Console.WriteLine(" ****** !!! Advertisements !!! ******");
                testEventAds.AdsEH += Ads_AdsTypeChanged;
                testEventAds.CheckForActiveAds(AdsStock.GetAllAds());
                Console.WriteLine(" ****** !!! Advertisements !!! ******");
                DrawBorders(width, height);

                Console.WriteLine("   You are browsing as {0}", 
                    currentCustomer == null ? "nobody! Register or login." : currentCustomer.Name + ".");
                DrawBorders(width, height);

                DrawMenu(width);
                int choice = DrawSubMenu();
                ShowChoice(choice);

                AskToContinue(); //Gives time to user can read message

                Console.Clear();
            }
        }
Exemplo n.º 2
0
 protected void AdsTypeChanged(Ads ads)
 {
     if (AdsEH != null)
     {
         Console.WriteLine("Company: {0} ads content: {1}", ads.companyName, ads.adsContent);
         AdsEventArgs args = new AdsEventArgs(ads.companyName, ads.adsContent);
         AdsEH(this, args);
     }
 }
Exemplo n.º 3
0
        public static List<Ads> GetAllAds()
        {
            //Tozi metod ne trqbva da se pravi tochno taka... shte se opitam da go opravq po-kusno
            //Pravq nqkakuv sravnitelno burz variant za rotaciq na reklamite, zashtoto nqmame mnogo vreme :D

            int seconds = DateTime.Now.Second;

            adsList.Clear(); //zasega slagam tova, zashtoto inache se natrupvat elementite v List<Ads> GetAds

            //Rotation can be implemented with randomizer if more than 3

            Ads firstAds = new Ads("First company", "Google", seconds <= 20 ? true : false);
            Ads secondAds = new Ads("Second company", "Yahoo", seconds > 40 ? true : false);
            Ads thirdAds = new Ads("Third company", "Microsoft", (seconds > 20 && seconds <= 40) ? true : false);
            adsList.Add(firstAds);
            adsList.Add(secondAds);
            adsList.Add(thirdAds);
            return adsList;
        }
Exemplo n.º 4
0
 public void AddAds(Ads ads)
 {
     adsList.Add(ads);
 }