Moved logic to view.
This commit is contained in:
Родитель
66562d873c
Коммит
0a3d82b4df
|
@ -2,7 +2,7 @@ using System;
|
||||||
|
|
||||||
namespace HotUI
|
namespace HotUI
|
||||||
{
|
{
|
||||||
public class Binding<T>
|
public class Binding<T> : IBinding
|
||||||
{
|
{
|
||||||
public Binding(Func<T> getValue, Action<T> setValue)
|
public Binding(Func<T> getValue, Action<T> setValue)
|
||||||
{
|
{
|
||||||
|
@ -12,10 +12,11 @@ namespace HotUI
|
||||||
|
|
||||||
public Func<T> Get { get; }
|
public Func<T> Get { get; }
|
||||||
public Action<T> Set { get; }
|
public Action<T> Set { get; }
|
||||||
public bool Implicit { get; set; }
|
|
||||||
|
public bool ImplicitFromValue { get; set; }
|
||||||
|
|
||||||
public static implicit operator Binding<T>(T value) => new Binding<T>(
|
public static implicit operator Binding<T>(T value) => new Binding<T>(
|
||||||
getValue:() => value,
|
getValue:() => value,
|
||||||
setValue: null) { Implicit = true };
|
setValue: null) { ImplicitFromValue = true };
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@ namespace HotUI
|
||||||
float from = 0,
|
float from = 0,
|
||||||
float through = 100,
|
float through = 100,
|
||||||
float by = 1,
|
float by = 1,
|
||||||
Action<float> onEditingChanged = null) : base(value?.Implicit ?? false)
|
Action<float> onEditingChanged = null) : base(value)
|
||||||
{
|
{
|
||||||
ValueBinding = value?.Get;
|
ValueBinding = value?.Get;
|
||||||
From = from;
|
From = from;
|
||||||
|
|
|
@ -40,6 +40,12 @@ namespace HotUI {
|
||||||
}
|
}
|
||||||
public NavigationView Navigation { get; set; }
|
public NavigationView Navigation { get; set; }
|
||||||
protected State State { get; set; }
|
protected State State { get; set; }
|
||||||
|
|
||||||
|
protected View(IBinding binding) : this(binding?.ImplicitFromValue ?? false)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public View (bool hasConstructors)
|
public View (bool hasConstructors)
|
||||||
{
|
{
|
||||||
ActiveViews.Add (this);
|
ActiveViews.Add (this);
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace HotUI
|
||||||
|
{
|
||||||
|
public interface IBinding
|
||||||
|
{
|
||||||
|
bool ImplicitFromValue { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче