public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
      {
        FitFunctionToScalarFunctionDDWrapper s = (FitFunctionToScalarFunctionDDWrapper)obj;
       
        info.AddValue("IndependentVariable",s._independentVariable);
        info.AddValue("DependentVariable",s._dependentVariable);
        info.AddArray("ParameterValues",s._parameter,s._parameter.Length);

        if(s._fitFunction==null || info.IsSerializable(s._fitFunction))
          info.AddValue("FitFunction",s._fitFunction);
        else
          info.AddValue("FitFunction",new Altaxo.Serialization.Xml.AssemblyAndTypeSurrogate(s._fitFunction));
      }
      public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
      {
        GraphDocument s = (GraphDocument)obj;

        // info.AddBaseValueEmbedded(s,typeof(GraphDocument).BaseType);
        // now the data of our class
        info.AddValue("Name",s._name);
        info.AddValue("PageBounds",s._pageBounds);
        info.AddValue("PrintableBounds",s._printableBounds);
        info.AddValue("Layers",s._layers);

        // new in version 1 - Add graph properties
        int numberproperties = s._graphProperties==null ? 0 : s._graphProperties.Keys.Count;
        info.CreateArray("TableProperties",numberproperties);
        if(s._graphProperties!=null)
        {
          foreach(string propkey in s._graphProperties.Keys)
          {
            if(propkey.StartsWith("tmp/"))
              continue;
            info.CreateElement("e");
            info.AddValue("Key",propkey);
            object val = s._graphProperties[propkey];
            info.AddValue("Value",info.IsSerializable(val) ? val : null);
            info.CommitElement();
          }
        }
        info.CommitArray();


      }
    /// <summary>
    /// Saves the state of the main window into a zipped file.
    /// </summary>
    /// <param name="zippedStream">The file stream of the zip file.</param>
    /// <param name="info">The serialization info used to serialize the state of the main window.</param>
    public void SaveWindowStateToZippedFile(ICompressedFileContainerStream zippedStream, Altaxo.Serialization.Xml.XmlStreamSerializationInfo info)
    {
      System.Text.StringBuilder errorText = new System.Text.StringBuilder();

      {
        // first, we save our own state 
        zippedStream.StartFile("Workbench/MainWindow.xml", 0);
        try
        {
          info.BeginWriting(zippedStream.Stream);
          info.AddValue("MainWindow", Current.Workbench);
          info.EndWriting();
        }
        catch (Exception exc)
        {
          errorText.Append(exc.ToString());
        }
      }

      // second, we save all workbench windows into the Workbench/Views 
      int i = 0;
      foreach (IViewContent ctrl in Current.Workbench.ViewContentCollection)
      {
        if (info.IsSerializable(ctrl))
        {
          i++;
          zippedStream.StartFile("Workbench/Views/View" + i.ToString() + ".xml", 0);
          try
          {
            info.BeginWriting(zippedStream.Stream);
            info.AddValue("WorkbenchViewContent", ctrl);
            info.EndWriting();
          }
          catch (Exception exc)
          {
            errorText.Append(exc.ToString());
          }
        }
      }

      if (errorText.Length != 0)
        throw new ApplicationException(errorText.ToString());
    }
Beispiel #4
0
      public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo  info)
      {
        Altaxo.Data.DataTable s = (Altaxo.Data.DataTable)obj;
        info.AddValue("Name",s._tableName); // name of the Table
        info.AddValue("DataCols",s._dataColumns);
        info.AddValue("PropCols", s._propertyColumns); // the property columns of that table

        // new in version 1
        info.AddValue("TableScript",s._tableScript);

        // new in version 2 - Add table properties
        int numberproperties = s._tableProperties==null ? 0 : s._tableProperties.Keys.Count;
        info.CreateArray("TableProperties",numberproperties);
        if(s._tableProperties!=null)
        {
          foreach(string propkey in s._tableProperties.Keys)
          {
            if(propkey.StartsWith("tmp/"))
              continue;
            info.CreateElement("e");
            info.AddValue("Key",propkey);
            object val = s._tableProperties[propkey];
            info.AddValue("Value",info.IsSerializable(val) ? val : null);
            info.CommitElement();
          }
        }
        info.CommitArray();

      }