Skip to content

Commit

Permalink
Fix #45 : Modified Generator to Reference Properties updates NOT Upda…
Browse files Browse the repository at this point in the history
…teIncremental when types of Old and New object differs
  • Loading branch information
gibranrosa committed May 17, 2018
1 parent 4899cce commit 50803d4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
24 changes: 16 additions & 8 deletions Elmish.XamarinForms/DynamicXaml.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3588,8 +3588,9 @@ type Xaml() =
match prevChildOpt, source.TryContent with
// For structured objects, dependsOn on reference equality
| USome prevChild, USome newChild when System.Object.ReferenceEquals(prevChild, newChild) -> ()
| USome prevChild, USome newChild ->
| USome prevChild, USome newChild when prevChild.TargetType = newChild.TargetType ->
newChild.UpdateIncremental(prevChild, target.Content)
| USome _, USome newChild
| UNone, USome newChild ->
target.Content <- newChild.CreateAsView()
| USome _, UNone ->
Expand Down Expand Up @@ -6215,8 +6216,9 @@ type Xaml() =
match prevChildOpt, source.TryContent with
// For structured objects, dependsOn on reference equality
| USome prevChild, USome newChild when System.Object.ReferenceEquals(prevChild, newChild) -> ()
| USome prevChild, USome newChild ->
| USome prevChild, USome newChild when prevChild.TargetType = newChild.TargetType ->
newChild.UpdateIncremental(prevChild, target.Content)
| USome _, USome newChild
| UNone, USome newChild ->
target.Content <- newChild.CreateAsView()
| USome _, UNone ->
Expand Down Expand Up @@ -7175,8 +7177,9 @@ type Xaml() =
match prevChildOpt, source.TryContent with
// For structured objects, dependsOn on reference equality
| USome prevChild, USome newChild when System.Object.ReferenceEquals(prevChild, newChild) -> ()
| USome prevChild, USome newChild ->
| USome prevChild, USome newChild when prevChild.TargetType = newChild.TargetType ->
newChild.UpdateIncremental(prevChild, target.Content)
| USome _, USome newChild
| UNone, USome newChild ->
target.Content <- newChild.CreateAsView()
| USome _, UNone ->
Expand Down Expand Up @@ -9966,8 +9969,9 @@ type Xaml() =
match prevChildOpt, source.TryCurrentPage with
// For structured objects, dependsOn on reference equality
| USome prevChild, USome newChild when System.Object.ReferenceEquals(prevChild, newChild) -> ()
| USome prevChild, USome newChild ->
| USome prevChild, USome newChild when prevChild.TargetType = newChild.TargetType ->
newChild.UpdateIncremental(prevChild, target.CurrentPage)
| USome _, USome newChild
| UNone, USome newChild ->
target.CurrentPage <- newChild.CreateAsContentPage()
| USome _, UNone ->
Expand Down Expand Up @@ -10653,8 +10657,9 @@ type Xaml() =
match prevChildOpt, source.TryContent with
// For structured objects, dependsOn on reference equality
| USome prevChild, USome newChild when System.Object.ReferenceEquals(prevChild, newChild) -> ()
| USome prevChild, USome newChild ->
| USome prevChild, USome newChild when prevChild.TargetType = newChild.TargetType ->
newChild.UpdateIncremental(prevChild, target.Content)
| USome _, USome newChild
| UNone, USome newChild ->
target.Content <- newChild.CreateAsView()
| USome _, UNone ->
Expand Down Expand Up @@ -10864,8 +10869,9 @@ type Xaml() =
match prevChildOpt, source.TryMaster with
// For structured objects, dependsOn on reference equality
| USome prevChild, USome newChild when System.Object.ReferenceEquals(prevChild, newChild) -> ()
| USome prevChild, USome newChild ->
| USome prevChild, USome newChild when prevChild.TargetType = newChild.TargetType ->
newChild.UpdateIncremental(prevChild, target.Master)
| USome _, USome newChild
| UNone, USome newChild ->
target.Master <- newChild.CreateAsPage()
| USome _, UNone ->
Expand All @@ -10875,8 +10881,9 @@ type Xaml() =
match prevChildOpt, source.TryDetail with
// For structured objects, dependsOn on reference equality
| USome prevChild, USome newChild when System.Object.ReferenceEquals(prevChild, newChild) -> ()
| USome prevChild, USome newChild ->
| USome prevChild, USome newChild when prevChild.TargetType = newChild.TargetType ->
newChild.UpdateIncremental(prevChild, target.Detail)
| USome _, USome newChild
| UNone, USome newChild ->
target.Detail <- newChild.CreateAsPage()
| USome _, UNone ->
Expand Down Expand Up @@ -11321,8 +11328,9 @@ type Xaml() =
match prevChildOpt, source.TryView with
// For structured objects, dependsOn on reference equality
| USome prevChild, USome newChild when System.Object.ReferenceEquals(prevChild, newChild) -> ()
| USome prevChild, USome newChild ->
| USome prevChild, USome newChild when prevChild.TargetType = newChild.TargetType ->
newChild.UpdateIncremental(prevChild, target.View)
| USome _, USome newChild
| UNone, USome newChild ->
target.View <- newChild.CreateAsView()
| USome _, UNone ->
Expand Down
5 changes: 3 additions & 2 deletions Generator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ static int Main(string[] args)
try {
if (args.Length < 2)
{
Console.Error.WriteLine("usage: generator <outputPath>");
Console.Error.WriteLine("usage: generator <bindingsPath> <outputPath>");
Environment.Exit(1);
}
var bindingsPath = args[0];
Expand Down Expand Up @@ -497,8 +497,9 @@ static string BindTypes (Bindings bindings)
w.WriteLine($" match prevChildOpt, source.Try{m.BoundUniqueName} with");
w.WriteLine($" // For structured objects, dependsOn on reference equality");
w.WriteLine($" | USome prevChild, USome newChild when System.Object.ReferenceEquals(prevChild, newChild) -> ()");
w.WriteLine($" | USome prevChild, USome newChild ->");
w.WriteLine($" | USome prevChild, USome newChild when prevChild.TargetType = newChild.TargetType ->");
w.WriteLine($" newChild.UpdateIncremental(prevChild, target.{m.Name})");
w.WriteLine($" | USome _, USome newChild");
w.WriteLine($" | UNone, USome newChild ->");
w.WriteLine($" target.{m.Name} <- newChild.CreateAs{bt.Name}()");
w.WriteLine($" | USome _, UNone ->");
Expand Down

0 comments on commit 50803d4

Please sign in to comment.