зеркало из https://github.com/jsuarezruiz/HotUI.git
Revert "Merge pull request #104 from Clancey/MagicTwowayBinding"
This reverts commit76c1c5cc94
, reversing changes made toc44e4ed91a
.
This commit is contained in:
Родитель
36be319bc9
Коммит
5a8e5cb879
124
HotUI.sln
124
HotUI.sln
|
@ -43,14 +43,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotUI.Skia.Mac", "src\HotUI
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotUI.Skia.Android", "src\HotUI.Skia.Android\HotUI.Skia.Android.csproj", "{F5FFBB2C-23BE-4029-BFD1-1028F1461F86}"
|
||||
EndProject
|
||||
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "HotUI.Skia.WPF", "src\HotUI.Skia.WPF\HotUI.Skia.WPF.csproj", "{03906486-5546-447A-9F96-A10DFCDCEBF8}"
|
||||
EndProject
|
||||
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "HotUI.Skia.UWP", "src\HotUI.Skia.UWP\HotUI.Skia.UWP.csproj", "{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotUI.iOS.Sample", "sample\HotUI.iOS.Sample\HotUI.iOS.Sample.csproj", "{12BE5947-A64A-4968-96A6-5CA3CE36C244}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotUI.Skia.iOS", "src\HotUI.Skia.iOS\HotUI.Skia.iOS.csproj", "{9ACC68A5-5A5C-409D-A379-D62220A9F49F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotUI.Skia.WPF", "src\HotUI.Skia.WPF\HotUI.Skia.WPF.csproj", "{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotUI.Skia.UWP", "src\HotUI.Skia.UWP\HotUI.Skia.UWP.csproj", "{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -531,6 +531,62 @@ Global
|
|||
{F5FFBB2C-23BE-4029-BFD1-1028F1461F86}.Release|x64.Build.0 = Release|Any CPU
|
||||
{F5FFBB2C-23BE-4029-BFD1-1028F1461F86}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F5FFBB2C-23BE-4029-BFD1-1028F1461F86}.Release|x86.Build.0 = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|x64.Build.0 = Debug|x64
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Debug|x86.Build.0 = Debug|x86
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|ARM.Build.0 = Release|ARM
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|x64.ActiveCfg = Release|x64
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|x64.Build.0 = Release|x64
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|x86.ActiveCfg = Release|x86
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7}.Release|x86.Build.0 = Release|x86
|
||||
{12BE5947-A64A-4968-96A6-5CA3CE36C244}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{12BE5947-A64A-4968-96A6-5CA3CE36C244}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{12BE5947-A64A-4968-96A6-5CA3CE36C244}.Debug|ARM.ActiveCfg = Debug|iPhone
|
||||
|
@ -579,62 +635,6 @@ Global
|
|||
{9ACC68A5-5A5C-409D-A379-D62220A9F49F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{9ACC68A5-5A5C-409D-A379-D62220A9F49F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9ACC68A5-5A5C-409D-A379-D62220A9F49F}.Release|x86.Build.0 = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA}.Release|x86.Build.0 = Release|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|x64.Build.0 = Debug|x64
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Debug|x86.Build.0 = Debug|x86
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|ARM.Build.0 = Release|ARM
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|x64.ActiveCfg = Release|x64
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|x64.Build.0 = Release|x64
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|x86.ActiveCfg = Release|x86
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -655,10 +655,10 @@ Global
|
|||
{F8BA5DE0-AEC0-4423-B036-5F9157E939D0} = {AB9AD206-4B1E-4B0C-88A2-5C769314E8A4}
|
||||
{00B248D0-382A-4504-A126-76B9C892583E} = {BDB6346D-E97A-49F4-81D6-664390944360}
|
||||
{F5FFBB2C-23BE-4029-BFD1-1028F1461F86} = {BDB6346D-E97A-49F4-81D6-664390944360}
|
||||
{03906486-5546-447A-9F96-A10DFCDCEBF8} = {BDB6346D-E97A-49F4-81D6-664390944360}
|
||||
{06166681-6C9B-45EA-87C9-EE7BEF0E28D7} = {BDB6346D-E97A-49F4-81D6-664390944360}
|
||||
{12BE5947-A64A-4968-96A6-5CA3CE36C244} = {C3FDCDB7-0C29-472D-A406-E2F21A4B0EAE}
|
||||
{9ACC68A5-5A5C-409D-A379-D62220A9F49F} = {BDB6346D-E97A-49F4-81D6-664390944360}
|
||||
{E7FA15FC-418F-4FFE-9DC1-CF68AFA860AA} = {BDB6346D-E97A-49F4-81D6-664390944360}
|
||||
{004EF9A7-6FF7-4ACA-9416-DCFB84A85B04} = {BDB6346D-E97A-49F4-81D6-664390944360}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {0653DB4A-5BBE-4D78-99B2-DB1C82663246}
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace HotUI.Samples
|
|||
new VStack
|
||||
{
|
||||
(state.CanEdit
|
||||
? (View) new TextField(state.Text)
|
||||
? (View) new TextField(state.TwoWayBinding(s => s.Text))
|
||||
: new Text(() => $"{state.Text}: multiText")), // Text will warn you. This should be done by TextBinding
|
||||
new Text(state.Text),
|
||||
new HStack
|
||||
|
|
|
@ -108,9 +108,9 @@ namespace HotUI.Samples
|
|||
rows: new object[] { 40, 20, 40, 20, 40, 20, 44, 20, 1, 20, 44 },
|
||||
columns: new object[] { "2*", 20, "*" })
|
||||
{
|
||||
EntryContainer(Card.Number, "Enter CC Number", "\uf09d").Cell(row:0, column: 0, colSpan: 3),
|
||||
EntryContainer(Card.Expiration, "MM/YYYY", "\uf783").Cell(row:2, column: 0),
|
||||
EntryContainer(Card.CVV, "CVV", "\uf023").Cell(row:2, column: 2),
|
||||
EntryContainer(Card.TwoWayBinding(x => x.Number), "Enter CC Number", "\uf09d").Cell(row:0, column: 0, colSpan: 3),
|
||||
EntryContainer(Card.TwoWayBinding(x => x.Expiration), "MM/YYYY", "\uf783").Cell(row:2, column: 0),
|
||||
EntryContainer(Card.TwoWayBinding(x => x.CVV), "CVV", "\uf023").Cell(row:2, column: 2),
|
||||
new HStack
|
||||
{
|
||||
new Toggle(remember),
|
||||
|
|
|
@ -67,18 +67,18 @@ namespace HotUI.Samples
|
|||
}.RoundedBorder(radius: 8, color: "#3177CB", filled: true).Padding(30)
|
||||
}.Background("#f6f6f6"),
|
||||
|
||||
new BorderedEntry(Card.Number,"Enter CC Number", "\uf09d")
|
||||
new BorderedEntry(Card.TwoWayBinding(x => x.Number),"Enter CC Number", "\uf09d")
|
||||
.Padding(left:20, right: 20),
|
||||
|
||||
new HStack(spacing:20)
|
||||
{
|
||||
new BorderedEntry(Card.Expiration, "MM/YYYY", "\uf783")
|
||||
new BorderedEntry(Card.TwoWayBinding(x => x.Expiration), "MM/YYYY", "\uf783")
|
||||
.Frame(height: 40, width: 200)
|
||||
.Padding(left:20),
|
||||
|
||||
new Spacer(),
|
||||
|
||||
new BorderedEntry(Card.CVV, "CVV", "\uf023")
|
||||
new BorderedEntry(Card.TwoWayBinding(x => x.CVV), "CVV", "\uf023")
|
||||
.Frame( height: 40, width: 100)
|
||||
.Padding(right:20),
|
||||
},
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace HotUI.Samples
|
|||
[Body]
|
||||
View Build() => new VStack()
|
||||
{
|
||||
new TextField(_state.Text, "Name"),
|
||||
new TextField(_state.TwoWayBinding(v => v.Text), "Name"),
|
||||
new HStack()
|
||||
{
|
||||
new Text("Current Value:")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace HotUI
|
||||
|
@ -29,75 +27,23 @@ namespace HotUI
|
|||
Set = setValue;
|
||||
}
|
||||
|
||||
public Func<T> Get { get; private set; }
|
||||
public Action<T> Set {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public T CurrentValue { get; private set; }
|
||||
|
||||
WeakReference _view;
|
||||
internal View View
|
||||
{
|
||||
get => _view?.Target as View;
|
||||
set => _view = new WeakReference(value);
|
||||
}
|
||||
|
||||
public string[] BoundProperties { get; private set; }
|
||||
|
||||
public Func<T> Get { get; }
|
||||
public Action<T> Set { get; }
|
||||
|
||||
public static implicit operator Binding<T>(T value)
|
||||
{
|
||||
var state = StateBuilder.CurrentState;
|
||||
var props = state?.EndProperty();
|
||||
return new Binding<T>(
|
||||
getValue: () => value,
|
||||
setValue: null) {
|
||||
IsValue = true,
|
||||
CurrentValue = value,
|
||||
BoundProperties = props,
|
||||
};
|
||||
setValue: null) { IsValue = true };
|
||||
}
|
||||
|
||||
|
||||
public static implicit operator Binding<T>(Func<T> value)
|
||||
{
|
||||
var state = StateBuilder.CurrentState;
|
||||
state?.StartProperty();
|
||||
var result = value.Invoke();
|
||||
var props = state?.EndProperty();
|
||||
{
|
||||
return new Binding<T>(
|
||||
getValue: value,
|
||||
setValue: null) {
|
||||
IsFunc = true,
|
||||
CurrentValue = result,
|
||||
BoundProperties = props,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static implicit operator Binding<T>(State<T> state)
|
||||
{
|
||||
|
||||
var bindingState = StateBuilder.CurrentState;
|
||||
bindingState?.StartProperty();
|
||||
var result = state.Value;
|
||||
var props = bindingState?.EndProperty();
|
||||
|
||||
|
||||
var binding = new Binding<T>(
|
||||
getValue: () => state.Value,
|
||||
setValue: (v) => {
|
||||
state.Value = v;
|
||||
})
|
||||
{
|
||||
CurrentValue = result,
|
||||
BoundProperties = props,
|
||||
IsFunc = true,
|
||||
};
|
||||
return binding;
|
||||
setValue: null) {IsFunc = true};
|
||||
}
|
||||
|
||||
|
||||
private static Func<object> ToGenericGetter(Func<T> getValue)
|
||||
{
|
||||
if (getValue != null)
|
||||
|
@ -113,73 +59,6 @@ namespace HotUI
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void BindToProperty(State state, View view, string property)
|
||||
{
|
||||
if(IsFunc && BoundProperties?.Length > 0)
|
||||
{
|
||||
state.BindingState.AddViewProperty(BoundProperties, view, property);
|
||||
return;
|
||||
}
|
||||
|
||||
if(IsValue)
|
||||
{
|
||||
|
||||
bool isGlobal = BoundProperties?.Length > 1;
|
||||
var propCount = BoundProperties?.Length ?? 0;
|
||||
if (propCount == 0)
|
||||
return;
|
||||
|
||||
var prop = BoundProperties[0];
|
||||
if (BoundProperties?.Length == 1)
|
||||
{
|
||||
|
||||
|
||||
var stateValue = state.GetValue(prop).Cast<T>();
|
||||
var newValue = Get.Invoke();
|
||||
var old = state.EndProperty(false);
|
||||
//1 to 1 binding!
|
||||
if (EqualityComparer<T>.Default.Equals(stateValue, newValue))
|
||||
{
|
||||
Get = () => state.GetValue(prop).Cast<T>();
|
||||
Set = (v) => state.SetChildrenValue(property, v);
|
||||
CurrentValue = newValue;
|
||||
IsValue = false;
|
||||
IsFunc = true;
|
||||
state.BindingState.AddViewProperty(prop, property, view);
|
||||
Debug.WriteLine($"Databinding: {property} to {prop}");
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorMessage = $"Warning: {property} is using formated Text. For performance reasons, please switch to a Lambda. i.e new Text(()=> \"Hello\")";
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
Logger.Fatal(errorMessage);
|
||||
}
|
||||
|
||||
Debug.WriteLine(errorMessage);
|
||||
isGlobal = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorMessage = $"Warning: {property} is using Multiple state Variables. For performance reasons, please switch to a Lambda.";
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
|
||||
Debug.WriteLine(errorMessage);
|
||||
}
|
||||
|
||||
if (isGlobal)
|
||||
{
|
||||
state.BindingState.AddGlobalProperties(BoundProperties);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class BindingExtensions
|
||||
|
@ -192,7 +71,7 @@ namespace HotUI
|
|||
return binding.Get.Invoke();
|
||||
}
|
||||
|
||||
internal static Binding<T> TwoWayBinding<TBindingObject, T>(this TBindingObject binding, Expression<Func<TBindingObject, T>> expression) where TBindingObject:BindingObject
|
||||
public static Binding<T> TwoWayBinding<TBindingObject, T>(this TBindingObject binding, Expression<Func<TBindingObject, T>> expression) where TBindingObject:BindingObject
|
||||
{
|
||||
if (expression.Body is MemberExpression member)
|
||||
{
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using HotUI.Reflection;
|
||||
|
||||
namespace HotUI
|
||||
{
|
||||
|
@ -12,39 +9,19 @@ namespace HotUI
|
|||
private readonly string _propertyName;
|
||||
|
||||
protected BoundControl (Binding<T> binding, string propertyName) : base(binding?.IsValue ?? false)
|
||||
{
|
||||
_propertyName = propertyName;
|
||||
_binding = binding;
|
||||
if (_binding != null)
|
||||
{
|
||||
BoundValue = _binding.CurrentValue;
|
||||
_binding.View = this;
|
||||
if(_binding.BoundProperties?.Length > 0)
|
||||
_binding.BindToProperty(State, this, propertyName);
|
||||
}
|
||||
{
|
||||
_binding = binding;
|
||||
_propertyName = propertyName;
|
||||
|
||||
if (binding?.IsValue ?? false)
|
||||
BoundValue = binding.Get.Invoke();
|
||||
}
|
||||
|
||||
T _boundValue;
|
||||
protected T BoundValue
|
||||
{
|
||||
get => _boundValue;
|
||||
set
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(_boundValue, value))
|
||||
return;
|
||||
_boundValue = value;
|
||||
|
||||
try
|
||||
{
|
||||
this.SetPropertyValue(_propertyName, value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"Error setting property:{_propertyName} : {value}");
|
||||
Debug.WriteLine(ex);
|
||||
}
|
||||
}
|
||||
set => SetValue (ref _boundValue, value, _propertyName);
|
||||
}
|
||||
|
||||
protected void SetValue<T> (ref T currentValue, T newValue, [CallerMemberName] string propertyName = "")
|
||||
|
@ -52,11 +29,28 @@ namespace HotUI
|
|||
State.SetValue (ref currentValue, newValue, this , propertyName);
|
||||
}
|
||||
|
||||
protected override void WillUpdateView ()
|
||||
{
|
||||
base.WillUpdateView ();
|
||||
|
||||
if (_binding?.Get != null && State != null)
|
||||
{
|
||||
State.StartProperty();
|
||||
var value = _binding.Get.Invoke ();
|
||||
var props = State.EndProperty ();
|
||||
var propCount = props.Length;
|
||||
if (propCount > 0)
|
||||
State.BindingState.AddViewProperty(props,this,nameof(BoundValue)) ;
|
||||
|
||||
BoundValue = value;
|
||||
}
|
||||
}
|
||||
protected override void ViewPropertyChanged(string property, object value)
|
||||
{
|
||||
if(property == nameof(BoundValue) || property == _propertyName)
|
||||
if(property == nameof(BoundValue))
|
||||
{
|
||||
BoundValue = _binding.Get.Invoke();
|
||||
return;
|
||||
}
|
||||
base.ViewPropertyChanged(property, value);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace HotUI
|
|||
view.BindingPropertyChanged(propertyName, newValue);
|
||||
}
|
||||
|
||||
public static T Cast<T>(this object val)
|
||||
static T Cast<T>(this object val)
|
||||
{
|
||||
if (val == null)
|
||||
return default;
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace HotUI
|
|||
{
|
||||
private readonly Action<T>[] _actions;
|
||||
|
||||
public MulticastAction(Binding<T> binding, Action<T> action) : this((v)=> binding?.Set(v), action)
|
||||
public MulticastAction(Binding<T> binding, Action<T> action) : this(binding?.Set, action)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ namespace HotUI {
|
|||
public static implicit operator Action<T>(State<T> state) => value => state.Value = value;
|
||||
public static implicit operator State<T>(T value) => new State<T>(value);
|
||||
|
||||
public static implicit operator Binding<T>(State<T> state) => new Binding<T>(
|
||||
getValue: () => state.Value,
|
||||
setValue: state);
|
||||
}
|
||||
|
||||
public class StateBuilder : IDisposable {
|
||||
|
@ -62,11 +65,5 @@ namespace HotUI {
|
|||
{
|
||||
return parent?.GetPropertyValue(property) ?? this.GetPropertyValue (property);
|
||||
}
|
||||
|
||||
internal void SetChildrenValue<T>(string property, T value)
|
||||
{
|
||||
parent?.SetDeepPropertyValue(property, value);
|
||||
parent?.BindingPropertyChanged(property, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,24 +16,6 @@ namespace HotUI.Tests {
|
|||
[Body]
|
||||
View body() => new Text(() => $"badState: {badState}");
|
||||
}
|
||||
[Fact]
|
||||
public void MagicDatabinding()
|
||||
{
|
||||
var view = new StatePage();
|
||||
TextField textField = null;
|
||||
Text text = null;
|
||||
view.Body = () => new VStack
|
||||
{
|
||||
(textField = new TextField(view.text)),
|
||||
(text = new Text(view.text)),
|
||||
};
|
||||
view.ViewHandler = new GenericViewHandler();
|
||||
|
||||
textField.OnEditingChanged("Test");
|
||||
Assert.Equal(textField.Text, "Test");
|
||||
Assert.Equal(text.Value, "Test");
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StateTRequiresReadonly()
|
||||
|
|
Загрузка…
Ссылка в новой задаче