コード例 #1
0
ファイル: StorePage.xaml.cs プロジェクト: boshyshkov/ABStore
        public StorePage(IGameRepo gameRepo, IUserRepo userRepo, IBuyService buyService, IPriceCalculationStrategy calcStrat, LibraryPage lp, User usr)
        {
            libp             = lp;
            this._gameRepo   = gameRepo;
            this._userRepo   = userRepo;
            this._buyService = buyService;
            this._calcStrat  = calcStrat;
            storeUser        = usr;

            InitializeComponent();
            if (storeList == null)
            {
                storeList = new ObservableCollection <Game>();
            }
            //storeList = new ObservableCollection<Game> {
            //    new Game{Name=" "}
            //};


            List <string> names = new List <string>();

            storeList.Clear();
            foreach (var game in _gameRepo.getAllGames())
            {
                if (!names.Contains(game.Name))
                {
                    names.Add(game.Name);

                    storeList.Add(game);
                }
            }

            StoreLIst.Items.Clear();
            StoreLIst.ItemsSource = storeList;
        }