private void barButton_Change_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //Change workspace if (folderBrowserDialog.ShowDialog() == DialogResult.OK) { try { SPersistenceManager.getInstance().SetWorkSpace(folderBrowserDialog.SelectedPath); DockPanel[] p = new DockPanel[dockManager.Count]; int i = 0; foreach (DockPanel dp in dockManager.Panels) { p[i++] = dp; } foreach (DockPanel dp in p) { dp.Close(); } documentManager.View.Controller.CloseAll(); workspaceManager.RemoveWorkspace("DefaultWorkspace"); loadWorkSpace(); } catch (IOException ex) { MessageBox.Show("This is not workspace's folder!"); SLogManager.getInstance().Info(ex.ToString()); } catch (Exception ex) { SLogManager.getInstance().Error(ex.ToString()); } } }
private void loadWorkSpace() { if (DesignMode) { return; } Stream reader = null; try { reader = SPersistenceManager.getInstance().GetReader("DefaultWorkspace"); workspaceManager.LoadWorkspace("DefaultWorkspace", reader); workspaceManager.CloseStreamOnWorkspaceLoading = DevExpress.Utils.DefaultBoolean.True; workspaceManager.TransitionType = new DevExpress.Utils.Animation.ShapeTransition(); workspaceManager.TransitionType.Parameters.FrameCount = 1000; workspaceManager.ApplyWorkspace("DefaultWorkspace"); } catch (Exception ex) { SLogManager.getInstance().Error(ex.ToString()); } finally { if (reader != null) { reader.Close(); } } }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { this.Enabled = false; DevExpress.XtraSplashScreen.SplashScreenManager.ShowDefaultWaitForm("Attendere prego", "Chiusura ..."); // unload plugins _loader.Unload(); // kill loggers SLogManager.getInstance().Dispose(); // state machines clear statemachine.StateMachinesDisposer.getInstance().Dispose(); DevExpress.XtraSplashScreen.SplashScreenManager.CloseDefaultWaitForm(); // kill rest if (components != null) { components.Dispose(); } } base.Dispose(disposing); }
public void SaveLayout(LayoutDescriptor descr) { using (Stream wr = descr.GetWriter()) { if (wr != null) { SLogManager.getInstance().getClassLogger(GetType()).Debug($"Grid Save Layout: {descr.CombinePath()}"); _view.SaveLayoutToStream(wr); } } }
public static string _L <T>(this T input, string key, string def = null) where T : PluginBase { try { return(input.RsMan.GetString(key, input.RsManCulture) ?? def); }catch (Exception e) { SLogManager.getInstance().getClassLogger(typeof(T)).Warn(string.Format(e.Message)); #if DEBUG_TRACE_LOG_ON SLogManager.getInstance().getClassLogger(typeof(T)).Debug(string.Format(e.StackTrace)); #endif return(def ?? key); } }
public void LoadLayout(LayoutDescriptor descr) { using (Stream rr = descr.GetReader()) { if (rr != null) { SLogManager.getInstance().getClassLogger(GetType()).Debug($"Grid Load layout: {descr.CombinePath()}"); _view.RestoreLayoutFromStream(rr); } else { SLogManager.getInstance().getClassLogger(GetType()).Warn($"Grid layout: {descr.CombinePath()} NOT FOUND!"); } } }
private void HandleDocumentChanged(object sender, DocumentChangedEvent e) { SLogManager.getInstance().Info("HandleDocumentChanged received in DocumentManagerSupport"); _controlsForSave.Add(e.RequestData.VisualControl); foreach (DevExpress.XtraBars.BarItem item in _saveAllComponents) { item.Enabled = true; } if (e.RequestData.VisualControl == _activeControl) { foreach (DevExpress.XtraBars.BarItem item in _saveComponents) { item.Enabled = true; } } }
/// <summary> /// Clone serializable object, /// it will clone object by serializing it in ram, /// and de-serializing it back. /// </summary> /// <typeparam name="T">Object Type</typeparam> /// <param name="what">Object to be cloned</param> /// <returns>T typed clone of object</returns> public static T CloneSerializableObject<T>(this T what) { try { NetDataContractSerializer serial = new NetDataContractSerializer(); MemoryStream strm = new MemoryStream(); serial.WriteObject(strm, what); strm.Seek(0, SeekOrigin.Begin); return (T)serial.ReadObject(strm); } catch (Exception e) { SLogManager.getInstance().getClassLogger(typeof(T)).Error(e.Message); } return default(T); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { // kill loggers SLogManager.getInstance().Dispose(); if (_foc != null) { _foc.Dispose(); } if (components != null) { components.Dispose(); } } base.Dispose(disposing); }
private void barButton_Createnew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //Create new workspace if (folderBrowserDialog.ShowDialog() == DialogResult.OK) { try { documentManager.View.Controller.CloseAll(); workspaceManager.RemoveWorkspace("DefaultWorkspace"); SPersistenceManager.getInstance().CreateWorkSpace(folderBrowserDialog.SelectedPath); } catch (Exception ex) { SLogManager.getInstance().Error(ex.ToString()); } } }
private void saveWorkspace() { //https://www.devexpress.com/Support/Center/Example/Details/T190543 if (DesignMode) { return; } try { using (Stream writer = SPersistenceManager.getInstance().GetWriter("DefaultWorkspace")){ workspaceManager.CaptureWorkspace("DefaultWorkspace"); workspaceManager.CloseStreamOnWorkspaceSaving = DevExpress.Utils.DefaultBoolean.True; workspaceManager.SaveWorkspace(workspaceManager.Workspaces[0].Name, writer, true); } } catch (Exception ex) { SLogManager.getInstance().Error(ex.ToString()); } }
private void HandleVisualControlAction(object sender, VisualControlActionEvent e) { SLogManager.getInstance().Info("HandleVisualControlAction received in DocumentManagerSupport"); switch (e.RequestData.ActionKind) { case VisualControlActionKind.Activated: _activeControl = null; foreach (DevExpress.XtraBars.BarItem item in _saveComponents) { item.Enabled = false; } core.controls.IVisualControl vc = e.RequestData.VisualControl; core.controls.VisualControlInfo vci = vc.VisualControlInfo; if (vci != null) { if (_controlsForSave.Find(x => x.VisualControlInfo == vci) != null) { foreach (DevExpress.XtraBars.BarItem item in _saveComponents) { item.Enabled = true; } } _activeControl = vc; } break; case VisualControlActionKind.Disposed: default: _activeControl = null; foreach (DevExpress.XtraBars.BarItem item in _saveComponents) { item.Enabled = false; } break; } }
protected override void GetFieldDisplayText(object sender, xwcs.core.db.binding.CustomColumnDisplayTextEventArgs e) { try { FilterObjectbase fo = this[e.ListSourceRowIndex] as FilterObjectbase; if (fo != null) { ICriteriaTreeNode cn = fo.GetFilterFieldByPath(e.Column.FieldName); if (cn.HasCriteria()) { string cond = cn.GetCondition().LegacyToString(); e.DisplayText = cond; } } } #if DEBUG_TRACE_LOG_ON catch (Exception ex) { SLogManager.getInstance().getClassLogger(GetType()).Debug(ex.ToString()); #else catch (Exception) { #endif } //just silently skip problems }
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()); } }
public void LoadLayout(LayoutDescriptor descr) { SLogManager.getInstance().getClassLogger(GetType()).Debug("Grid Load layout"); }