/// <summary> /// Add item to the manager instance and mark as local new created /// </summary> /// <param name="item">target item</param> /// <param name="index">current index of target item</param> public void AddNewItem(AccessContextItem item, int index) { if (!IsNewItem(item)) { Items.Add(new ItemEntry(item, ItemEntryState.New), index); Parent.RaiseNotifyPropertyChanged("ContainsLocalChanges"); } }
/// <summary> /// Add item to the manager instance and mark as local changed /// </summary> /// <param name="item">target item</param> /// <param name="index">current index of target item</param> public void AddChangedItem(AccessContextItem item, int index) { if (item.ItemState != AccessContextItemState.ItemIsDeleted && !IsChangedItem(item) && !(IsNewItem(item))) { item.ItemState = AccessContextItemState.ItemIsLocalChanged; Items.Add(new ItemEntry(item, ItemEntryState.Changed), index); Parent.RaiseNotifyPropertyChanged("ContainsLocalChanges"); } }
public override void SetValue(object component, object value) { AccessContextItem item = component as AccessContextItem; if (null != item) { item.SetValue(Name, value); } }
/// <summary> /// Add item to the manager instance and mark as local deleted /// </summary> /// <param name="item"></param> public void AddDeletedItem(AccessContextItem item) { if (!IsDeletedItem(item)) { int currentIndex = item.Parent.IndexOf(item); Items.Add(new ItemEntry(item, ItemEntryState.Deleted), currentIndex); item.ItemState = AccessContextItemState.ItemIsLocalDeleted; Parent.RaiseNotifyPropertyChanged("ContainsLocalChanges"); } }
/// <summary> /// Returns info, an item is local changed (not new or deleted) /// </summary> /// <param name="item">target item</param> /// <returns>true if local changed otherwise false</returns> public bool IsChangedItem(AccessContextItem item) { foreach (var listItem in Items) { if (listItem.Key.Item == item && listItem.Key.State == ItemEntryState.Changed) { return(true); } } return(false); }
private void Table_AfterRemove(AccessContextItem item, int itemIndex) { if (IsCurrentlyInUndoRedoAction) { return; } var deleteRedo = RemoveClosure.Create(this, item.Parent.Remove, item); var deleteUndo = InsertClosure.Create(this, item.Parent.Insert, itemIndex, item); Commands.Append(new Command("Delete Item", deleteRedo, deleteUndo)); }
internal void Item_IsLocalChanged(AccessContextItem item, string propertyName, object oldValue, object newValue) { if (IsCurrentlyInUndoRedoAction) { return; } var changeRedo = ChangeClosure.Create(this, item.SetValue, propertyName, newValue); var changeUndo = ChangeClosure.Create(this, item.SetValue, propertyName, oldValue); Commands.Append(new Command("Change Item", changeRedo, changeUndo)); }
public override object GetValue(object component) { AccessContextItem item = component as AccessContextItem; if (null != item) { return(item.GetValue(Name)); } else { return(null); } }
/// <summary> /// Removes an new/deleted/changed item /// </summary> /// <param name="item"></param> internal void RemoveItem(AccessContextItem item) { ItemEntry entry = null; foreach (var listItem in Items) { if (listItem.Key.Item == item) { entry = listItem.Key; break; } } if (null != entry) { Items.Remove(entry); Parent.RaiseNotifyPropertyChanged("ContainsLocalChanges"); } }
/// <summary> /// Remove an item from the manager instance that is marked as local new created /// </summary> /// <param name="item">target item</param> public void RemoveNewItem(AccessContextItem item) { if (IsNewItem(item)) { ItemEntry entry = null; foreach (var listItem in Items) { if (listItem.Key.Item == item && listItem.Key.State == ItemEntryState.New) { entry = listItem.Key; break; } } if (null != entry) { Console.WriteLine("RemoveNewItem " + item.ToString()); Items.Remove(entry); item.ItemState = AccessContextItemState.ItemIsDeleted; Parent.RaiseNotifyPropertyChanged("ContainsLocalChanges"); } } }
public static Closure Create(AccessContext parentContext, InsertHandler action, int index, AccessContextItem item) { return new InsertClosure(parentContext, action, index, item); }
public InsertClosure(AccessContext parentContext, InsertHandler action, int index, AccessContextItem item) : base(parentContext) { _execute = action; _arg0 = index; _arg1 = item; }
/// <summary> /// Add item to the manager instance and mark as local new created /// </summary> /// <param name="item">target item</param> /// <param name="index">current index of target item</param> public void AddNewItem(AccessContextItem item, int index) { if (!IsNewItem(item)) { Items.Add(new ItemEntry(item, ItemEntryState.New), index); Parent.RaiseNotifyPropertyChanged("ContainsLocalChanges"); } }
public InsertClosure(AccessContext parentContext, InsertHandler action, int index, AccessContextItem item) : base(parentContext) { _execute = action; _arg0 = index; _arg1 = item; }
internal ItemEntry(AccessContextItem item, ItemEntryState state) { Item = item; State = state; }
/// <summary> /// Add item to the manager instance and mark as local changed /// </summary> /// <param name="item">target item</param> /// <param name="index">current index of target item</param> public void AddChangedItem(AccessContextItem item, int index) { if (item.ItemState != AccessContextItemState.ItemIsDeleted && !IsChangedItem(item) && !(IsNewItem(item))) { item.ItemState = AccessContextItemState.ItemIsLocalChanged; Items.Add(new ItemEntry(item, ItemEntryState.Changed), index); Parent.RaiseNotifyPropertyChanged("ContainsLocalChanges"); } }
/// <summary> /// Remove an item from the manager instance that is marked as local new created /// </summary> /// <param name="item">target item</param> public void RemoveNewItem(AccessContextItem item) { if (IsNewItem(item)) { ItemEntry entry = null; foreach (var listItem in Items) { if (listItem.Key.Item == item && listItem.Key.State == ItemEntryState.New) { entry = listItem.Key; break; } } if (null != entry) { Console.WriteLine("RemoveNewItem " + item.ToString()); Items.Remove(entry); item.ItemState = AccessContextItemState.ItemIsDeleted; Parent.RaiseNotifyPropertyChanged("ContainsLocalChanges"); } } }
public static Closure Create(AccessContext parentContext, RemoveHandler action, AccessContextItem item) { return(new RemoveClosure(parentContext, action, item)); }
internal RemoveClosure(AccessContext parentContext, RemoveHandler action, AccessContextItem item) : base(parentContext) { _execute = action; _arg0 = item; }
public static Closure Create(AccessContext parentContext, InsertHandler action, int index, AccessContextItem item) { return(new InsertClosure(parentContext, action, index, item)); }
internal RemoveClosure(AccessContext parentContext, RemoveHandler action, AccessContextItem item) : base(parentContext) { _execute = action; _arg0 = item; }
internal ItemEntry(AccessContextItem item, ItemEntryState state) { Item = item; State = state; }
public static Closure Create(AccessContext parentContext, RemoveHandler action, AccessContextItem item) { return new RemoveClosure(parentContext, action, item); }
/// <summary> /// Add item to the manager instance and mark as local deleted /// </summary> /// <param name="item"></param> public void AddDeletedItem(AccessContextItem item) { if (!IsDeletedItem(item)) { int currentIndex = item.Parent.IndexOf(item); Items.Add(new ItemEntry(item, ItemEntryState.Deleted), currentIndex); item.ItemState = AccessContextItemState.ItemIsLocalDeleted; Parent.RaiseNotifyPropertyChanged("ContainsLocalChanges"); } }
/// <summary> /// Returns info, an item is local changed (not new or deleted) /// </summary> /// <param name="item">target item</param> /// <returns>true if local changed otherwise false</returns> public bool IsChangedItem(AccessContextItem item) { foreach (var listItem in Items) if (listItem.Key.Item == item && listItem.Key.State == ItemEntryState.Changed) return true; return false; }
/// <summary> /// Removes an new/deleted/changed item /// </summary> /// <param name="item"></param> internal void RemoveItem(AccessContextItem item) { ItemEntry entry = null; foreach (var listItem in Items) { if (listItem.Key.Item == item) { entry = listItem.Key; break; } } if (null != entry) { Items.Remove(entry); Parent.RaiseNotifyPropertyChanged("ContainsLocalChanges"); } }