Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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();
            }
        }
Exemplo n.º 4
0
        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);
            }
        }