public void saveSelectedControl() { if (_activeControl != null) { BaseDocumentCollection col = _manager.View.Documents; foreach (BaseDocument document in col) { VisualControl vc = (VisualControl)document.Control; if (vc.VisualControlInfo == _activeControl.VisualControlInfo) { vc.SaveChanges(); _controlsForSave.Remove(_activeControl); foreach (DevExpress.XtraBars.BarItem item in _saveComponents) { item.Enabled = false; } if (_controlsForSave.Count == 0) { foreach (DevExpress.XtraBars.BarItem item in _saveAllComponents) { item.Enabled = false; } } } } } }
public void SaveChangedControls() { BaseDocumentCollection col = _manager.View.Documents; foreach (BaseDocument document in col) { VisualControl vc = (VisualControl)document.Control; if (vc != null) { if (_controlsForSave.Find(x => x.VisualControlInfo == vc.VisualControlInfo) != null) { vc.SaveChanges(); } } } _controlsForSave.Clear(); foreach (DevExpress.XtraBars.BarItem item in _saveComponents) { item.Enabled = false; } foreach (DevExpress.XtraBars.BarItem item in _saveAllComponents) { item.Enabled = false; } }
public BaseDocument getDocumentByControl(VisualControl visualControl) { foreach (DevExpress.XtraBars.Docking2010.Views.BaseDocument document in _manager.View.Documents) { VisualControl vc = (VisualControl)document.Control; if (vc == visualControl) { return(document); } } return(null); }
public BaseDocument getDocumentByVCI(xwcs.core.controls.VisualControlInfo visualControlInfo) { foreach (DevExpress.XtraBars.Docking2010.Views.BaseDocument document in _manager.View.Documents) { VisualControl vc = (VisualControl)document.Control; if ((vc != null) && (vc.VisualControlInfo.GUID == visualControlInfo.GUID)) { return(document); } } return(null); }
protected override void AfterLoadState() { //state can be not loaded!!!! if (_State == null) { _State = new DocumentManagerState(); } else { BaseDocument first = null; _manager.BeginUpdate(); //state is casted _State foreach (VisualControlInfo vci in state.Documents) { //do restore so it will mantain vci VisualControl pluginControl = (VisualControl)vci.restoreInstance(); if (ReferenceEquals(null, pluginControl)) { continue; } BaseDocument document = _manager.View.AddDocument(pluginControl); document.Caption = vci.Name; document.ControlName = vci.Name; document.Properties.AllowFloat = DevExpress.Utils.DefaultBoolean.False; // restore control state (pluginControl as IPersistentState)?.LoadState(); (pluginControl as IVisualControl)?.Start(VisualControlStartingKind.StartingPersisted); if (first == null) { first = document; } } _manager.EndUpdate(); _manager.View.Controller.Activate(first); //release VCI from state state.Documents = null; } }
protected override void BeforeSaveState() { BaseDocumentCollection col = _manager.View.Documents; try { state.Documents = new VisualControlInfo[col.Count]; int i = 0; foreach (BaseDocument document in col) { VisualControl vc = (VisualControl)document.Control; if (vc != null) { // save control state (vc as IPersistentState)?.SaveState(); state.Documents[i++] = vc.VisualControlInfo; } } } catch (Exception ex) { SLogManager.getInstance().Error(ex.ToString()); } }