internal void CargarOGuardarDisenios(LayoutControl control, bool guardar, string usuario, string nombreVista) { string direccion; if (guardar) { direccion = $@"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\{control.Name}{nombreVista}{usuario}.xml"; control.SaveLayoutToXml(direccion); } else { direccion = $@"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\{control.Name}{nombreVista}{usuario}.xml"; if (File.Exists(direccion)) { control.RestoreLayoutFromXml(direccion); } } }
public static void SaveLayoutExToXml(this LayoutControl layoutControl, string filePath) { try { ObjectInfoCollection objects = new ObjectInfoCollection(); foreach (Control ctrl in layoutControl.Controls) { if (layoutControl.GetItemByControl(ctrl) != null) { objects.Collection.Add(new ObjectInfo(ctrl)); } } string filePathForControls = filePath.Replace(".xml", "Controls.xml"); layoutControl.SaveLayoutToXml(filePath); serializer.SerializeObject(objects, filePathForControls, appName); } catch (Exception exc) { XtraMessageBox.Show(exc.Message); } }