Esempio n. 1
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                TableScript s = null != o ? (TableScript)o : new TableScript();

                s.ScriptText = info.GetString("Text");
                return(s);
            }
Esempio n. 2
0
            /// <summary>
            /// Deserialized the column script.
            /// </summary>
            /// <param name="obj">The uninitialized column script instance.</param>
            /// <param name="info">Serialization info.</param>
            /// <param name="context">Streaming context.</param>
            /// <param name="selector">Surrogate selector.</param>
            /// <returns></returns>
            public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
            {
                TableScript s = (TableScript)obj;

                s.ScriptText = info.GetString("Text");
                return(s);
            }
    public SDTableScriptController(Altaxo.Data.DataTable dataTable, TableScript tableScript)
    {
      this.m_DataTable = dataTable;

      if(null!=tableScript)
      {
        this.m_TableScript = (IScriptText)tableScript.Clone();
      }
      else
      {
        this.m_TableScript = new TableScript();
      }

      SetElements(true);

    }
    public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl)
    {
      m_Table = ctrl.DataTable;
      
      IScriptText script = m_Table.TableScript;

      if(script==null)
        script = new TableScript();

      object[] args = new object[]{script,new Altaxo.Gui.Scripting.ScriptExecutionHandler(this.EhScriptExecution)};
      if(Current.Gui.ShowDialog(args, "WorksheetScript of " + m_Table.Name))
      {
        m_Table.TableScript = (TableScript)args[0];
      }

      this.m_Table = null;
      
    }
Esempio n. 5
0
 /// <summary>
 /// Creates a column script as a copy from another script.
 /// </summary>
 /// <param name="b">The script to copy from.</param>
 /// <param name="forModification">If true, the new script text can be modified.</param>
 public TableScript(TableScript b, bool forModification)
     : base(b, forModification)
 {
 }
Esempio n. 6
0
 /// <summary>
 /// Creates a column script as a copy from another script.
 /// </summary>
 /// <param name="b">The script to copy from.</param>
 public TableScript(TableScript b)
     : this(b, false)
 {
 }
Esempio n. 7
0
 /// <summary>
 /// Creates a column script as a copy from another script.
 /// </summary>
 /// <param name="b">The script to copy from.</param>
 /// <param name="forModification">If true, the new script text can be modified.</param>
 public TableScript(TableScript b, bool forModification)
   : base(b, forModification)
 {
 }
Esempio n. 8
0
 /// <summary>
 /// Creates a column script as a copy from another script.
 /// </summary>
 /// <param name="b">The script to copy from.</param>
 public TableScript(TableScript b)
   : this(b,false)
 {
 }
Esempio n. 9
0
    /// <summary>
    /// Copy constructor.
    /// </summary>
    /// <param name="from">The data table to copy the structure from.</param>
    public DataTable(DataTable from)
      : this((DataColumnCollection)from._dataColumns.Clone(),(DataColumnCollection)from._propertyColumns.Clone())
    {
      
      this._parent = null; // do not clone the parent
      this._tableName = from._tableName;
      this._tableScript = null==from._tableScript ? null : (TableScript)from._tableScript.Clone();
      this._creationTime = this._lastChangeTime = DateTime.UtcNow;
      this._notes = from._notes;

      // Clone also the table properties (deep copy)
      if(from._tableProperties!=null)
      {
        foreach(string key in from._tableProperties.Keys)
        {
          ICloneable val = from._tableProperties[key] as ICloneable;
          if(null!=val)
            this.SetTableProperty(key,val.Clone());
        }
      }
    }
Esempio n. 10
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                TableScript s = (TableScript)obj;

                info.AddValue("Text", s.ScriptText);
            }
Esempio n. 11
0
            /// <summary>
            /// Serializes the table script
            /// </summary>
            /// <param name="obj">The table script to serialize.</param>
            /// <param name="info">Serialization info.</param>
            /// <param name="context">Streaming context.</param>
            public void GetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
            {
                TableScript s = (TableScript)obj;

                info.AddValue("Text", s.ScriptText);
            }
Esempio n. 12
0
		/// <summary>
		/// Copy constructor.
		/// </summary>
		/// <param name="from">The data table to copy the structure from.</param>
		public DataTable(DataTable from)
			: this((DataColumnCollection)from._dataColumns.Clone(), (DataColumnCollection)from._propertyColumns.Clone())
		{
			this._parent = null; // do not clone the parent
			this._name = from._name;
			this._tableScript = null == from._tableScript ? null : (TableScript)from._tableScript.Clone();
			this._creationTime = this._lastChangeTime = DateTime.UtcNow;
			ChildCopyToMember(ref _notes, from._notes);

			// Clone also the table properties (deep copy)
			if (from._tableProperties != null && from._tableProperties.Count > 0)
			{
				PropertyBagNotNull.CopyFrom(from._tableProperties);
			}
			else
			{
				this._tableProperties = null;
			}

			ChildCopyToMember(ref _tableDataSource, from._tableDataSource);
		}
Esempio n. 13
0
		protected override IEnumerable<Main.DocumentNodeAndName> GetDocumentNodeChildrenWithName()
		{
			if (null != _dataColumns)
				yield return new Main.DocumentNodeAndName(_dataColumns, () => _dataColumns = null, "DataCols");

			if (null != _propertyColumns)
				yield return new Main.DocumentNodeAndName(_propertyColumns, () => _propertyColumns = null, "PropCols");

			if (null != DataSource)
				yield return new Main.DocumentNodeAndName(_tableDataSource, () => _tableDataSource = null, "DataSource");

			if (null != PropertyBag)
				yield return new Main.DocumentNodeAndName(_tableProperties, () => _tableProperties = null, "PropertyBag");

			if (null != _tableScript)
				yield return new Main.DocumentNodeAndName(_tableScript, () => _tableScript = null, "TableScript");

			if (null != _notes)
				yield return new Main.DocumentNodeAndName(_notes, () => _notes = null, "Notes");

			if (null != _dataColumns && null != _dataColumns.ColumnScripts)
				yield return new Main.DocumentNodeAndName(_dataColumns.ColumnScripts, "DataColumnScripts");

			if (null != _propertyColumns && null != _propertyColumns.ColumnScripts)
				yield return new Main.DocumentNodeAndName(_propertyColumns.ColumnScripts, "PropertyColumnScripts");
		}