private void AddItemExcute() { INewItemView view = this.newItemsViewModel.ActiveNewItemView as INewItemView; NewItemModelBase model = this.viewDictionary[view]; AlertItem item = model.ToAlertItem(Settings.Default.DefaultAlertBeforeMinutes); this.dataService.Items.Add(item); int index = this.dataService.Branches.IndexOf(model.NoticeBranch); if (index > 0) { this.dataService.Branches.Move(index, 0); } else if (index < 0) { this.dataService.Branches.Add(model.NoticeBranch); } if (Settings.Default.ResetCountDownData) { model.Clean(); } }
public NewItemPresenter(INewItemView view) { _View = view; // Betöltjük a kategóriákat a nézetbe using (var db = new FleaMarketContext()) { _Categories = (from c in db.category select c).ToList(); } _View.Categories = _Categories; _View.SaveItem += SaveNewItem; }
private void NewItemsViewModelPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "ActiveNewItemView") { if (this.activeNewItemModel != null) { RemoveWeakEventListener(this.activeNewItemModel as INotifyPropertyChanged, ActiveNewItemModelPropertyChanged); } INewItemView view = this.newItemsViewModel.ActiveNewItemView as INewItemView; this.activeNewItemModel = this.viewDictionary[view]; if (this.activeNewItemModel != null) { AddWeakEventListener(this.activeNewItemModel as INotifyPropertyChanged, ActiveNewItemModelPropertyChanged); } UpdateCommand(); } }
private bool CanAddItemExcute() { INewItemView view = this.newItemsViewModel.ActiveNewItemView as INewItemView; if (view == null) { return(false); } NewItemModelBase model = this.viewDictionary[view]; if (model == null) { return(false); } if (string.IsNullOrEmpty(model.Validate())) { return(true); } else { return(false); } }