public LearningWordPage(int CategoryID)
        {
            InitializeComponent();
            wdal        = new WordDAL();
            idal        = new ImageDAL();
            _CategoryID = CategoryID;
            //LoadRandomWordByCategory(_CategoryID);
            //LoadRandomListWordByCategory(_CategoryID);
            lstW = new List <Word>();
            lstW = wdal.getRandomWordForLearningWord(_CategoryID);

            //lấy từ đầu tiên trong danh sách
            _currentW       = lstW[0];
            lblWord.Content = lstW[0].Word1;
            lblWord.HorizontalContentAlignment = HorizontalAlignment.Center;
            lblWord.VerticalContentAlignment   = VerticalAlignment.Center;
            lblTranslate.Content = lstW[0].Translate;
            lblTranslate.HorizontalContentAlignment = HorizontalAlignment.Center;
            lblTranslate.VerticalContentAlignment   = VerticalAlignment.Center;
            DataAccess.Image img = idal.getImageOfWord(lstW[0].Word1);
            byte[]           i   = img.Image1.ToArray();
            if (img == null)
            {
                throw new Exception("#113 Từ " + lstW[0].Word1 + "chưa có hình.");
            }
            BitmapImage image = LoadImage(i);

            img_word.Source  = image;
            img_word.Stretch = Stretch.Fill;
            PlayThePronunciation(lstW[0]);
        }
Exemple #2
0
 int count = 0; // The time that player answer right
 public PickAndAskGamePage(List <Word> list)
 {
     InitializeComponent();
     idal      = new ImageDAL();
     wdal      = new WordDAL();
     this.list = list;
     NewGame();
 }
        public PairGameController(Grid grid, int CategoryID)
        {
            if (grid == null)
            {
                throw new ArgumentNullException("gameGrid can not be null.");
            }
            // if (String.IsNullOrEmpty(iconSet)) throw new ArgumentException("iconSet can not be null or empty.");

            this.gameGrid = grid;
            // this.iconSet = iconSet;
            wordDAL         = new WordDAL();
            imgDAL          = new ImageDAL();
            this.CategoryID = CategoryID;
            list            = getWordByCategory(CategoryID);
        }