support first-class variable definitions in editor configuration
This commit is contained in:
parent
f1fe8f7e94
commit
230741a2af
@ -6,6 +6,7 @@ using UniversalEditor.ObjectModels.Markup;
|
||||
using UniversalEditor.DataFormats.Markup.XML;
|
||||
using UniversalEditor.Accessors;
|
||||
using MBS.Framework.UserInterface;
|
||||
using MBS.Framework.Logic;
|
||||
|
||||
namespace UniversalEditor.UserInterface.Common
|
||||
{
|
||||
@ -179,6 +180,27 @@ namespace UniversalEditor.UserInterface.Common
|
||||
}
|
||||
}
|
||||
}
|
||||
MarkupTagElement tagVariables = (tagEditor.Elements["Variables"] as MarkupTagElement);
|
||||
if (tagVariables != null)
|
||||
{
|
||||
for (int i = 0; i < tagVariables.Elements.Count; i++)
|
||||
{
|
||||
MarkupTagElement tagVariable = tagVariables.Elements[i] as MarkupTagElement;
|
||||
if (tagVariable == null) continue;
|
||||
if (tagVariable.FullName != "Variable") continue;
|
||||
|
||||
MarkupAttribute attName = tagVariable.Attributes["Name"];
|
||||
if (attName == null) continue;
|
||||
|
||||
MarkupAttribute attValue = tagVariable.Attributes["Value"];
|
||||
|
||||
Variable varr = new MBS.Framework.Logic.Variable(attName.Value);
|
||||
if (attValue != null)
|
||||
varr.Expression = Expression.Parse(attValue.Value);
|
||||
|
||||
er.Variables.Add(varr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MBS.Framework.Logic;
|
||||
using MBS.Framework.UserInterface;
|
||||
using UniversalEditor.ObjectModels.Markup;
|
||||
|
||||
@ -28,6 +29,7 @@ namespace UniversalEditor.UserInterface
|
||||
public KeyBinding.KeyBindingCollection KeyBindings { get; } = new KeyBinding.KeyBindingCollection();
|
||||
|
||||
public EditorView.EditorViewCollection Views { get; } = new EditorView.EditorViewCollection();
|
||||
public Variable.VariableCollection Variables { get; } = new Variable.VariableCollection();
|
||||
|
||||
public EditorReference(Type type)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user