Cleaned up the samples to use new [Body]
This commit is contained in:
Родитель
1c576ff465
Коммит
2cdd69336e
|
@ -5,9 +5,8 @@ namespace HotUI.Samples
|
|||
{
|
||||
public class BasicNavigationTestView : View
|
||||
{
|
||||
public BasicNavigationTestView()
|
||||
{
|
||||
Body = () => new NavigationView
|
||||
[Body]
|
||||
View body() => new NavigationView
|
||||
{
|
||||
new VStack()
|
||||
{
|
||||
|
@ -17,5 +16,5 @@ namespace HotUI.Samples
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -7,13 +7,12 @@ namespace HotUI.Samples
|
|||
{
|
||||
readonly State<int> count = 0;
|
||||
|
||||
public ButtonSample1()
|
||||
{
|
||||
Body = () => new VStack
|
||||
[Body]
|
||||
View body() => new VStack
|
||||
{
|
||||
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 {
|
||||
namespace HotUI.Samples
|
||||
{
|
||||
public class InsaneDiffPage : View
|
||||
{
|
||||
readonly State<bool> myBoolean = new State<bool>();
|
||||
readonly State<string> myText = new State<string>();
|
||||
public InsaneDiffPage ()
|
||||
|
||||
[Body]
|
||||
View body()
|
||||
{
|
||||
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++) {
|
||||
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()
|
||||
{
|
||||
Body = () => new VStack
|
||||
[Body]
|
||||
View body() => new VStack
|
||||
{
|
||||
new SecureField(password, "Enter a password"),
|
||||
new Text(password)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,13 +21,10 @@ namespace HotUI.Samples
|
|||
{
|
||||
readonly State<string> password = new State<string>("");
|
||||
|
||||
public SecureFieldSample2()
|
||||
{
|
||||
Body = () => new VStack
|
||||
[Body] View body() => new VStack
|
||||
{
|
||||
new SecureField(null, "Enter a password", value => password.Value = value),
|
||||
new Text(password.Value)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,13 +21,11 @@ namespace HotUI.Samples
|
|||
{
|
||||
readonly State<string> password = new State<string>("");
|
||||
|
||||
public SecureFieldSample3()
|
||||
{
|
||||
Body = () => new VStack
|
||||
[Body]
|
||||
View body() => new VStack
|
||||
{
|
||||
new SecureField(null, "Enter a password", password),
|
||||
new Text(password)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,13 +21,11 @@ namespace HotUI.Samples
|
|||
{
|
||||
readonly State<string> password = "";
|
||||
|
||||
public SecureFieldSample4()
|
||||
{
|
||||
Body = () => new VStack
|
||||
[Body]
|
||||
View body() => new VStack
|
||||
{
|
||||
new SecureField(password, "Enter a password"),
|
||||
new Text(password)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,9 +21,8 @@ namespace HotUI.Samples
|
|||
{
|
||||
readonly State<float> celsius = 50;
|
||||
|
||||
public SliderSample1()
|
||||
{
|
||||
Body = () => new VStack
|
||||
[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),
|
||||
|
@ -32,6 +31,6 @@ namespace HotUI.Samples
|
|||
new Text($"{celsius.Value} Celsius"),
|
||||
new Text($"{celsius.Value * 9 / 5 + 32} Fahrenheit"),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -8,9 +8,8 @@ namespace HotUI.Samples
|
|||
readonly State<string> name1 = "";
|
||||
readonly State<string> name2 = "";
|
||||
|
||||
public TextFieldSample1()
|
||||
{
|
||||
Body = () => new VStack
|
||||
[Body]
|
||||
View body() => new VStack
|
||||
{
|
||||
new TextField(null, "Name", name1, name2),
|
||||
new HStack()
|
||||
|
@ -27,5 +26,5 @@ namespace HotUI.Samples
|
|||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Загрузка…
Ссылка в новой задаче