Exemplo n.º 1
0
 public void Add(FitFunctionScript script)
 {
     if (!Contains(script))
     {
         _InnerList.Add(script, null);
     }
 }
    public FitFunctionNameAndCategoryController(FitFunctionScript doc)
    {
      _doc = doc;
      _tempName = _doc.FitFunctionName;
      _tempCategory = _doc.FitFunctionCategory;
      _tempDescription = _doc.FitFunctionDescription;

      _controllerName = (ISingleValueController)Current.Gui.GetControllerAndControl(new object[] { _tempName }, typeof(ISingleValueController));
      _controllerCategory = (ISingleValueController)Current.Gui.GetControllerAndControl(new object[] { _tempCategory }, typeof(ISingleValueController));
      _controllerDescription = (ISingleValueController)Current.Gui.GetControllerAndControl(new object[] { _tempDescription }, typeof(ISingleValueController));
      _controllerShouldSaveInUserData = (IBooleanValueController)Current.Gui.GetControllerAndControl(new object[] { _tempShouldSave }, typeof(IBooleanValueController));


      _controllerName.DescriptionText = "Enter fit function name:";
      _controllerCategory.DescriptionText = "Enter fit function category:";
      _controllerDescription.DescriptionText = "Enter fit function description:";
      _controllerShouldSaveInUserData.DescriptionText = "Save in user fit functions directory?";

      base.Initialize(new ControlViewElement[]{
        new ControlViewElement( null, _controllerName, _controllerName.ViewObject),
        new ControlViewElement( null, _controllerCategory, _controllerCategory.ViewObject),
        new ControlViewElement( null, _controllerDescription, _controllerDescription.ViewObject),
        new ControlViewElement( null, _controllerShouldSaveInUserData, _controllerShouldSaveInUserData.ViewObject) },
        false);
    }
Exemplo n.º 3
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                FitFunctionScript s = null != o ? (FitFunctionScript)o : new FitFunctionScript();

                // deserialize the base class
                info.GetBaseValueEmbedded(s, typeof(AbstractScript), parent);

                s._fitFunctionCategory              = info.GetString("Category");
                s._fitFunctionName                  = info.GetString("Name");
                s._fitFunctionCreationTime          = info.GetDateTime("CreationTime");
                s._NumberOfParameters               = info.GetInt32("NumberOfParameters");
                s._IsUsingUserDefinedParameterNames = info.GetBoolean("UserDefinedParameters");
                if (s._IsUsingUserDefinedParameterNames)
                {
                    info.GetArray("UserDefinedParameterNames", out s._UserDefinedParameterNames);
                }
                info.GetArray("IndependentVariableNames", out s._IndependentVariablesNames);
                info.GetArray("DependentVariableNames", out s._DependentVariablesNames);

                var surr = new XmlSerializationSurrogate1
                {
                    _deserializedObject = s
                };

                info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.info_DeserializationFinished);

                if (s._IsUsingUserDefinedParameterNames && s._NumberOfParameters != s._UserDefinedParameterNames.Length)
                {
                    s.Compile(); // dirty quick fix in the case that the userdefined parameters where not updated before serialization
                }
                return(s);
            }
Exemplo n.º 4
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                FitFunctionScript s = (FitFunctionScript)obj;

                // Update the user defined paramter names
                if (s.m_ScriptObject != null && s.IsUsingUserDefinedParameterNames)
                {
                    IFitFunction ff = (IFitFunction)s.m_ScriptObject;
                    if (s._UserDefinedParameterNames == null || s._UserDefinedParameterNames.Length != ff.NumberOfParameters)
                    {
                        s._UserDefinedParameterNames = new string[ff.NumberOfParameters];
                    }
                    for (int i = 0; i < ff.NumberOfParameters; ++i)
                    {
                        s._UserDefinedParameterNames[i] = ff.ParameterName(i);
                    }
                }

                info.AddValue("Category", s.FitFunctionCategory);
                info.AddValue("Name", s.FitFunctionName);
                info.AddValue("CreationTime", s._fitFunctionCreationTime);
                info.AddValue("Description", s.FitFunctionName);

                info.AddBaseValueEmbedded(s, typeof(AbstractScript));

                info.AddValue("NumberOfParameters", s.NumberOfParameters);
                info.AddValue("UserDefinedParameters", s.IsUsingUserDefinedParameterNames);
                if (s.IsUsingUserDefinedParameterNames)
                {
                    info.AddArray("UserDefinedParameterNames", s._UserDefinedParameterNames, s._UserDefinedParameterNames.Length);
                }

                info.AddArray("IndependentVariableNames", s._IndependentVariablesNames, s._IndependentVariablesNames.Length);
                info.AddArray("DependentVariableNames", s._DependentVariablesNames, s._DependentVariablesNames.Length);
            }
