示例#1
0
        private void btnThongKe_Click(object sender, EventArgs e)
        {
            ClearRenderbody();
            UCThongKe uCThongKe = new UCThongKe();

            uCThongKe.TopLevel = false;
            uCThongKe.Width    = pnlFill.Width;
            uCThongKe.Height   = pnlFill.Height;
            uCThongKe.Anchor   = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            pnlFill.Controls.Add(uCThongKe);
            uCThongKe.Show();
        }
示例#2
0
        public MainViewModel()
        {
            LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) => {
                Isloaded        = true;
                LoginForm login = new LoginForm();
                if (p == null)
                {
                    return;
                }
                p.Hide();
                login.ShowDialog();
                if (login.DataContext == null)
                {
                    return;
                }
                var loginVM = login.DataContext as LoginVM;
                if (loginVM.IsLogin)
                {
                    p.Show();
                    idnvNOW = loginVM.UserName;
                    try
                    {
                        //cocn = layhinh(loginVM.UserName);
                    }
                    catch
                    {
                        //cocn = null;
                    }
                }
                else
                {
                    p.Close();
                }
            });

            TaiXeCommand         = new RelayCommand <Grid>((p) => { return(true); }, (p) => { TaiXeForm txf = new TaiXeForm();  p.Children.Add(txf); });
            ChuyenXeCommand      = new RelayCommand <Grid>((p) => { return(true); }, (p) => { ChuyenXeForm cxf = new ChuyenXeForm();; p.Children.Add(cxf); });
            TuyenXeCommand       = new RelayCommand <Grid>((p) => { return(true); }, (p) => { TuyenXeForm txf = new TuyenXeForm();; p.Children.Add(txf); });
            BaoCaoThongKeCommand = new RelayCommand <Grid>((p) => { return(true); }, (p) => { BaoCaoThongKeForm bctkf = new BaoCaoThongKeForm();; p.Children.Add(bctkf); });
            PhuXeCommand         = new RelayCommand <Grid>((p) => { return(true); }, (p) => { PhuXeForm pxf = new PhuXeForm();; p.Children.Add(pxf); });
            QuanLyXeCommand      = new RelayCommand <Grid>((p) => { return(true); }, (p) => { QuanLyXeForm qlxf = new QuanLyXeForm(); p.Children.Clear(); p.Children.Add(qlxf); });
            SapLichCommand       = new RelayCommand <Grid>((p) => { return(true); }, (p) => { SapLichForm slf = new SapLichForm(); p.Children.Add(slf); });
            BenXeCommand         = new RelayCommand <Grid>((p) => { return(true); }, (p) => { BenXeForm bxf = new BenXeForm();; p.Children.Add(bxf); });
            DatVeCommand         = new RelayCommand <Grid>((p) => { return(true); }, (p) => { UCBooking uCBooking = new UCBooking();; p.Children.Add(uCBooking); });
            SaoLuuCommand        = new RelayCommand <Grid>((p) => { return(true); }, (p) => { SaoLuuForm slf = new SaoLuuForm();; p.Children.Add(slf); });
            NhanVienBanVeCommand = new RelayCommand <Grid>((p) => { return(true); }, (p) => { UCNhanVienBanVe nvbvf = new UCNhanVienBanVe();; p.Children.Add(nvbvf); });

            ////
            ThongkeCommand  = new RelayCommand <Grid>((p) => { return(true); }, (p) => { UCThongKe thongke = new UCThongKe(); p.Children.Add(thongke); });
            testCommand     = new RelayCommand <Grid>((p) => { return(true); }, (p) => { UserControl1 u1 = new UserControl1(); p.Children.Add(u1); });
            DangXuatCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { LoginForm lgf = new LoginForm(); lgf.ShowDialog(); });
            CloseCommand    = new RelayCommand <Window>((p) => { return(true); }, (p) => { p.Close(); });

            int i = 1;

            ChangeBackGroundCommand = new RelayCommand <Grid>((p) => { return(true); }, (p) => {
                int n = 6;
                if (i <= n)
                {
                    string uri1        = "pack://application:,,,/Img/h" + i + ".jpg";
                    ImageBrush myBrush = new ImageBrush();
                    try
                    {
                        myBrush.ImageSource = new BitmapImage(new Uri(uri1, UriKind.Absolute));
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    p.Background = myBrush;
                    i++; if (i == n)
                    {
                        i = 0;
                    }
                }
            });
        }