public Document() { Flash = new FlashSettings(); _cont = new ObservableCollection <Controller>(); _root = UndoRedo.UndoService.Current[this]; _cont.CollectionChanged += Controllers_CollectionChanged; }
/// <summary> /// Starts an undo batch, which is ended when this instance is disposed. Designed for use in a using statement. /// </summary> /// <param name="root">The UndoRoot related to this instance.</param> /// <param name="description">The description of this batch of changes.</param> /// <param name="consolidateChangesForSameInstance">Should the batch consolidate changes.</param> public UndoBatch(UndoRoot root, string description, bool consolidateChangesForSameInstance) { if (null == root) return; _undoRoot = root; root.BeginChangeSetBatch(description, consolidateChangesForSameInstance); }
/// <summary> /// Create a ChangeSet for the specified UndoRoot. /// </summary> /// <param name="undoRoot">The UndoRoot that this ChangeSet belongs to.</param> /// <param name="description">A description of the change.</param> /// <param name="change">The Change instance that can perform the undo / redo as needed.</param> public ChangeSet(UndoRoot undoRoot, string description, Change change) { _undoRoot = undoRoot; _changes = new List<Change>(); _description = description; if (null != change) AddChange(change); }
/// <summary> /// Starts an undo batch, which is ended when this instance is disposed. Designed for use in a using statement. /// </summary> /// <param name="root">The UndoRoot related to this instance.</param> /// <param name="description">The description of this batch of changes.</param> /// <param name="consolidateChangesForSameInstance">Should the batch consolidate changes.</param> public UndoBatch(UndoRoot root, string description, bool consolidateChangesForSameInstance) { if (null == root) { return; } _undoRoot = root; root.BeginChangeSetBatch(description, consolidateChangesForSameInstance); }
/// <summary> /// Create a ChangeSet for the specified UndoRoot. /// </summary> /// <param name="undoRoot">The UndoRoot that this ChangeSet belongs to.</param> /// <param name="description">A description of the change.</param> /// <param name="change">The Change instance that can perform the undo / redo as needed.</param> public ChangeSet(UndoRoot undoRoot, string description, Change change) { _undoRoot = undoRoot; _changes = new List <Change>(); _description = description; if (null != change) { AddChange(change); } }
/// <summary> /// Get (or create) an UndoRoot for the specified object or document instance. /// </summary> /// <param name="root">The object that represents the root of the document or object hierarchy.</param> /// <returns>An UndoRoot instance for this object.</returns> public UndoRoot this[object root] { get { if (null == root) { return(null); } UndoRoot ret = null; if (_roots.ContainsKey(root)) { ret = _roots[root]; } if (null == ret) { ret = new UndoRoot(root); _roots.Add(root, ret); } return(ret); } }
public Document() { Flash = new FlashSettings(); _cont = new ObservableCollection<Controller>(); _root = UndoRedo.UndoService.Current[this]; _cont.CollectionChanged += Controllers_CollectionChanged; }