Implement canceling edits in FZE, fix crashes related to canceling. (#1610)

* Implemented proper canceling for CanvasEditor

* Implemented proper canceling for GridEditor

* Possible fix for a crash in my implementation of canceling

* Fixed a crash in FZE/Grid editor
This commit is contained in:
Ivan Stošić
2020-03-18 14:13:25 +01:00
committed by GitHub
parent ff0c021162
commit 1c90107571
6 changed files with 52 additions and 4 deletions

View File

@@ -113,6 +113,15 @@ namespace FancyZonesEditor.Models
return layout;
}
public void RestoreTo(CanvasLayoutModel other)
{
other.Zones.Clear();
foreach (Int32Rect zone in Zones)
{
other.Zones.Add(zone);
}
}
// PersistData
// Implements the LayoutModel.PersistData abstract method
protected override void PersistData()

View File

@@ -131,6 +131,12 @@ namespace FancyZonesEditor.Models
public override LayoutModel Clone()
{
GridLayoutModel layout = new GridLayoutModel(Name);
RestoreTo(layout);
return layout;
}
public void RestoreTo(GridLayoutModel layout)
{
int rows = Rows;
int cols = Columns;
@@ -163,8 +169,6 @@ namespace FancyZonesEditor.Models
}
layout.ColumnPercents = colPercents;
return layout;
}
// PersistData