private void Save() { if (_dishesCollection.Any(d => d.Title.ToLower() == Title.ToLower())) { MessageBox.Show("Блюдо с таким именем уже существует"); } else { if (!String.IsNullOrEmpty(NewTag)) { AddTag(); } if (!String.IsNullOrEmpty(NewIngredient)) { AddIngredient(); } _dishesCollection.Add(_currentDish); _currentDish = new Dish(); Tags = new LazyObservableCollection <Tag>(_currentDish.Tags); Ingredients = new LazyObservableCollection <Ingredient>(_currentDish.Ingredients); InvokePropertyChanged(nameof(Title)); NewIngredient = String.Empty; InvokePropertyChanged(nameof(Ingredients)); NewTag = String.Empty; InvokePropertyChanged(nameof(Tags)); InvokePropertyChanged(nameof(IsCanSave)); } }
public static ListViewAdapter <T> Build(ListView list, LazyObservableCollection <T> lazyObservableCollection, Func <T, View> getView, LayoutInflater layoutInflater) { var adapter = new ListViewAdapter <T>(list, lazyObservableCollection, getView, layoutInflater); #pragma warning disable 4014 lazyObservableCollection.LoadItemsAsync(); #pragma warning restore 4014 return(adapter); }
private ListViewAdapter(ListView list, LazyObservableCollection <T> lazyObservableCollection, Func <T, View> getView, LayoutInflater layoutInflater) { this.list = list; this.lazyObservableCollection = lazyObservableCollection; this.getView = getView; this.footerView = layoutInflater.Inflate(Resource.Layout.ListViewBusyIndicatorFooter, null); list.Adapter = this.lazyObservableCollection.GetAdapter(this.GetAdapter); this.InitializeCollection(this.lazyObservableCollection); }
protected TreeViewItemViewModel( IStandarImageSourceFactory imageSourceFactory, TreeViewItemViewModel parentViewModel, bool lazyLoadChildren) { _imageSourceFactory = imageSourceFactory; _parentViewModel = parentViewModel; _children = new LazyObservableCollection<TreeViewItemViewModel>(HardCodedSettings.MaxExpandedTreeViewItemCount, CreateLazyItemViewModel); if (lazyLoadChildren) _children.Add(DummyChild); }
protected TreeViewItemViewModel( IStandarImageSourceFactory imageSourceFactory, TreeViewItemViewModel parentViewModel, bool lazyLoadChildren) { _imageSourceFactory = imageSourceFactory; _parentViewModel = parentViewModel; _children = new LazyObservableCollection<TreeViewItemViewModel>(_initialItemCountLimit, CreateLazyItemViewModel); if (lazyLoadChildren) _children.Add(_dummyChild); }
protected TreeViewItemViewModel( IStandarImageSourceFactory imageSourceFactory, TreeViewItemViewModel parentViewModel, bool lazyLoadChildren) { _imageSourceFactory = imageSourceFactory; _parentViewModel = parentViewModel; _children = new LazyObservableCollection <TreeViewItemViewModel>(HardCodedSettings.MaxExpandedTreeViewItemCount, CreateLazyItemViewModel); if (lazyLoadChildren) { _children.Add(DummyChild); } }
public DishCreatorViewModel(ObservableCollection <Dish> dishesCollection, ObservableCollection <Tag> tags, ObservableCollection <Ingredient> ingredients) { _dishesCollection = dishesCollection; AllTags = tags; AllIngredients = ingredients; _currentDish = new Dish(); AddIngredientCommand = new DelegateCommand(o => AddIngredient()); AddTagCommand = new DelegateCommand(o => AddTag()); SaveCommand = new DelegateCommand(o => Save()); RemoveIngredientCommand = new DelegateCommand(o => RemoveIngredient(o as Ingredient)); RemoveTagCommand = new DelegateCommand(o => RemoveTag(o as Tag)); Tags = new LazyObservableCollection <Tag>(_currentDish.Tags); Ingredients = new LazyObservableCollection <Ingredient>(_currentDish.Ingredients); }
protected TreeViewItemViewModel( IStandarImageSourceFactory imageSourceFactory, TreeViewItemViewModel parentViewModel, bool lazyLoadChildren) { _imageSourceFactory = imageSourceFactory; _parentViewModel = parentViewModel; _children = new LazyObservableCollection <TreeViewItemViewModel>(_initialItemCountLimit, CreateLazyItemViewModel); if (lazyLoadChildren) { _children.Add(_dummyChild); } }