public DiagramDocument(DiagramDocumentCore core = null) { _undoStack = new DDUndoStack(this); _core = core ?? new DiagramDocumentCore(); foreach (var shape in _core.Shapes) shape.OnBeingAdded(this); }
public void Setting() { var s = new UndoStack<int>(); var a = new Restorable<int>(s, 0); a.Value = 1; Assert.AreEqual(1, a); }
public void Undo(UndoStack stack) { Debug.Assert(stack.state == UndoStack.StatePlayback); stack.RegisterAffectedDocument(document); stack.state = UndoStack.StatePlaybackModifyDocument; this.Undo(); stack.state = UndoStack.StatePlayback; }
/// <summary> /// Create a new text document with the specified initial text. /// </summary> public TextDocument(IEnumerable<char> initialText) { if (initialText == null) throw new ArgumentNullException("initialText"); rope = new Rope<char>(initialText); lineTree = new DocumentLineTree(this); lineManager = new LineManager(lineTree, this); lineTrackers.CollectionChanged += delegate { lineManager.UpdateListOfLineTrackers(); }; anchorTree = new TextAnchorTree(this); undoStack = new UndoStack(); FireChangeEvents(); }
public void SetAndRestore() { var s = new UndoStack<int>(); var a = new Restorable<int>(s, 0); var mark1 = s.MarkStack(); a.Value = 1; Assert.AreEqual(1, a); var mark2 = s.MarkStack(); a.Value = 2; Assert.AreEqual(2, a); s.Restore(mark2); Assert.AreEqual(1, a); a.Value = 3; Assert.AreEqual(3, a); var mark3 = s.MarkStack(); a.Value = 4; Assert.AreEqual(4, a); s.Restore(mark3); Assert.AreEqual(3, a); s.Restore(mark1); Assert.AreEqual(0, a); }
private void btn_remove_Click(object sender, EventArgs e) { var toRemove = new List <object>(); for (int i = 0; i < lst_synonyms.SelectedItems.Count; ++i) { toRemove.Add(lst_synonyms.SelectedItems[i]); } var undoes = new List <Action>(); var redoes = new List <Action>(); foreach (var item in toRemove) { lst_synonyms.Items.Remove(item); undoes.Add(lst_synonyms.AddItem(() => { return(this.Parent.EditCardSynonyms); }, lst_synonyms.Name, item)); redoes.Add(lst_synonyms.RemoveItem(() => { return(this.Parent.EditCardSynonyms); }, lst_synonyms.Name, item)); } UndoStack.Push(new UndoRedoActionPair(undoes.ToArray(), redoes.ToArray(), "Remove synonym(s)", new OwnerControlData(this, this.Parent, Language))); UpdateUndoRedoTooltips(); ChangedSinceLastSave = true; }
static void OnIsModifiedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TextEditor editor = d as TextEditor; if (editor != null) { TextDocument document = editor.Document; if (document != null) { UndoStack undoStack = document.UndoStack; if ((bool)e.NewValue) { if (undoStack.IsOriginalFile) { undoStack.DiscardOriginalFileMarker(); } } else { undoStack.MarkAsOriginalFile(); } } } }
public Task ExecuteUserActionAsync() { // Get selected items from ShapeList List <PaintBase> selected = ShapeList.Where(pb => pb.Selected).ToList(); // Only group if 2 or more items are selected if (selected.Count > 1) { // Add undo entry UndoStack.Push(ShapeList.DeepCopy()); RedoStack.Clear(); // Create new group PaintGroup newGroup = new PaintGroup() { Selected = true }; // Add selected items to the group // Remove selected items from the canvas itself foreach (PaintBase paintBase in selected) { ShapeList.Remove(paintBase); paintBase.Selected = false; newGroup.Add(paintBase); } ShapeList.Add(newGroup); _page.Draw(); _page.UpdateList(); } return(Task.CompletedTask); }
public override void Undo() { if (!UndoStack.Any()) { return; } // Get Previous Change var previousItemChange = UndoStack.Pop(); var selectedItem = Items[previousItemChange.Index]; // Set Redo Change PushNewItemChange(selectedItem, previousItemChange.Index, RedoStack); // Undo Items[previousItemChange.Index] = (Furniture)previousItemChange.Item; var img = EditorPictureBox.Image; EditorPictureBox.Image = ImageGeneration.DrawFurnitureArrows((Bitmap)Inventory.GetItemPic(ItemCellSize, ItemsPerRow, Items, MainForm.SaveFile.SaveType, EditorPictureBox.Size), (Furniture[])Items, ItemsPerRow); img?.Dispose(); OnItemChanged(selectedItem, Items[previousItemChange.Index], previousItemChange.Index); }
protected override void OnLoad(EventArgs e) { Location = new Point(Program.Settings.GetValue<int>("mainform_x", Location.X), Program.Settings.GetValue<int>("mainform_y", Location.Y)); Size = new Size(Program.Settings.GetValue<int>("mainform_width", Width), Program.Settings.GetValue<int>("mainform_height", Height)); toolbox.AlphaButtonClick += new EventHandler<EventArgs>(toolbox_AlphaButtonClick); toolbox.BackgroundButtonClick += new EventHandler<EventArgs>(toolbox_BackgroundButtonClick); toolbox.ButtonButtonClick += new EventHandler<EventArgs>(toolbox_ButtonButtonClick); toolbox.CheckboxButtonClick += new EventHandler<EventArgs>(toolbox_CheckboxButtonClick); toolbox.HtmlButtonClick += new EventHandler<EventArgs>(toolbox_HtmlButtonClick); toolbox.ImageButtonClick += new EventHandler<EventArgs>(toolbox_ImageButtonClick); toolbox.ItemButtonClick += new EventHandler<EventArgs>(toolbox_ItemButtonClick); toolbox.LabelButtonClick += new EventHandler<EventArgs>(toolbox_LabelButtonClick); toolbox.RadioButtonClick += new EventHandler<EventArgs>(toolbox_RadioButtonClick); toolbox.TextEntryButtonClick += new EventHandler<EventArgs>(toolbox_TextEntryButtonClick); toolbox.TiledImageButtonClick += new EventHandler<EventArgs>(toolbox_TiledImageButtonClick); toolbox.InitializeClickHandlers(); undoStack = new UndoStack(); redoStack = new RedoStack(); }
/// <summary> /// Merges multiple undo changes into one. /// </summary> /// <param name="amount">Amount of changes to squash.</param> public void SquashUndoChanges(int amount) { string description = UndoStack.ElementAt(UndoStack.Count - amount).Description; SquashUndoChanges(amount, description); }
internal string StackUndoPop() { return(UndoStack.Pop()); }
public void Do(ITextOperation operation) { operation.Do(); UndoStack.Push(operation); RedoStack.Clear(); }
/// <summary> /// Adds an undo unit to the undo/redo stack, depending on current state. /// </summary> /// <param name="unit"> /// IUndoUnit to add /// </param> /// <exception cref="InvalidOperationException"> /// Thrown if: /// UndoManager is disabled /// unit is not IParentUndoUnit and there is no open IParentUndoUnit /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if unit is null /// </exception> internal void Add(IUndoUnit unit) { IParentUndoUnit parent; if (!IsEnabled) { throw new InvalidOperationException(SR.Get(SRID.UndoServiceDisabled)); } if (unit == null) { throw new ArgumentNullException("unit"); } parent = DeepestOpenUnit; if (parent != null) { parent.Add(unit); } else if (unit is IParentUndoUnit) { ((IParentUndoUnit)unit).Container = this; if (LastUnit is IParentUndoUnit) { ((IParentUndoUnit)LastUnit).OnNextAdd(); } SetLastUnit(unit); if (State == UndoState.Normal || State == UndoState.Redo) { if (++_topUndoIndex == UndoLimit) { _topUndoIndex = 0; } if (!(_topUndoIndex < UndoStack.Count && PeekUndoStack() == null) && // Non-null topmost stack item (UndoLimit == -1 || UndoStack.Count < UndoLimit)) { UndoStack.Add(unit); } else { if (PeekUndoStack() != null) { if (++_bottomUndoIndex == UndoLimit) { _bottomUndoIndex = 0; } } UndoStack[_topUndoIndex] = unit; } } else if (State == UndoState.Undo) { RedoStack.Push(unit); } else if (State == UndoState.Rollback) { // do nothing, throwing out the unit } } else { throw new InvalidOperationException(SR.Get(SRID.UndoNoOpenParentUnit)); } }
public void DoWithoutDo(IAction action) { UndoStack.Push(action); RedoStack.Clear(); }
public static void showUB(UndoStack p) { }
public static void Render(FMAT material, UVViewport UVViewport, bool onLoad) { float width = ImGui.GetWindowWidth(); if (ImGui.BeginChild("TEXTURE_MAP_LIST", new System.Numerics.Vector2(width, 100))) { int index = 0; foreach (var texMap in material.TextureMaps) { var tex = SearchTextureInstance(texMap.Name); if (tex != null) { if (tex.RenderableTex == null) { tex.LoadRenderableTexture(); } if (tex.RenderableTex != null) { IconManager.LoadTexture(tex.Name, tex); } else { IconManager.LoadIcon("TEXTURE"); } } else { IconManager.LoadIcon("TEXTURE"); } ImGui.SameLine(); if (dialogOpened && SelectedIndices.Contains(index)) { if (TextureSelectionDialog.Render(texMap.Name, ref dialogOpened)) { var input = TextureSelectionDialog.OutputName; //Only undo matching textures, not typed names if (tex != null) { UndoStack.Add(new UndoStringOperation($"Texture Map", texMap, "Name", input)); } texMap.Name = input; } } else { if (ImGui.Selectable(texMap.Name, SelectedIndices.Contains(index))) { SelectedIndices.Clear(); SelectedIndices.Add(index); } if (ImGui.IsItemClicked() && ImGui.IsMouseDoubleClicked(0)) { dialogOpened = true; } } index++; } } ImGui.EndChild(); if (material.TextureMaps.Count == 0) { return; } //Make sure there is atleast 1 selection used if (SelectedIndices.Count == 0) { SelectedIndices.Add(0); } if (ImGui.BeginChild("SAMPLER_DATA")) { SelectSampler(material, UVViewport, SelectedIndices.FirstOrDefault(), onLoad); } ImGui.EndChild(); }
public void Close() { UndoStack.Clear(); RedoStack.Clear(); }
protected void Init() { undoStack = new UndoStack(); }
public LayerBoxViewModel(UndoStack stack) { this.edits = stack; Layers = new WrappedObservableCollection <T>(); }
void Awake() { Util.FindIfNotSet(this, ref popups); lastCreated = this; }
/// <summary> /// clean out both lists of actions /// </summary> public void Flush() { UndoStack.Clear(); RedoStack.Clear(); }
/// <summary> /// リセット /// </summary> public static void Reset() { UndoStack.Clear(); RedoStack.Clear(); OnUpdateData(); }
public AnimLayerBoxViewModel(UndoStack edits) : base(edits) { }
/// <summary> /// Empty both the undo and redo stack /// </summary> public virtual void ClearUndoStack() { BeginStage(); UndoStack.Clear(); RedoStack.Clear(); }
private void btn_update_Click(object sender, EventArgs e) { if (lst_synonyms.Items.Contains(txt_wordAdd.Text)) { MessageBox.Show("Duplicates are not allowed", "SteelQuiz", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txt_wordAdd.Text.StartsWith(" ") || txt_wordAdd.Text.EndsWith(" ")) { var msg = MessageBox.Show("The text contains whitespace in the beginning/end. Remove this whitespace (trim the text)?" + "\r\n\r\nThis is strongly recommended if you did not intend this", "SteelQuiz", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (msg == DialogResult.Yes) { txt_wordAdd.Text = txt_wordAdd.Text.Trim(); } else if (msg == DialogResult.Cancel) { return; } } if (txt_wordAdd.Text.Contains(" ")) { var msg = MessageBox.Show("The text contains double-/multispaces. Replace the double-/multispaces with single spaces?" + "\r\n\r\nThis is strongly recommended if you did not intend this", "SteelQuiz", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (msg == DialogResult.Yes) { while (txt_wordAdd.Text.Contains(" ")) { txt_wordAdd.Text = txt_wordAdd.Text.Replace(" ", " "); } } else if (msg == DialogResult.Cancel) { return; } } if (lst_synonyms.SelectedItems.Count == 0) { return; } if (lst_synonyms.SelectedItems.Count > 1) { MessageBox.Show("Only one item can be updated as duplicates are not allowed", "SteelQuiz", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var toUpdate = new List <object>(); for (int i = 0; i < lst_synonyms.SelectedItems.Count; ++i) { toUpdate.Add(lst_synonyms.SelectedItems[i]); } var undoes = new List <Action>(); var redoes = new List <Action>(); foreach (var item in toUpdate) { var old = lst_synonyms.Items[lst_synonyms.Items.IndexOf(item)]; var _new = txt_wordAdd.Text; lst_synonyms.Items[lst_synonyms.Items.IndexOf(item)] = _new; undoes.Add(lst_synonyms.ChangeItem(old, _new)); redoes.Add(lst_synonyms.ChangeItem(_new, old)); } UndoStack.Push(new UndoRedoActionPair(undoes.ToArray(), redoes.ToArray(), "Update synonym(s)", new OwnerControlData(this, this.Parent, Language))); UpdateUndoRedoTooltips(); txt_wordAdd.Text = ""; changedTextBox = false; }
/// <summary> /// Adds the action to the UndoStack and calls the Do function. /// </summary> /// <param name="action"></param> public void Do(IAction action) { action.DoAction(); UndoStack.Push(action); RedoStack.Clear(); }
/// <summary> /// 新たな操作を記録します。 /// </summary> /// <param name="op">記録する操作</param> public void Push(IOperation op) { UndoStack.Push(op); RedoStack.Clear(); OperationHistoryChanged?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Merges the UndoStack with given UndoRedoStack's UndoStack. /// </summary> /// <param name="urs">Foreign UndoRedoStack to add to top of UndoStack</param> public void MergeURStack(UndoRedoStack urs) { UndoStack.AppendToTop(urs.UndoStack); }
private void DesignerWindow_Load(object sender, EventArgs e) { redoStack = new RedoStack(); undoStack = new UndoStack(); copyCollection = new List<BaseGump>(); designerFrame.BeforeBaseGumpChanged += new EventHandler<EventArgs>(designerFrame_BeforeBaseGumpChanged); designerFrame.BeforeBaseGumpMoved += new EventHandler<EventArgs>(designerFrame_BeforeBaseGumpMoved); }
public void ClearStack() { UndoStack.Clear(); RedoStack.Clear(); InitialStack.Clear(); }
protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved) { if (visualAdded != null) { Action <object> delact = (o) => DeleteElementAction(visualAdded); Action <object> addact = (o) => AddElementAction(visualAdded); if (_isUndoHandle) { RedoStack.Push(new UndoRedoManager() { ActionComment = $"A_{Children.Count}", UndoAction = addact, RedoAction = delact, }); _isUndoHandle = false; } else { UndoStack.Push(new UndoRedoManager() { ActionComment = $"A_{Children.Count}", UndoAction = delact, RedoAction = addact, }); } } else if (visualRemoved != null) { Action <object> actadd = (o) => AddElementAction(visualRemoved); Action <object> actdel = (o) => DeleteElementAction(visualAdded); if (_isUndoHandle) { RedoStack.Push(new UndoRedoManager() { ActionComment = $"R_{Children.Count}", UndoAction = actdel, RedoAction = actadd, }); _isUndoHandle = false; } else { UndoStack.Push(new UndoRedoManager() { ActionComment = $"R_{Children.Count}", UndoAction = actadd, RedoAction = actdel, }); } } base.OnVisualChildrenChanged(visualAdded, visualRemoved); //if (!_isUndoHandle) RedoStack.Clear(); //update the layout object mode by is sync if (IsSyncLayoutDataContext) { RefreshLayoutInCanvas(); } }
internal void AddToUndoStack(MoveDetailStruct moveDetailStruct) { string code = moveDetailStruct.ButtonClickedTag.ToString() + "," + moveDetailStruct.EmptyCellTag.ToString() + "," + moveDetailStruct.ButtonClickedContent; UndoStack.Push(code); }
protected override void OnDrop(DragEventArgs e) { UIElement element = e.Data.GetData(typeof(UIElement)) as UIElement; _isUndoHandle = false; if (element == null) { return; } if (this.Children?.Contains(element) ?? false) { double left = GetLeft(element); double top = GetTop(element); double afterleft = e.GetPosition(this).X - (element as ConnectionDiagramBase)?.CenterPosition.X ?? 0; double aftertop = e.GetPosition(this).Y - (element as ConnectionDiagramBase)?.CenterPosition.Y ?? 0; var point = e.GetPosition(this); //it is move effect Action <object> undoact = (ele) => { var oldleft = Canvas.GetLeft(element); var oldtop = Canvas.GetTop(element); SetLeft(element, left); SetTop(element, top); if (element is ConnectionDiagramBase) { Behavior.DiagramElementDropBehavior.SetConnectionLinePosition(element as ConnectionDiagramBase, new Point(left - oldleft, top - oldtop)); } RedoStack.Push(ele as UndoRedoManager); }; Action <object> redoact = (ele) => { var oldleft = Canvas.GetLeft(element); var oldtop = Canvas.GetTop(element); SetLeft(element, afterleft); SetTop(element, aftertop); if (element is ConnectionDiagramBase) { Behavior.DiagramElementDropBehavior.SetConnectionLinePosition(element as ConnectionDiagramBase, new Point(afterleft - oldleft, aftertop - oldtop)); } UndoStack.Push(ele as UndoRedoManager); }; UndoStack.Push(new UndoRedoManager() { ActionComment = $"M_{this.Children.IndexOf(element)}", UndoAction = undoact, RedoAction = redoact, }); if (IsSyncLayoutDataContext) { RefreshLayoutInCanvas(); } } else { } base.OnDrop(e); RedoStack.Clear(); }
public void ClearUndoState() { lock (_undoLock) m_undo = new UndoStack<UndoState>(5); lock (_redoLock) m_redo = new UndoStack<UndoState>(5); StoreUndoState(); }
public void InitializedValue() { var s = new UndoStack<int>(); var a = new Restorable<int>(s, 0); Assert.AreEqual(0, a); }
/// <summary> /// 現在の<see cref="OperationManager"/>の状態に対して、保存処理が行われたことを通知します。 /// </summary> public void CommitChanges() { LastCommittedOperation = UndoStack.Count > 0 ? UndoStack.Peek() : null; ChangesCommited?.Invoke(this, EventArgs.Empty); }
private void ReloadLayoutInCanvas(IMapLayout map) { Children.Clear(); UndoStack.Clear(); RedoStack.Clear(); var diagrams = map.Diagrams; if (diagrams == null || !diagrams.Any()) { return; } Dictionary <string, ILineLayout[]> uuidLines = new Dictionary <string, ILineLayout[]>(); foreach (var diagram in diagrams) { var clnele = Activator.CreateInstance(diagram.DiagramUIType) as UIElement; if (clnele is ContentControl) { (clnele as ContentControl).DataContext = diagram.DataContext; } //add the line by Diagram ActionComment after finish all diagrams uuidLines.Add(diagram.DiagramUUID, diagram.DepartureLines); Application.Current.Dispatcher.Invoke(() => { Canvas.SetRight(clnele, diagram.X); Canvas.SetLeft(clnele, diagram.X); Canvas.SetBottom(clnele, diagram.Y); Canvas.SetTop(clnele, diagram.Y); Children.Add(clnele); }); } //update the canvas. UpdateLayout(); foreach (var dialines in uuidLines) { ConnectionDiagramBase origindiagram = GetDiagramByUUID(dialines.Key); if (origindiagram != null && dialines.Value != null) { foreach (var defline in dialines.Value) { var terminaldiagram = GetDiagramByUUID(defline.TerminalDiagramUUID); dynamic conline; if (terminaldiagram != null) { conline = Activator.CreateInstance(defline.LineUIType); Assist.FrameworkElementAssist.SetOriginDiagram(conline, origindiagram); Assist.FrameworkElementAssist.SetTerminalDiagram(conline, terminaldiagram); if (conline is ConnectionLineBase) { //(conline as ConnectionLineBase).OriginDiagram = origindiagram; //(conline as ConnectionLineBase).TerminalDiagram = terminaldiagram; (conline as ConnectionLineBase).DataContext = defline.DataContext; (conline as ConnectionLineBase).LineUUID = string.IsNullOrWhiteSpace(defline.LineUUID) ? $"{conline.GetType().Name}_{Guid.NewGuid().ToString()}" : defline.LineUUID; //TODOTODOTODO!!!! //TODO: Posistion Recaluter if (conline is ILinePosition) { (conline as ILinePosition).X1 = (double)origindiagram.GetValue(Canvas.LeftProperty) - (double)terminaldiagram.GetValue(Canvas.LeftProperty) + origindiagram.CenterPosition.X; (conline as ILinePosition).Y1 = (double)origindiagram.GetValue(Canvas.TopProperty) - (double)terminaldiagram.GetValue(Canvas.TopProperty) + origindiagram.CenterPosition.Y;; (conline as ILinePosition).X2 = terminaldiagram.CenterPosition.X; (conline as ILinePosition).Y2 = terminaldiagram.CenterPosition.Y; } origindiagram.DepartureLines.Add(conline); terminaldiagram.ArrivalLines.Add(conline); } Application.Current.Dispatcher.Invoke(() => { Canvas.SetTop(conline, (double)terminaldiagram.GetValue(Canvas.TopProperty)); Canvas.SetLeft(conline, (double)terminaldiagram.GetValue(Canvas.LeftProperty)); Children.Add(conline); }); } } } } }
public void ClearUndoState() { lock (m_undo) { m_undo = new UndoStack<UndoState>(5); } lock (m_redo) { m_redo = new UndoStack<UndoState>(5); } StoreUndoState(); }
private void RefreshLayoutInCanvas() { if (LayoutDataContext == null || this.Children == null || (Children.Count == 0)) { return; } // _innerMapLayout = LayoutDataContext; //var diagrams = (_innerMapLayout ?? (_innerMapLayout = LayoutDataContext)).Diagrams; var diagrams = LayoutDataContext.Diagrams; int diagramsum = this.Children.Cast <UIElement>().Sum(child => { if (child is ConnectionDiagramBase) { return(1); } else { return(0); } }); if (diagrams == null || diagrams.Count() > diagramsum) { diagrams = (from child in this.Children.Cast <UIElement>() where child is ConnectionDiagramBase select Activator.CreateInstance(LayoutDataContext.DiagramLayoutType)).Cast <IDiagramLayout>().ToArray(); } else if (diagrams.Count() < diagramsum) { Array.Resize(ref diagrams, diagramsum); } var idx = 0; //set the diagramUI position and properties foreach (var child in this.Children) { if (!(child is ConnectionDiagramBase)) { continue; } var diagramUI = child as ConnectionDiagramBase; if (diagrams[idx] == null) { diagrams[idx] = Activator.CreateInstance(LayoutDataContext.DiagramLayoutType) as IDiagramLayout; } diagrams[idx].X = Canvas.GetLeft(diagramUI); diagrams[idx].Y = Canvas.GetTop(diagramUI); diagrams[idx].DiagramUUID = diagramUI.DiagramUUID; diagrams[idx].DiagramUIType = diagramUI.GetType(); diagrams[idx].DataContext = diagramUI.DataContext; //set the Line properties if (diagramUI.DepartureLines != null && diagramUI.DepartureLines.Any()) { diagrams[idx].DepartureLines = (from line in diagramUI.DepartureLines select Activator.CreateInstance(diagrams[idx].LineLayouType)).Cast <ILineLayout>().ToArray <ILineLayout>(); int lidx = 0; foreach (var lineui in diagramUI.DepartureLines) { diagrams[idx].DepartureLines[lidx].LineUUID = lineui.LineUUID; diagrams[idx].DepartureLines[lidx].LineUIType = lineui.GetType(); diagrams[idx].DepartureLines[lidx].TerminalDiagramUUID = lineui.TerminalDiagram?.DiagramUUID; diagrams[idx].DepartureLines[lidx].DataContext = lineui.DataContext; lidx++; } } idx++; } LayoutDataContext.Diagrams = diagrams; LayoutDataContext.Height = Height; LayoutDataContext.Width = Width; var map = RefreshMapLayout(LayoutDataContext); SetValue(LayoutDataContextProperty, map); UndoStack.Clear(); RedoStack.Clear(); }