2019-09-28 18:17:39 +00:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace cylvester
|
|
|
|
{
|
|
|
|
public interface ITogglePresenter
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public class TogglePresenter : ITogglePresenter, IDisposable
|
|
|
|
{
|
|
|
|
private readonly IEditorToggle editorToggle_;
|
|
|
|
|
|
|
|
private readonly Action onToggleChanged_;
|
|
|
|
|
|
|
|
public TogglePresenter(IEditorToggle toggle, IPdBackend pdBackend)
|
|
|
|
{
|
|
|
|
editorToggle_ = toggle;
|
|
|
|
|
|
|
|
onToggleChanged_ = () =>
|
|
|
|
{
|
2019-09-28 18:29:31 +00:00
|
|
|
pdBackend.State = editorToggle_.State;
|
2019-09-28 18:17:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
editorToggle_.ToggleStateChanged += onToggleChanged_;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
editorToggle_.ToggleStateChanged -= onToggleChanged_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|