/// <summary> /// Executes the script. If no instance of the script object exists, a error message will be stored and the return value is false. /// If the script object exists, the data change notifications will be switched of (for all tables). /// Then the Execute function of this script object is called. Afterwards, the data changed notifications are switched on again. /// </summary> /// <param name="myColumn">The property column this script is working on.</param> /// <param name="reporter">Progress reporter that can be used by the script to report the progress of its work.</param> /// <returns>True if executed without exceptions, otherwise false.</returns> /// <remarks>If exceptions were thrown during execution, the exception messages are stored /// inside the column script and can be recalled by the Errors property.</remarks> public bool ExecuteWithSuspendedNotifications(Altaxo.Data.DataColumn myColumn, IProgressReporter reporter) { bool bSucceeded = true; Altaxo.Data.DataTableCollection myDataSet = null; // first, test some preconditions if (null == _scriptObject) { _errors = ImmutableArray.Create(new CompilerDiagnostic(null, null, DiagnosticSeverity.Error, "Script Object is null")); return(false); } var myColumnCollection = Altaxo.Data.DataColumnCollection.GetParentDataColumnCollectionOf(myColumn); var myTable = Altaxo.Data.DataTable.GetParentDataTableOf(myColumnCollection); myDataSet = Altaxo.Data.DataTableCollection.GetParentDataTableCollectionOf(myTable); IDisposable suspendToken = null; if (null != myDataSet) { suspendToken = myDataSet.SuspendGetToken(); } else if (null != myTable) { suspendToken = myTable.SuspendGetToken(); } else if (null != myColumnCollection) { suspendToken = myColumnCollection.SuspendGetToken(); } else if (null != myColumn) { suspendToken = myColumn.SuspendGetToken(); } try { ((Altaxo.Calc.ColScriptExeBase)_scriptObject).Execute(myColumn, reporter); } catch (Exception ex) { bSucceeded = false; _errors = ImmutableArray.Create(new CompilerDiagnostic(null, null, DiagnosticSeverity.Error, ex.ToString())); } finally { if (null != suspendToken) { suspendToken.Dispose(); } } return(bSucceeded); }
public AltaxoDocument() { m_DataSet = new Altaxo.Data.DataTableCollection(this); m_GraphSet = new GraphDocumentCollection(this); m_TableLayoutList = new Altaxo.Worksheet.WorksheetLayoutCollection(this); _FitFunctionScripts = new Altaxo.Scripting.FitFunctionScriptCollection(); // m_Worksheets = new System.Collections.ArrayList(); // m_GraphForms = new System.Collections.ArrayList(); }
public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector) { Altaxo.Data.DataTableCollection s = (Altaxo.Data.DataTableCollection)obj; // s._parent = (AltaxoDocument)(info.GetValue("Parent",typeof(AltaxoDocument))); s.m_TablesByName = (System.Collections.SortedList)(info.GetValue("Tables", typeof(System.Collections.SortedList))); // setup helper objects s.m_SuspendedChildCollection = new System.Collections.ArrayList(); return(s); }
public AltaxoDocument() { _dataTables = new Altaxo.Data.DataTableCollection(this); var commonDictionaryForGraphs = new SortedDictionary <string, IProjectItem>(); _graphs = new Graph.Gdi.GraphDocumentCollection(this, commonDictionaryForGraphs); _graphs3D = new Graph.Graph3D.GraphDocumentCollection(this, commonDictionaryForGraphs); _textDocuments = new Text.TextDocumentCollection(this); _projectFolderProperties = new Main.Properties.ProjectFolderPropertyDocumentCollection(this); _tableLayouts = new Altaxo.Worksheet.WorksheetLayoutCollection(this); _fitFunctionScripts = new Altaxo.Scripting.FitFunctionScriptCollection(this); _projectFolders = new ProjectFolders(this); }
/// <summary> /// Executes the script. If no instance of the script object exists, a error message will be stored and the return value is false. /// If the script object exists, the data change notifications will be switched of (for all tables). /// Then the Execute function of this script object is called. Afterwards, the data changed notifications are switched on again. /// </summary> /// <param name="myTable">The data table this script is working on.</param> /// <returns>True if executed without exceptions, otherwise false.</returns> /// <remarks>If exceptions were thrown during execution, the exception messages are stored /// inside the column script and can be recalled by the Errors property.</remarks> public bool ExecuteWithSuspendedNotifications(Altaxo.Data.DataTable myTable) { bool bSucceeded = true; Altaxo.Data.DataTableCollection myDataSet = null; // first, test some preconditions if (null == m_ScriptObject) { m_Errors = new string[1] { "Script Object is null" }; return(false); } myDataSet = Altaxo.Data.DataTableCollection.GetParentDataTableCollectionOf(myTable); if (null != myDataSet) { myDataSet.Suspend(); } else if (null != myTable) { myTable.Suspend(); } try { ((Altaxo.Calc.TableScriptExeBase)m_ScriptObject).Execute(myTable); } catch (Exception ex) { bSucceeded = false; m_Errors = new string[1]; m_Errors[0] = ex.ToString(); } finally { if (null != myDataSet) { myDataSet.Resume(); } else if (null != myTable) { myTable.Resume(); } } return(bSucceeded); }
protected override IEnumerable <Main.DocumentNodeAndName> GetDocumentNodeChildrenWithName() { if (null != _dataTables) { yield return(new Main.DocumentNodeAndName(_dataTables, () => _dataTables = null, "Tables")); } if (null != _graphs) { yield return(new Main.DocumentNodeAndName(_graphs, () => _graphs = null, "Graphs")); } if (null != _graphs3D) { yield return(new Main.DocumentNodeAndName(_graphs3D, () => _graphs3D = null, "Graphs3D")); } if (null != _textDocuments) { yield return(new Main.DocumentNodeAndName(_textDocuments, () => _textDocuments = null, "Text")); } if (null != _tableLayouts) { yield return(new Main.DocumentNodeAndName(_tableLayouts, () => _tableLayouts = null, "TableLayouts")); } if (null != _fitFunctionScripts) { yield return(new Main.DocumentNodeAndName(_fitFunctionScripts, () => _fitFunctionScripts = null, "FitFunctionScripts")); } if (null != _projectFolderProperties) { yield return(new Main.DocumentNodeAndName(_projectFolderProperties, () => _projectFolderProperties = null, "FolderProperties")); } if (null != _projectFolders) { yield return(new Main.DocumentNodeAndName(_projectFolders, () => _projectFolders = null, "ProjectFolders")); } }
public void GetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { Altaxo.Data.DataTableCollection s = (Altaxo.Data.DataTableCollection)obj; // info.AddValue("Parent",s._parent); info.AddValue("Tables", s.m_TablesByName); }
/// <summary> /// Constructs an empty table with the parent and the name provided by the argument. /// </summary> /// <param name="parent">The initial parent of the table.</param> /// <param name="name">The initial name of the table.</param> public DataTable(Altaxo.Data.DataTableCollection parent, string name) : this(name) { this._parent = parent; }
/// <summary> /// Constructs an empty table with the parent provided by the argument. /// </summary> /// <param name="parent">The initial parent of the table.</param> public DataTable(Altaxo.Data.DataTableCollection parent) : this() { this._parent = parent; }