Cleaned up the samples to use new [Body]
This commit is contained in:
Родитель
1c576ff465
Коммит
2cdd69336e
|
@ -5,17 +5,16 @@ namespace HotUI.Samples
|
|||
{
|
||||
public class BasicNavigationTestView : View
|
||||
{
|
||||
public BasicNavigationTestView()
|
||||
[Body]
|
||||
View body() => new NavigationView
|
||||
{
|
||||
Body = () => new NavigationView
|
||||
new VStack()
|
||||
{
|
||||
new VStack()
|
||||
{
|
||||
new NavigationButton("Navigate!", () => new BasicTestView()),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
new NavigationButton("Navigate!", () => new BasicTestView()),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -6,14 +6,13 @@ namespace HotUI.Samples
|
|||
public class ButtonSample1 : View
|
||||
{
|
||||
readonly State<int> count = 0;
|
||||
|
||||
public ButtonSample1()
|
||||
|
||||
[Body]
|
||||
View body() => new VStack
|
||||
{
|
||||
Body = () => new VStack
|
||||
{
|
||||
new Button("Increment Value", () => count.Value = count + 1),
|
||||
new Text($"Value: {count.Value}"),
|
||||
};
|
||||
}
|
||||
new Button("Increment Value", () => count.Value = count + 1),
|
||||
new Text($"Value: {count.Value}"),
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -1,22 +1,24 @@
|
|||
using System;
|
||||
namespace HotUI.Samples {
|
||||
public class InsaneDiffPage : View {
|
||||
readonly State<bool> myBoolean = new State<bool> ();
|
||||
readonly State<string> myText = new State<string> ();
|
||||
public InsaneDiffPage ()
|
||||
{
|
||||
Body = () => {
|
||||
var stack = new VStack {
|
||||
new Button
|
||||
(()=> myBoolean.Value ? myText.Value : $"State: {myBoolean.Value}",
|
||||
()=> myBoolean.Value = !myBoolean.Value),
|
||||
};
|
||||
for (var i = 0; i < 100; i++) {
|
||||
stack.Add (new Text (i.ToString ()));
|
||||
}
|
||||
return new ScrollView { stack };
|
||||
};
|
||||
}
|
||||
namespace HotUI.Samples
|
||||
{
|
||||
public class InsaneDiffPage : View
|
||||
{
|
||||
readonly State<bool> myBoolean = new State<bool>();
|
||||
readonly State<string> myText = new State<string>();
|
||||
|
||||
}
|
||||
}
|
||||
[Body]
|
||||
View body()
|
||||
{
|
||||
var stack = new VStack {
|
||||
new Button
|
||||
(()=> myBoolean.Value ? myText.Value : $"State: {myBoolean.Value}",
|
||||
()=> myBoolean.Value = !myBoolean.Value),
|
||||
};
|
||||
for (var i = 0; i < 100; i++)
|
||||
{
|
||||
stack.Add(new Text(i.ToString()));
|
||||
}
|
||||
return new ScrollView { stack };
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,18 +19,13 @@ namespace HotUI.Samples
|
|||
{
|
||||
public class SecureFieldSample1 : View
|
||||
{
|
||||
/*[State]
|
||||
readonly MyBindingObject state;*/
|
||||
|
||||
readonly State<string> password = new State<string>("");
|
||||
|
||||
public SecureFieldSample1()
|
||||
readonly State<string> password = new State<string>("");
|
||||
|
||||
[Body]
|
||||
View body() => new VStack
|
||||
{
|
||||
Body = () => new VStack
|
||||
{
|
||||
new SecureField(password, "Enter a password"),
|
||||
new Text(password)
|
||||
};
|
||||
}
|
||||
new SecureField(password, "Enter a password"),
|
||||
new Text(password)
|
||||
};
|
||||
}
|
||||
}
|
|
@ -19,15 +19,12 @@ namespace HotUI.Samples
|
|||
{
|
||||
public class SecureFieldSample2 : View
|
||||
{
|
||||
readonly State<string> password = new State<string>("");
|
||||
|
||||
public SecureFieldSample2()
|
||||
readonly State<string> password = new State<string>("");
|
||||
|
||||
[Body] View body() => new VStack
|
||||
{
|
||||
Body = () => new VStack
|
||||
{
|
||||
new SecureField(null, "Enter a password", value => password.Value = value),
|
||||
new Text(password.Value)
|
||||
};
|
||||
}
|
||||
new SecureField(null, "Enter a password", value => password.Value = value),
|
||||
new Text(password.Value)
|
||||
};
|
||||
}
|
||||
}
|
|
@ -20,14 +20,12 @@ namespace HotUI.Samples
|
|||
public class SecureFieldSample3 : View
|
||||
{
|
||||
readonly State<string> password = new State<string>("");
|
||||
|
||||
public SecureFieldSample3()
|
||||
|
||||
[Body]
|
||||
View body() => new VStack
|
||||
{
|
||||
Body = () => new VStack
|
||||
{
|
||||
new SecureField(null, "Enter a password", password),
|
||||
new Text(password)
|
||||
};
|
||||
}
|
||||
new SecureField(null, "Enter a password", password),
|
||||
new Text(password)
|
||||
};
|
||||
}
|
||||
}
|
|
@ -20,14 +20,12 @@ namespace HotUI.Samples
|
|||
public class SecureFieldSample4 : View
|
||||
{
|
||||
readonly State<string> password = "";
|
||||
|
||||
public SecureFieldSample4()
|
||||
|
||||
[Body]
|
||||
View body() => new VStack
|
||||
{
|
||||
Body = () => new VStack
|
||||
{
|
||||
new SecureField(password, "Enter a password"),
|
||||
new Text(password)
|
||||
};
|
||||
}
|
||||
new SecureField(password, "Enter a password"),
|
||||
new Text(password)
|
||||
};
|
||||
}
|
||||
}
|
|
@ -19,11 +19,10 @@ namespace HotUI.Samples
|
|||
{
|
||||
public class SliderSample1 : View
|
||||
{
|
||||
readonly State<float> celsius = 50;
|
||||
|
||||
public SliderSample1()
|
||||
{
|
||||
Body = () => new VStack
|
||||
readonly State<float> celsius = 50;
|
||||
|
||||
[Body]
|
||||
View body() => new VStack
|
||||
{
|
||||
//new Slider(value: 12, from: -100, through: 100, by: 0.1f),
|
||||
//new Slider(value: () => 12f, from: -100, through: 100, by: 0.1f),
|
||||
|
@ -31,7 +30,7 @@ namespace HotUI.Samples
|
|||
new Slider(value: celsius, from: -100, through: 100, by: 0.1f),
|
||||
new Text($"{celsius.Value} Celsius"),
|
||||
new Text($"{celsius.Value * 9 / 5 + 32} Fahrenheit"),
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -7,25 +7,24 @@ namespace HotUI.Samples
|
|||
{
|
||||
readonly State<string> name1 = "";
|
||||
readonly State<string> name2 = "";
|
||||
|
||||
public TextFieldSample1()
|
||||
|
||||
[Body]
|
||||
View body() => new VStack
|
||||
{
|
||||
Body = () => new VStack
|
||||
new TextField(null, "Name", name1, name2),
|
||||
new HStack()
|
||||
{
|
||||
new TextField(null, "Name", name1, name2),
|
||||
new HStack()
|
||||
{
|
||||
new Text("onEditingChanged:"),
|
||||
new Text(name1),
|
||||
new Spacer()
|
||||
},
|
||||
new HStack()
|
||||
{
|
||||
new Text("onCommit:"),
|
||||
new Text(name2),
|
||||
new Spacer()
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
new Text("onEditingChanged:"),
|
||||
new Text(name1),
|
||||
new Spacer()
|
||||
},
|
||||
new HStack()
|
||||
{
|
||||
new Text("onCommit:"),
|
||||
new Text(name2),
|
||||
new Spacer()
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
}
|
Загрузка…
Ссылка в новой задаче