Beispiel #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();
            }
        }
Beispiel #2
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);
            }
        }