Example #1
0
        public TransWindow(MainWindow sklepWin, Article article, string message,DoShoping doShoping, bool isLearning)
        {
            this.InitializeComponent();
            shopWin = sklepWin;
            actualArticle = article;
            shoping = doShoping;
            Info.Text = message;
               // BitmapImage btn = new BitmapImage();
              //  btn.BeginInit();
              //  btn.UriSource = new Uri(article.ImagePath, UriKind.Relative);
             //   btn.EndInit();
            try {
                InfoImage.Source = new BitmapImage(new Uri(article.ImagePath));
            }catch(Exception ex) {
                string path = AppDomain.CurrentDomain.BaseDirectory + "images\\png\\noimage.png";
                InfoImage.Source = new BitmapImage(new Uri(path));
            }
            if(!article.IsForShooping && isLearning) {
                btnGet.Visibility = System.Windows.Visibility.Hidden;

                /////////////
                btnCancel.IsDefault = true;
            }
            if ( shopWin.MyBasket.InBasket==null || (!shopWin.MyBasket.InBasket.ContainsKey(article))) {
                btnOut.Visibility=Visibility.Hidden;
            }
            // Insert code required on objsect creation below this point.
        }
Example #2
0
        public void SetUp()
        {
            MyBasket=new Basket();
             toShoping = new Products();

             testShop = new Shop();
             testShop.NameShop = "mój sklep spożywczy";
             Article testArticle1 = new Article() {
                                                     GraphElem = null,
                                                     ImagePath = "c:\\ggg.png",
                                                     Name = "maslo",
                                                     Price = 23.2M,
                                                     Quantity = 23.6,
                                                     IsForShooping = true,
                                                 };
            Article testArticle2 = new Article() {
                                                     GraphElem = null,
                                                     ImagePath = "c:\\ggg.png",
                                                     Name = "mleko",
                                                     Price = 0M,
                                                     Quantity = 23.6,
                                                     IsForShooping = false,
                                                 };
            Article testArticle3 = new Article() {
                                                     GraphElem = null,
                                                     ImagePath = "c:\\ggg.png",
                                                     Name = "cukier",
                                                     Price = 15.2m,
                                                     Quantity = 100.1,
                                                     IsForShooping = true,
                                                 };
            toShoping.AddArticle(testArticle1);
            toShoping.AddArticle(testArticle2);
            toShoping.AddArticle(testArticle3);

             MyClient=new Client(){Cash = 50m,Name = "klient",ToShoping = toShoping};
             ArticlesRepository myArticlesRepository = new ArticlesRepository();
             testShop.AllArticles = myArticlesRepository.GenerSomeOfProducts("images/");
             myDoShoping = new DoShoping(MyClient, MyBasket);
        }
Example #3
0
 private void WeHaveShoping(Article getColisionWith, bool isLearning)
 {
     DoShoping doShoping = new DoShoping(client,myBasket);
     string message;
     if (getColisionWith.IsForShooping || !isLearning) {
       /*  message = "Możesz kupić artykuł: " + getColisionWith.Name + "\n w cenie "
                          + getColisionWith.Price.ToString("C2") + ".\n"
                          + "Obecnie masz : " + client.CashString;
         MessageBoxResult dialogResult = MessageBox.Show(message, "Czy kupujesz?\n", MessageBoxButton.YesNo);
         if (dialogResult == MessageBoxResult.Yes) {
             doShoping.ArticleToBasket(getColisionWith);
        *  UpdateBasketList();
         */
             message = "Możesz kupić artykuł:\n " + getColisionWith.Name + "\n w cenie "
                          + getColisionWith.Price.ToString("C2") + ".\n"
                          + "Obecnie masz : " + client.CashString;
             TransWindow newTransWindow = new TransWindow(this,getColisionWith,message,doShoping,isLearning);
         newTransWindow.ShowDialog();
         }
      else {
         message = "Nie możesz kupić tego towaru!";
         TransWindow newTransWindow = new TransWindow(this, getColisionWith, message,doShoping,isLearning);
         newTransWindow.ShowDialog();
     }
 }