public void SaveLayout() { //save layout SavedLayout.Clear(); foreach (Control c in _pnlCameras.Controls) { var r = new Rectangle(c.Location.X, c.Location.Y, c.Width, c.Height); var window = c as CameraWindow; if (window != null) { SavedLayout.Add(new LayoutItem { LayoutRectangle = r, ObjectId = window.Camobject.id, ObjectTypeId = 2 }); continue; } var control = c as FloorPlanControl; if (control != null) { SavedLayout.Add(new LayoutItem { LayoutRectangle = r, ObjectId = control.Fpobject.id, ObjectTypeId = 3 }); continue; } var level = c as VolumeLevel; if (level != null) { SavedLayout.Add(new LayoutItem { LayoutRectangle = r, ObjectId = level.Micobject.id, ObjectTypeId = 1 }); } } resetLayoutToolStripMenuItem1.Enabled = mnuResetLayout.Enabled = true; }
public void SaveLayout() { //save layout SavedLayout.Clear(); foreach (Control c in _pnlCameras.Controls) { var r = new Rectangle(c.Location.X, c.Location.Y, c.Width, c.Height); if (c is CameraWindow) { SavedLayout.Add(new LayoutItem { LayoutRectangle = r, ObjectId = ((CameraWindow)c).Camobject.id, ObjectTypeId = 2 }); } if (c is FloorPlanControl) { SavedLayout.Add(new LayoutItem { LayoutRectangle = r, ObjectId = ((FloorPlanControl)c).Fpobject.id, ObjectTypeId = 3 }); } if (c is VolumeLevel) { SavedLayout.Add(new LayoutItem { LayoutRectangle = r, ObjectId = ((VolumeLevel)c).Micobject.id, ObjectTypeId = 1 }); } } resetLayoutToolStripMenuItem1.Enabled = mnuResetLayout.Enabled = true; }