mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-16 07:58:34 +00:00
Removed Bind method from OSCADObject, added IBindable, Binding.cs, and BindingMapper stubs.
This commit is contained in:
parent
963a58783a
commit
d5ec961cb1
@ -227,17 +227,6 @@ namespace OSCADSharp
|
||||
#endregion
|
||||
|
||||
#region Utility Methods
|
||||
private Dictionary<string, Variable> bindings = new Dictionary<string, Variable>();
|
||||
/// <summary>
|
||||
/// Binds a variable to property of this object
|
||||
/// </summary>
|
||||
/// <param name="property"></param>
|
||||
/// <param name="variable"></param>
|
||||
public void Bind(string property, Variable variable)
|
||||
{
|
||||
bindings[property] = variable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the computed position of this object.
|
||||
///
|
||||
|
||||
@ -48,6 +48,9 @@
|
||||
<Compile Include="Files\IFileInvoker.cs" />
|
||||
<Compile Include="Files\IFileWriter.cs" />
|
||||
<Compile Include="Ids.cs" />
|
||||
<Compile Include="Scripting\BindingMapper.cs" />
|
||||
<Compile Include="Scripting\Bindings.cs" />
|
||||
<Compile Include="Scripting\IBindable.cs" />
|
||||
<Compile Include="Scripting\SingleStatementObject.cs" />
|
||||
<Compile Include="Scripting\StatementBuilder.cs" />
|
||||
<Compile Include="Scripting\Variable.cs" />
|
||||
|
||||
15
OSCADSharp/OSCADSharp/Scripting/BindingMapper.cs
Normal file
15
OSCADSharp/OSCADSharp/Scripting/BindingMapper.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp.Scripting
|
||||
{
|
||||
internal class BindingMapper
|
||||
{
|
||||
public string OpenSCADFieldName { get; set; }
|
||||
public List<string> BindingOptions { get; set; }
|
||||
public Dictionary<string, Func<object, string>> BindingTransformers { get; set; }
|
||||
}
|
||||
}
|
||||
19
OSCADSharp/OSCADSharp/Scripting/Bindings.cs
Normal file
19
OSCADSharp/OSCADSharp/Scripting/Bindings.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp.Scripting
|
||||
{
|
||||
internal class Bindings
|
||||
{
|
||||
internal List<BindingMapper> Mappers { get; set; } = new List<BindingMapper>();
|
||||
|
||||
private Dictionary<string, Variable> bindings = new Dictionary<string, Variable>();
|
||||
internal void Add(string property, Variable variable)
|
||||
{
|
||||
bindings[property] = variable;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
OSCADSharp/OSCADSharp/Scripting/IBindable.cs
Normal file
21
OSCADSharp/OSCADSharp/Scripting/IBindable.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp.Scripting
|
||||
{
|
||||
/// <summary>
|
||||
/// An object whose properties can be bound to variables
|
||||
/// </summary>
|
||||
public interface IBindable
|
||||
{
|
||||
/// <summary>
|
||||
/// Binds a variable to property of this object
|
||||
/// </summary>
|
||||
/// <param name="property"></param>
|
||||
/// <param name="variable"></param>
|
||||
void Bind(string property, Variable variable);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user