Data bindings - Added copy/pasting of data binding

This commit is contained in:
Robert committed 2021-03-24 21:53:23 +01:00
1 parent b3b7d6819d
commit a0faeb21fd
8 files changed
+136 -75

No files matched your search

@@ -63,7 +63,10 @@ namespace Artemis.Core
/// </summary>
public Easings.Functions EasingFunction { get; set; }
internal DataBindingEntity Entity { get; }
/// <summary>
/// Gets the data binding entity this data binding uses for persistent storage
/// </summary>
public DataBindingEntity Entity { get; }
/// <summary>
/// Gets the current value of the data binding
@@ -100,6 +103,25 @@ namespace Artemis.Core
return Registration?.Getter.Method.ReturnType;
}
/// <summary>
/// Releases the unmanaged resources used by the object and optionally releases the managed resources.
/// </summary>
/// <param name="disposing">
/// <see langword="true" /> to release both managed and unmanaged resources;
/// <see langword="false" /> to release only unmanaged resources.
/// </param>
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
_disposed = true;
if (Registration != null)
Registration.DataBinding = null;
DataBindingMode?.Dispose();
}
}
private void ResetEasing(TProperty value)
{
_previousValue = GetInterpolatedValue();
@@ -192,27 +214,6 @@ namespace Artemis.Core
_reapplyValue = true;
}
#region IDisposable
/// <summary>
/// Releases the unmanaged resources used by the object and optionally releases the managed resources.
/// </summary>
/// <param name="disposing">
/// <see langword="true" /> to release both managed and unmanaged resources;
/// <see langword="false" /> to release only unmanaged resources.
/// </param>
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
_disposed = true;
if (Registration != null)
Registration.DataBinding = null;
DataBindingMode?.Dispose();
}
}
/// <inheritdoc />
public void Dispose()
{
@@ -220,8 +221,6 @@ namespace Artemis.Core
GC.SuppressFinalize(this);
}
#endregion
#region Mode management
/// <summary>
@@ -245,6 +244,16 @@ namespace Artemis.Core
ApplyDataBindingMode();
}
/// <summary>
/// Replaces the current data binding mode with one based on the provided data binding mode entity
/// </summary>
/// <param name="dataBindingModeEntity">The data binding mode entity to base the new data binding mode upon</param>
public void ApplyDataBindingEntity(IDataBindingModeEntity dataBindingModeEntity)
{
Entity.DataBindingMode = dataBindingModeEntity;
ApplyDataBindingMode();
}
private void ApplyDataBindingMode()
{
DataBindingMode?.Dispose();