Exemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            User        usr      = new User();
            bool        isUsed   = false;
            List <User> allUsers = _userRepo.getAllUsers();

            usr.Login    = LoginBox.Text;
            usr.Password = _PasswordBox.Password;
            foreach (var usrs in allUsers)
            {
                if (usr.Login == usrs.Login)
                {
                    LoginBox.Clear();
                    _PasswordBox.Clear();
                    isUsed = true;
                }
            }
            if (isUsed)
            {
                MessageBox.Show("This login is already used");
            }
            else
            {
                _userRepo.RegisterUser(usr);
                _buyService.BuyGame(_gameRepo.FindByFullName("CSGO"), usr);
                new LibraryPage(_gameRepo, _userRepo, _buyService, _calcStrat, null, usr).Show();
                this.Hide();
            }
        }
        public double CalculatePrice(Game game)
        {
            Game   currGame;
            double price = 0;

            currGame = _gameRepository.FindByFullName(game.Name);
            if (DateTime.Today.DayOfYear == 255 && currGame.isAvailableDiscount == true)
            {
                price = currGame.Price;
            }
            else
            {
                price = currGame.Price + currGame.Price * 0.15;
            }
            return(price);
        }
Exemplo n.º 3
0
        private void LibraryOneTap(object sender, EventArgs e)
        {
            //ImageSource src = new ImageSource()

            int selected_index = LibraryLIst.SelectedIndex + 1;

            selectedGame = LibraryLIst.CurrentCell.Item as Game;
            string Name = selectedGame.Name;

            NameLabel.Content        = Name;
            DescriptionLabel.Content = Name + " Description";
            string PublisherName = _gameRepo.FindByFullName(Name).PublisherName;

            PublisherLabel.Content = PublisherName;
            //GameImage.Source = "D:\\2 курс\\Proga ABStore\\" + Name + "_Image.jpg";
            // GameImage.Source = new BitmapImage(new Uri(@"pack://application:,,,/ABStore;component/"+ Name + "_image.jpg"));
        }
Exemplo n.º 4
0
 private void GamePlayButton_Click(object sender, RoutedEventArgs e)
 {
     _buyService.BuyGame(_gameRepo.FindByFullName(selectedGame.Name), storeUser);
 }