Exemple #1
0
        public void DeleteMessage(MailMessage message, bool permanent = false)
        {
            message.Flags |= MailFlags.Deleted; // marke the message as deleted

            //first simuate deleting the item by moving it to the deleted folders
            if (!DeletedItems.Contains(message))
            {
                DeletedItems.Add(message);
            }

            if (InboxItems.Contains(message))
            {
                InboxItems.Remove(message);
            }

            if (DraftItems.Contains(message))
            {
                DraftItems.Remove(message);
            }

            if (SentItems.Contains(message))
            {
                SentItems.Remove(message);
            }

            if (permanent)
            {
                if (DeletedItems.Contains(message))
                {
                    DeletedItems.Remove(message);
                }
            }
        }
 /// <summary>
 /// Clear the item from observable collection
 /// </summary>
 protected override void ClearItems()
 {
     foreach (T item in this.Items)
     {
         DeletedItems.Add(item);
     }
     base.ClearItems();
 }
 public void DeleteMangaInfo(MangaInfo item, bool addToDeletedItems)
 {
     if (addToDeletedItems)
     {
         var deleted = new DeletedMangaInfo(item);
         DeletedItems.Add(deleted);
     }
     Items.Remove(item);
     SaveChanges();
 }
        /// <summary>
        /// remove the item at an index
        /// </summary>
        /// <param name="index"></param>
        protected override void RemoveItem(int index)
        {
            T item = this[index];

            base.RemoveItem(index);
            DeletedItems.Add(item);

            if (ItemRemoved != null)
            {
                ItemRemoved(item);
            }
        }
Exemple #5
0
        /// <summary>
        /// Removes the item at the specified index.
        /// </summary>
        /// <param name="index">The zero-based index of the item to remove.</param>
        protected override void RemoveItem(int index)
        {
            T item = Items[index];

            if (item != null)
            {
                //Move item to deleted collection(if not in added state)
                if (item.EntityState != EntityState.Added)
                {
                    item.MarkToDelete();
                    DeletedItems.Add(item);
                }
                base.RemoveItem(index);
            }
        }
 internal override void OnDesignTimeOutputDeleted(string outputMoniker)
 {
     DeletedItems.Add(outputMoniker);
 }
Exemple #7
0
 public void RegisterDeleted(object entity)
 {
     //_innerUnitOfWork.RegisterDeleted(entity);
     DeletedItems.Add(entity);
 }