Esempio n. 1
0
        private void LoadPhong()
        {
            int soLuongPhong = PhongDAO.GetSoLuongPhongSuDung();

            tablePhong = PhongDAO.LoadPhongSuDung();
            for (int i = 0; i < soLuongPhong; i++)
            {
                ButtonContent btnContent = new ButtonContent()
                {
                    MaPhong   = tablePhong.Rows[i].Field <int>(0),
                    LoaiPhong = tablePhong.Rows[i].Field <string>(1),
                    TinhTrang = tablePhong.Rows[i].Field <string>(2),
                    TrangThai = tablePhong.Rows[i].Field <string>(3)
                };
                Button myBtn = new Button()
                {
                    Name       = "_" + btnContent.MaPhong.ToString(),
                    Content    = BuildButtonContent(btnContent),
                    Background = new SolidColorBrush(GetButtonColor(btnContent.TinhTrang, btnContent.TrangThai)),
                    Foreground = new SolidColorBrush(Colors.White),
                    Height     = 100,
                    Width      = 120,
                };
                RoutedEventHandler a = new RoutedEventHandler(Button_Click);
                myBtn.Click += a;
                wrapPanel.Children.Add(myBtn);
            }
        }