public ToDoListViewModel()
 {
     var toDoItem = new ToDoItem
     {
         Name = "Cleaning",
         Description = "Clean the bathroom"
     };
     var toDoViewCellViewModel = new ToDoItemViewCellViewModel(toDoItem);
     for (var i = 0; i < 20; i++)
     {
         ToDoList.Add(toDoViewCellViewModel);
     }
 }
Example #2
0
        public void Save(ToDoItem item)
        {
            var statement = "INSERT INTO todo_items (item_id, item_text, created_at, completed_at) VALUES (@ItemId, @ItemText, @CreatedAt, @CompletedAt);";

            connection.WriteData(statement, item);
        }
Example #3
0
 public void UpdateItem(ToDoItem item)
 {
     Database.Update(item);
     MessagingCenter.Send(this, MessengerKeys.ItemChanged, item);
 }
Example #4
0
 public ToDoList addItem(ToDoItem item)
 {
     this.items.Add(item);
     return(this);
 }
 public ToDoItemViewCellViewModel(ToDoItem toDo)
 {
     Name = toDo.Name;
     Description = toDo.Description;
 }
Example #6
0
        private void SetItemUnCompleted(StackPanel parent, ToDoItem item)
        {
            if (item == null || parent == null)
            {
                return;
            }

            var storyboard = AnimationUtils.GetStoryboard();

            FrameworkElement completedLine = parent.FindName("CompletedLine") as FrameworkElement;
            AnimationUtils.SetWidthAnimation(storyboard, completedLine, 0, 0.3);

            storyboard.Completed += delegate(object sender, EventArgs e)
            {
                item.IsCompleted = false;
            };

            storyboard.Begin();
        }
Example #7
0
        private void SetItemCompleted(StackPanel parent, ToDoItem item)
        {
            if (item == null || parent == null)
            {
                return;
            }

            var storyboard = AnimationUtils.GetStoryboard();

            FrameworkElement completedLine = parent.FindName("CompletedLine") as FrameworkElement;
            AnimationUtils.SetWidthAnimation(storyboard, completedLine, 400, 0.3);
            if (mCurrentItemPanel == parent)
            {
                FrameworkElement toolbar = parent.FindName("ToolBar") as FrameworkElement;
                AnimationUtils.SetHeightAnimation(storyboard, toolbar, AnimationUtils.AnimationHeightHide, 0.3);

                FrameworkElement modifyButton = parent.FindName("ModifyButton") as FrameworkElement;
                AnimationUtils.SetOpacityAnimation(storyboard, modifyButton, 0, 0.3);

                mCurrentItemPanel = null;
            }

            var storyboard2 = AnimationUtils.GetStoryboard();
            FrameworkElement listItem = parent.FindName("ListItem") as FrameworkElement;
            AnimationUtils.SetTranslateAnimation(storyboard2, parent, 0, Application.Current.Host.Content.ActualHeight, 0.5);
            AnimationUtils.SetHeightAnimation(storyboard2, listItem, 0, 0.5);

            item.IsCompleted = true;
            storyboard.Completed += delegate(object sender, EventArgs e)
            {
                storyboard2.Begin();
            };

            storyboard2.Completed += delegate(object sender, EventArgs e)
            {
                App.ViewModel.ChangeCompletedStatus(item, true);
            };

            storyboard.Begin();
        }
Example #8
0
        private void ModifyItemTitle(StackPanel parent, ToDoItem item)
        {
            if (item == null || parent == null)
            {
                return;
            }

            const int topOffset = 180;

            var text = parent.FindName("ItemTitleText") as FrameworkElement;
            var transform = text.TransformToVisual(Application.Current.RootVisual);
            var pointOffset = transform.Transform(new Point(0, 0));
            Log.Info(TAG, "pointOffset.Y:" + pointOffset.Y.ToString());
            double verticalOffset = pointOffset.Y - topOffset;

            ModifyTitleControl modify = new ModifyTitleControl(item)
            {
                TitleHeight = (verticalOffset > 0) ? topOffset : pointOffset.Y
            };
            SetPopupedControlEvent(modify);

            modify.Closed += delegate(object sender, PopupEventArgs e)
            {
                if (verticalOffset > 0)
                {
                    var storyboard2 = AnimationUtils.GetStoryboard();
                    AnimationUtils.SetHeightAnimation(storyboard2, VacancyStackPanel as FrameworkElement, 0, 0.3);
                    storyboard2.Begin();
                }
            };

            if (verticalOffset > 0)
            {
                var storyboard = AnimationUtils.GetStoryboard();
                AnimationUtils.SetHeightAnimation(storyboard, VacancyStackPanel as FrameworkElement, verticalOffset + 1000, 0.3);
                AnimationUtils.SetAnyAnimation(storyboard, this as FrameworkElement, ScrowViewerVerticalOffsetProperty,
                    MainScrollViewer.VerticalOffset, MainScrollViewer.VerticalOffset + verticalOffset, 0.3);
                storyboard.Completed += delegate(object sender1, EventArgs e1)
                {
                    PopupWindow.ShowWindow(modify, PopupWindow.PopupWindowBackgroundType.Flash);
                };
                storyboard.Begin();
            }
            else
            {
                PopupWindow.ShowWindow(modify, PopupWindow.PopupWindowBackgroundType.Flash);
            }
        }
        public void addItem(string itemName)
        {
            ToDoItem newItem = new ToDoItem(itemName);

            toDoItems.Add(newItem);
        }
Example #10
0
 public ToDoItemWrapper(ToDoItem item)
 {
     ToDoItem = item;
 }