61 lines
1.3 KiB
C#
61 lines
1.3 KiB
C#
using System;
|
|
|
|
namespace VegasToTempoBlasterPlugin
|
|
{
|
|
|
|
public class RemotePropertyValue<T>
|
|
{
|
|
private T _value;
|
|
private bool _valueChanged;
|
|
|
|
public T Value
|
|
{
|
|
get { return _value; }
|
|
set
|
|
{
|
|
if (!value.Equals(_value))
|
|
{
|
|
_value = value;
|
|
_valueChanged = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool ValueChanged
|
|
{
|
|
get { return _valueChanged; }
|
|
private set
|
|
{
|
|
_valueChanged = value;
|
|
}
|
|
}
|
|
|
|
public static implicit operator T(RemotePropertyValue<T> a)
|
|
{
|
|
return a.Value;
|
|
}
|
|
|
|
private class RemotePropertyExchange<TNested> : IDisposable
|
|
{
|
|
private readonly RemotePropertyValue<TNested> _internalValue;
|
|
|
|
public RemotePropertyExchange(RemotePropertyValue<TNested> internalValue)
|
|
{
|
|
_internalValue = internalValue;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_internalValue.ValueChanged = false;
|
|
}
|
|
}
|
|
|
|
public IDisposable ClearValueChanged()
|
|
{
|
|
return new RemotePropertyExchange<T>(this);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|