Exemplo n.º 5
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                FitFunctionScript s = null != o ? (FitFunctionScript)o : new FitFunctionScript();


                s._fitFunctionCategory     = info.GetString("Category");
                s._fitFunctionName         = info.GetString("Name");
                s._fitFunctionCreationTime = info.GetDateTime("CreationTime");
                s._fitFunctionDescription  = info.GetString("Description");

                // deserialize the base class
                info.GetBaseValueEmbedded(s, typeof(AbstractScript), parent);

                s._NumberOfParameters = info.GetInt32("NumberOfParameters");
                s._IsUsingUserDefinedParameterNames = info.GetBoolean("UserDefinedParameters");
                if (s._IsUsingUserDefinedParameterNames)
                {
                    info.GetArray("UserDefinedParameterNames", out s._UserDefinedParameterNames);
                }
                info.GetArray("IndependentVariableNames", out s._IndependentVariablesNames);
                info.GetArray("DependentVariableNames", out s._DependentVariablesNames);

                XmlSerializationSurrogate2 surr = new XmlSerializationSurrogate2();

                surr._deserializedObject      = s;
                info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.info_DeserializationFinished);

                return(s);
            }
Exemplo n.º 6
0
 public void Remove(FitFunctionScript script)
 {
     if (_InnerList.Contains(script))
     {
         _InnerList.Remove(script);
     }
 }
Exemplo n.º 7
0
        public override bool Equals(object obj)
        {
            if (!(obj is FitFunctionScript))
            {
                return(base.Equals(obj));
            }

            FitFunctionScript from = (FitFunctionScript)obj;

            if (!base.Equals(from))
            {
                return(false);
            }

            if (this.FitFunctionCategory != from.FitFunctionCategory)
            {
                return(false);
            }
            if (this.FitFunctionName != from.FitFunctionName)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 8
0
        public void CopyFrom(FitFunctionScript from, bool forModification)
        {
            if (object.ReferenceEquals(this, from))
            {
                return;
            }

            base.CopyFrom(from, forModification);
            CopyInstanceMembersFrom(from);
        }
Exemplo n.º 9
0
 private void CopyInstanceMembersFrom(FitFunctionScript from)
 {
     this._IsUsingUserDefinedParameterNames = from._IsUsingUserDefinedParameterNames;
     this._NumberOfParameters        = from._NumberOfParameters;
     this._UserDefinedParameterNames = null == from._UserDefinedParameterNames ? null : (string[])from._UserDefinedParameterNames.Clone();
     this._IndependentVariablesNames = (string[])from._IndependentVariablesNames.Clone();
     this._DependentVariablesNames   = (string[])from._DependentVariablesNames.Clone();
     this._fitFunctionName           = from._fitFunctionName;
     this._fitFunctionCategory       = from.FitFunctionCategory;
     this._fitFunctionCreationTime   = from._fitFunctionCreationTime;
 }
Exemplo n.º 10
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                FitFunctionScript s = null != o ? (FitFunctionScript)o : new FitFunctionScript();

                // deserialize the base class
                info.GetBaseValueEmbedded(s, typeof(AbstractScript), parent);

                XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0();

                surr._deserializedObject      = s;
                info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.info_DeserializationFinished);

                return(s);
            }
