コード例 #1
0
        private void deleteTask(TreeViewItem item, bool deleteFromDatabase = true)
        {
            // Delete the task from the file
            if (deleteFromDatabase)
            {
                UserTask task = item.Header as UserTask;
                TaskDatabase.Delete(task);
                ReminderQueue.RemoveItem(task.ID, task.StartDate, ReminderType.Task);
            }
            // else, we just want to use the animation.

            TreeViewItem parent = item.Parent as TreeViewItem;

            if (parent.Items.Count > 1)
            {
                if (Settings.AnimationsEnabled)
                {
                    AnimationHelpers.DeleteAnimation deleteAnim = new AnimationHelpers.DeleteAnimation(item);
                    deleteAnim.OnAnimationCompletedEvent += deleteAnim_OnAnimationCompletedEvent;
                    deleteAnim.Animate();
                }
                else
                {
                    parent.Items.Remove(item);
                }
            }
            else
            {
                if (Settings.AnimationsEnabled)
                {
                    AnimationHelpers.DeleteAnimation parentDeleteAnim = new AnimationHelpers.DeleteAnimation(parent);
                    parentDeleteAnim.OnAnimationCompletedEvent += parentDeleteAnim_OnAnimationCompletedEvent;
                    parentDeleteAnim.Animate();

                    if (tasksTreeView.Items.Count <= 1)
                    {
                        statusText.Text = "We didn't find anything to show here.";
                        new AnimationHelpers.Fade(statusText, AnimationHelpers.FadeDirection.In);
                    }
                }
                else
                {
                    tasksTreeView.Items.Remove(parent);
                    if (tasksTreeView.Items.Count == 0)
                    {
                        statusText.Text       = "We didn't find anything to show here.";
                        statusText.Visibility = Visibility.Visible;
                        statusText.Opacity    = 1;
                    }
                }
            }
        }
コード例 #2
0
        public void AnimatedDelete(bool deleteFromDatabase = true)
        {
            if (_isDeleting)
            {
                return;
            }

            CloseToolTip();

            if (deleteFromDatabase && _appointment != null)
            {
                if (_appointment.IsRepeating)
                {
                    EditRecurring dlg = new EditRecurring(Application.Current.MainWindow, EditingType.Delete);

                    if (dlg.ShowDialog() == false)
                    {
                        return;
                    }

                    if (dlg.EditResult == EditResult.Single)
                    {
                        AppointmentDatabase.DeleteOne(_appointment, _appointment.RepresentingDate);
                    }
                    else
                    {
                        AppointmentDatabase.Delete(_appointment);
                    }
                }
                else
                {
                    AppointmentDatabase.Delete(_appointment);
                }

                ReminderQueue.RemoveItem(_appointment.ID, _appointment.IsRepeating ? _appointment.RepresentingDate.Add(_appointment.StartDate.TimeOfDay) : _appointment.StartDate, ReminderType.Appointment);
            }

            _isDeleting = true;
            DeleteStartEvent(EventArgs.Empty);

            if (Settings.AnimationsEnabled)
            {
                AnimationHelpers.DeleteAnimation delAnim = new AnimationHelpers.DeleteAnimation(this);
                delAnim.OnAnimationCompletedEvent += delAnim_OnAnimationCompletedEvent;
                delAnim.Animate();
            }
            else
            {
                DeleteEndEvent(EventArgs.Empty);
            }
        }
コード例 #3
0
ファイル: MessageBar.cs プロジェクト: mingslogar/dimension4
        public void Close()
        {
            IsHitTestVisible = false;

            if (Settings.AnimationsEnabled)
            {
                AnimationHelpers.DeleteAnimation delete = new AnimationHelpers.DeleteAnimation(this);
                delete.OnAnimationCompletedEvent += (anim, args) => { RaiseClosedEvent(); };
                delete.Animate();
            }
            else
            {
                RaiseClosedEvent();
            }
        }
コード例 #4
0
        private void deleteButton_Click(object sender, RoutedEventArgs e)
        {
            ListBoxItem item = (ListBoxItem)((FrameworkElement)sender).TemplatedParent;
            string      text = (string)item.Content;

            SpellChecking.DeleteWordFromDictionary(text);

            if (Settings.AnimationsEnabled)
            {
                AnimationHelpers.DeleteAnimation delete = new AnimationHelpers.DeleteAnimation(item);
                delete.OnAnimationCompletedEvent += delete_OnAnimationCompletedEvent;
                delete.Animate();
            }
            else
            {
                listBox.Items.Remove(item);
            }
        }