示例#1
0
 public Document()
 {
     Flash = new FlashSettings();
     _cont = new ObservableCollection <Controller>();
     _root = UndoRedo.UndoService.Current[this];
     _cont.CollectionChanged += Controllers_CollectionChanged;
 }
示例#2
0
		/// <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);
		}
示例#3
0
		/// <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);
		}
示例#4
0
        /// <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);
        }
示例#5
0
 /// <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);
     }
 }
示例#6
0
        /// <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);
            }
        }
示例#7
0
		public Document() {
			Flash = new FlashSettings();
			_cont = new ObservableCollection<Controller>();
			_root = UndoRedo.UndoService.Current[this];
			_cont.CollectionChanged += Controllers_CollectionChanged;
		}