예제 #1
0
        private async void tiepButton_Click(object sender, RoutedEventArgs e)
        {
            if (valueRadioButton() != 0)
            {
                valueRadio = valueRadioButton();
                mucTap muctap = new mucTap();
                muctap.level     = valueRadio;
                muctap.tenBaiTap = tenBt;
                Frame.Navigate(typeof(BaiTapBung), muctap);
            }
            else
            {
                MessageDialog msDialog = new MessageDialog("Bạn chưa chọn mức tập, vui lòng chọn trước khi tập");

                msDialog.Commands.Add(new UICommand("Ok")
                {
                    Id = 0
                });
                msDialog.DefaultCommandIndex = 1;
                var result = await msDialog.ShowAsync();

                if (result.Label == "Ok")
                {
                    mucTap muctap = new mucTap();
                    muctap.level     = valueRadio;
                    muctap.tenBaiTap = tenBt;
                    Frame.Navigate(typeof(ChonMucTap), tenBt);
                }
            }
            // }
        }
예제 #2
0
        private async void tiepButton_Click(object sender, RoutedEventArgs e)
        {
            if (valueRadioButton() != 0)
            {
                valueRadio = valueRadioButton();
                mucTap muctap = new mucTap();
                muctap.level = valueRadio;
                muctap.tenBaiTap = tenBt;
                Frame.Navigate(typeof(BaiTapBung), muctap);
            }
            else
            {
                MessageDialog msDialog = new MessageDialog("Bạn chưa chọn mức tập, vui lòng chọn trước khi tập");

                msDialog.Commands.Add(new UICommand("Ok") { Id = 0 });
                msDialog.DefaultCommandIndex = 1;
                var result = await msDialog.ShowAsync();
                if(result.Label == "Ok")
                {
                    mucTap muctap = new mucTap();
                    muctap.level = valueRadio;
                    muctap.tenBaiTap = tenBt;
                    Frame.Navigate(typeof(ChonMucTap),tenBt);
                }
            }
            // }
        }
예제 #3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // lấy thông tin từ  trang muc tap
            mucTap muctap = (mucTap)e.Parameter;

            tenBt      = muctap.tenBaiTap;
            level      = muctap.level;
            tenBT.Text = tenBt;
            nguoidung  = TrangChu.nguoidung;
            muctieu    = TrangChu.muctieu;


            //image
            List <Uri> uriLst = new List <Uri>();

            if (tenBt == "Gập bụng")
            {
                for (int i = 1; i <= 4; i++)
                {
                    uriLst.Add(new Uri("ms-appx:///Assets/gapbung" + i + ".png"));
                }
            }
            else
            {
                for (int i = 1; i <= 6; i++)
                {
                    uriLst.Add(new Uri("ms-appx:///Assets/hitdat" + i + ".png"));
                }
            }

            for (int i = 0; i < 4; i++)
            {
                imgLst.Add(new BitmapImage(uriLst[i]));
            }

            threadImg = ThreadPoolTimer.CreatePeriodicTimer(UpdateSprite, TimeSpan.FromMilliseconds(200));


            // lay thong tin bai tap bung hay hit dat dua vao ten
            baiTapBung = connection.Table <BaiTap>().Where(r => r.TenBaiTap == tenBt).FirstOrDefault();
            idBT       = baiTapBung.IdBaiTap;

            if (muctieu != null)
            {
                thongKeNgay    = TrangChu.getThongKeNgayHienTai(muctieu);
                thongKeTapBung = connection.Table <ThongKeBaiTap>().Where(r => r.IdThongKeNgay == thongKeNgay.IdThongKeNgay && r.IdBaiTap == idBT).FirstOrDefault();
                if (thongKeTapBung == null)
                {
                    thongKeTapBung = new ThongKeBaiTap()
                    {
                        IdThongKeNgay    = thongKeNgay.IdThongKeNgay,
                        IdBaiTap         = idBT,
                        LuongKaloTieuHao = 0,
                        SoLan            = 0
                    };
                    connection.Insert(thongKeTapBung);
                }
            }
            else
            {
                thongKeTapBung = new ThongKeBaiTap();
            }
        }