public AddBillPageViewModel(MainViewModel param) { mainViewModel = param; CakeList = CakeServices.GetAllCakes(); Order = new OrderModel(); CakeInOrders = new ObservableCollection <CakeInOrder>(); CakeInOrders = new ObservableCollection <CakeInOrder>(Order.listCakes); SearchCommand = new SearchInBillPageCommand(this); AddToBill = new RelayCommand(o => AddCakeToBill(o)); DeleteCakeInOrder = new RelayCommand(o => DeleteCake(o)); IncreaseAmount = new RelayCommand(o => IncreseAmountInOrder(o)); DecreaseAmount = new RelayCommand(o => DecreseAmountInOrder(o)); AddOrderToDB = new RelayCommand(o => AddNewOrderToDB(o)); RefreshPage = new RelayCommand(o => RefreshPageInfo()); TotalPrice = 0; }
private void Window_Loaded(object sender, RoutedEventArgs e) { var value = ConfigurationManager.AppSettings["ShowSplashScreen"]; var showSplash = bool.Parse(value); if (showSplash == false) { var screen = new MainWindow(); screen.Show(); this.Close(); } else { CakeList = CakeServices.GetAllCakes(); int len = CakeList.Count(); Rerandom : int index = rng.Next(0, len - 1); info.Text = CakeList[index].Information; CakeImage.Source = new BitmapImage(CakeList[index].ImageLink); if (info.Text == "") { goto Rerandom; } timer = new Timer(); timer.Elapsed += Timer_Elapsed; timer.Interval = 10; timer.Start(); } }
public HomePageViewModel(MainViewModel param) { //test = "Tất cả"; //CurrentFilter = 0; CurrentSearchText = ""; _cakePerPage = 8; mainViewModel = param; UpdateView = new UpdateMainViewCommand(mainViewModel); CakeList = CakeServices.GetAllCakes(); GotoDetailPage = new RelayCommand(o => ShowCakeDetailPage(o)); GotoUpdatePage = new RelayCommand(o => ShowUpdatePage(o)); CategoryList = CategoryServices.LoadAll(); SelectedCategory = new CategoryModel(); SelectedCategory.Name = "Tất cả"; SelectedCategory.ID = 0; CategoryList = CategoryServices.LoadAll(); CategoryList.Insert(0, SelectedCategory); GotoDetailPage = new RelayCommand(o => ShowCakeDetailPage(o)); CalculatePaging(); SearchCommand = new SearchCommand(this); NextPage = new NextPageHomeCommand(this); PreviousPage = new PreviousPageHomeCommand(this); }