Exemplo n.º 11
0
 public void CopyFrom(FitFunctionScript from, bool forModification)
 {
     base.CopyFrom(from, forModification);
     CopyInstanceMembersFrom(from);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Creates a column script as a copy from another script.
 /// </summary>
 /// <param name="from">The script to copy from.</param>
 /// <param name="forModification">If true, the new script text can be modified.</param>
 public FitFunctionScript(FitFunctionScript from, bool forModification)
     : base(from, forModification)
 {
     CopyInstanceMembersFrom(from);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Creates a column script as a copy from another script.
 /// </summary>
 /// <param name="b">The script to copy from.</param>
 public FitFunctionScript(FitFunctionScript b)
     : base(b, false)
 {
 }
Exemplo n.º 14
0
		/// <summary>
		/// Creates a column script as a copy from another script.
		/// </summary>
		/// <param name="from">The script to copy from.</param>
		/// <param name="forModification">If true, the new script text can be modified.</param>
		public FitFunctionScript(FitFunctionScript from, bool forModification)
			: base(from, forModification)
		{
			CopyInstanceMembersFrom(from);
		}
Exemplo n.º 15
0
		private void CopyInstanceMembersFrom(FitFunctionScript from)
		{
			this._IsUsingUserDefinedParameterNames = from._IsUsingUserDefinedParameterNames;
			this._NumberOfParameters = from._NumberOfParameters;
			this._UserDefinedParameterNames = null == from._UserDefinedParameterNames ? null : (string[])from._UserDefinedParameterNames.Clone();
			this._IndependentVariablesNames = (string[])from._IndependentVariablesNames.Clone();
			this._DependentVariablesNames = (string[])from._DependentVariablesNames.Clone();
			this._fitFunctionName = from._fitFunctionName;
			this._fitFunctionCategory = from.FitFunctionCategory;
			this._fitFunctionCreationTime = from._fitFunctionCreationTime;
		}
Exemplo n.º 16
0
		/// <summary>
		/// Creates a column script as a copy from another script.
		/// </summary>
		/// <param name="b">The script to copy from.</param>
		public FitFunctionScript(FitFunctionScript b)
			: base(b, false)
		{
		}
 public bool Contains(FitFunctionScript script)
 {
   return _InnerList.Contains(script);
 }
    public void EhView_NewFitFunction()
    {
      FitFunctionScript script = new FitFunctionScript();

      object scriptAsObject = script;
      if (Current.Gui.ShowDialog(ref scriptAsObject, "Create fit function"))
      {
        script = (FitFunctionScript)scriptAsObject;

        Current.Gui.ShowDialog(new FitFunctionNameAndCategoryController(script), "Name your script");

        Current.Project.FitFunctionScripts.Add(script);

        Select(script);
        _funcselController.Refresh();
        _view.SwitchToFitEnsemblePage();

      }
    }
Exemplo n.º 19
0
		public void CopyFrom(FitFunctionScript from, bool forModification)
		{
			if (object.ReferenceEquals(this, from))
				return;

			base.CopyFrom(from, forModification);
			CopyInstanceMembersFrom(from);
		}
Exemplo n.º 20
0
 public bool Contains(FitFunctionScript script)
 {
     return(_InnerList.Contains(script));
 }
 public void Add(FitFunctionScript script)
 {
   if (!Contains(script))
     _InnerList.Add(script,null);
 }
Exemplo n.º 22
0
		public void EhView_NewFitFunction()
		{
			FitFunctionScript script = new FitFunctionScript();

		Label_EditScript:
			object scriptAsObject = script;
			if (Current.Gui.ShowDialog(ref scriptAsObject, "Create fit function"))
			{
				script = (FitFunctionScript)scriptAsObject;

				var nameController = new FitFunctionNameAndCategoryController();
				nameController.InitializeDocument(script);
				if (!Current.Gui.ShowDialog(nameController, "Name your script"))
					goto Label_EditScript;

				Current.Project.FitFunctionScripts.Add(script);

				Select(script);
				_funcselController.Refresh();
				_view.SwitchToFitEnsemblePage();
			}
		}
 public void Remove(FitFunctionScript script)
 {
   if (_InnerList.Contains(script))
     _InnerList.Remove(script);
 }
Exemplo n.º 24
0
 public void CopyFrom(FitFunctionScript from, bool forModification)
 {
   base.CopyFrom(from,forModification);
   CopyInstanceMembersFrom(from);
 }