private void RaiseLanguageRemoveInteractionRequest(GeneralLanguage selectedItem) { var confirmation = new ConditionalConfirmation { Title = "Remove confirmation".Localize(null, LocalizationScope.DefaultCategory), Content = string.Format("Are you sure you want to remove Language '{0}'?".Localize(), selectedItem.LanguageCode) }; LanguageCommonConfirmRequest.Raise(confirmation, (x) => { if (x.Confirmed) { if (AddedItems.Contains(selectedItem)) { AddedItems.Remove(selectedItem); } else { if (UpdatedItems.Contains(selectedItem)) { UpdatedItems.Remove(selectedItem); } RemovedItems.Add(selectedItem); } InnerItems.Remove(selectedItem); } }); }
private void OnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) { var item = (T)sender; if (!AddedItems.Contains(item) && !UpdatedItems.Contains(item)) { UpdatedItems.Add(item); } }
public void Remove(T item) { if (AddedItems.Contains(item)) { AddedItems.Remove(item); } else { if (UpdatedItems.Contains(item)) { UpdatedItems.Remove(item); } RemovedItems.Add(item); } InnerItems.Remove(item); item.PropertyChanged -= OnPropertyChanged; }
public virtual void RejectChange(T item, bool applyToItem) { if (AddedItems.Contains(item)) { RemoveItem(Items.IndexOf(item)); } else if (RemovedItems.Contains(item)) { InsertItem(Items.Count, item); } else { throw new ArgumentOutOfRangeException(nameof(item), "The specified item does not exist in this collection."); } if (applyToItem && item is IRevertibleChangeTracking) { ((IRevertibleChangeTracking)item).RejectChanges(); } }