private void Search(object obj) { NotFound = false; if (_cur_cat_search != null) { DishesList = _model.db.DishesSet.Where(i => i.Dishes_categoriesId == Cur_cat_search.Id).ToList(); } if (!string.IsNullOrWhiteSpace(SearchString)) { DishesList = _model.db.DishesSet.Where(i => i.Name.Contains(SearchString) | i.Price.Contains(SearchString) | i.Weight.Contains(SearchString)).ToList(); if (_cur_cat_search != null) { DishesList = _model.db.DishesSet.Where(i => (i.Name.Contains(SearchString) && i.Dishes_categoriesId == Cur_cat_search.Id) | (i.Price.Contains(SearchString) && i.Dishes_categoriesId == Cur_cat_search.Id) | (i.Weight.Contains(SearchString) && i.Dishes_categoriesId == Cur_cat_search.Id)).ToList(); } } if (DishesList.Count == 0) { NotFound = true; } UpdateEv?.Invoke(obj, null); }
private async void CrateNewDish(object obj) { Dishes new_dish = new Dishes(); new_dish.Name = AddNewName; new_dish.Dishes_categories = _model.db.Dishes_categoriesSet.FirstOrDefault(i => i.Name == AddNewCat); new_dish.Dishes_categoriesId = _model.db.Dishes_categoriesSet.FirstOrDefault(i => i.Name == AddNewCat).Id; new_dish.Weight = AddNewWeight; new_dish.Price = AddNewPric; new_dish.IsSelected = false; _model.db.DishesSet.Add(new_dish); await _model.db.SaveChangesAsync(); DishesList.Add(new_dish); OnPropertyChanged(new PropertyChangedEventArgs("DishesList")); Clear(); WpfMessageBox.Show("Добавление", "Новое блюдо успешно добавлено в меню", MessageBoxType.Information); TableVisible = false; AddVisible = false; HelpBtnVisibility = true; UpdateEv?.Invoke(obj, null); }
private void Search(object obj) { NotFound = false; if (_cur_cat_search != null) { ListProduct = _model.db.ProductSet.Where(i => i.Product_categoryId == Cur_cat_search.Id).ToList(); } if (!string.IsNullOrWhiteSpace(SearchString)) { ListProduct = _model.db.ProductSet.Where(i => i.Name.Contains(SearchString) | /*i.count.Contains(SearchString) |*/ i.Unit.Contains(SearchString)).ToList(); if (_cur_cat_search != null) { ListProduct = _model.db.ProductSet.Where(i => (i.Name.Contains(SearchString) && i.Product_categoryId == Cur_cat_search.Id) //| (i.count.Contains(SearchString) && i.Product_categoryId == Cur_cat_search.Id) | (i.Unit.Contains(SearchString) && i.Product_categoryId == Cur_cat_search.Id)).ToList(); } } if (ListProduct.Count == 0) { NotFound = true; } UpdateEv?.Invoke(obj, null); }
private async void DelProduct(object obj) { TableVisible = true; if (WpfMessageBox.Show("Удаление продуктов", "Вы действительно хотите удалить продукт(ы) ?", System.Windows.MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes) { Loading.Invoke(obj, null); await Task.Run(() => { List <Product> col = ListProduct.Where(item => item.IsSelected == true).ToList(); _model.db.ProductSet.RemoveRange(col); _model.db.SaveChanges(); ListProduct = _model.db.ProductSet.ToList(); _waitHandle.Set(); }); _waitHandle.WaitOne(); _can_edit = true; UpdateEv?.Invoke(obj, null); Loading?.Invoke(obj, null); } TableVisible = false; }
private void AddNewProduct(object obj) { Loading?.Invoke(obj, null); AddNewProductEvent?.Invoke(obj, null); NotFound = false; UpdateListProduct(); UpdateEv?.Invoke(obj, null); Loading?.Invoke(obj, null); }
void Update() { if (_allTimers.Count > 0) { for (int i = _allTimers.Count - 1; i >= 0; i--) { SEvent ev = _allTimers[i]; if (ev.callBack == null) { _allTimers.Remove(ev); } else if (Time.realtimeSinceStartup - ev.beginTime >= ev.delay) { ev.repeatNum--; if (ev.callBack != null) { ev.callBack(); } if (ev.repeatNum <= 0) { _allTimers.Remove(ev); ev = null; } else { ev.beginTime = Time.realtimeSinceStartup; } } } } if (_updateEv != null) { _updateEv.counter += Time.deltaTime; if (_updateEv.callBack != null) { float p = _updateEv.counter / _updateEv.tweenTime; float delta = _updateEv.begin + _updateEv.total * p; _updateEv.callBack(delta); } if (_updateEv.counter >= _updateEv.tweenTime) { _updateEv = null; } } }
public void valueTo(float begin, float end, floatEvent ev, float t) { _updateEv = new UpdateEv(ev, begin, end, t); }