From 0228d4f6ba604d41fbb7885bb85f31acc20471d7 Mon Sep 17 00:00:00 2001
From: Andrea Ciotti <a.ciotti@nanosystems.it>
Date: Fri, 29 Mar 2019 15:21:53 +0100
Subject: [PATCH 1/2] Added the Execute method declaration on IgoView interface
 and implemented it in TgoFormView (VCL+FMX) and TgoViewProxy. It executes the
 view in a non-modal way.

---
 Grijjy.Mvvm.Types.pas       | 3 +++
 Grijjy.Mvvm.ViewFactory.pas | 7 +++++++
 Grijjy.Mvvm.Views.Fmx.pas   | 8 ++++++++
 Grijjy.Mvvm.Views.Vcl.pas   | 8 ++++++++
 4 files changed, 26 insertions(+)

diff --git a/Grijjy.Mvvm.Types.pas b/Grijjy.Mvvm.Types.pas
index 6501859..1a6c82a 100644
--- a/Grijjy.Mvvm.Types.pas
+++ b/Grijjy.Mvvm.Types.pas
@@ -461,6 +461,9 @@   TgoMultiCastEvent<T> = class(TInterfacedObject, IgoMultiCastEvent<T>)
   { Base interface for the generic IgoView<TVM> version }
   IgoView = interface
   ['{5EF31C67-EB85-48EB-A390-8097DB0EFED2}']
+    { Executes the view }
+    procedure Execute;
+
     { Executes the view in a modal way.
 
       Parameters:
diff --git a/Grijjy.Mvvm.ViewFactory.pas b/Grijjy.Mvvm.ViewFactory.pas
index 6476ea6..db40866 100644
--- a/Grijjy.Mvvm.ViewFactory.pas
+++ b/Grijjy.Mvvm.ViewFactory.pas
@@ -90,6 +90,7 @@     TViewFreeListener = class(TComponent)
     FViewFreeListener: TViewFreeListener;
   protected
     { IgoView }
+    procedure Execute;
     procedure ExecuteModal(const AResultProc: TProc<TModalResult>);
   protected
     { IgoView<TVM> }
@@ -126,6 +127,12 @@ destructor TgoViewProxy<TVM>.Destroy;
   inherited;
 end;
 
+procedure TgoViewProxy<TVM>.Execute;
+begin
+  if Assigned(FViewFreeListener.ActualView) then
+    FViewFreeListener.ActualView.Execute;
+end;
+
 procedure TgoViewProxy<TVM>.ExecuteModal(const AResultProc: TProc<TModalResult>);
 begin
   if Assigned(FViewFreeListener.ActualView) then
diff --git a/Grijjy.Mvvm.Views.Fmx.pas b/Grijjy.Mvvm.Views.Fmx.pas
index 900411b..398348a 100644
--- a/Grijjy.Mvvm.Views.Fmx.pas
+++ b/Grijjy.Mvvm.Views.Fmx.pas
@@ -74,6 +74,9 @@   TgoFormView<TVM: class> = class(TForm, IgoView, IgoView<TVM>)
       any data bindings. }
     procedure InitView(const AViewModel: TVM; const AOwnsViewModel: Boolean);
 
+    { Executes the view }
+    procedure Execute;
+
     { Executes the view in a modal way.
 
       Parameters:
@@ -146,6 +149,11 @@ procedure TgoFormView<TVM>.DoClose(var CloseAction: TCloseAction);
   {$ENDIF}
 end;
 
+procedure TgoFormView<TVM>.Execute;
+begin
+  Show;
+end;
+
 procedure TgoFormView<TVM>.ExecuteModal(const AResultProc: TProc<TModalResult>);
 {$IFNDEF ANDROID}
 var
diff --git a/Grijjy.Mvvm.Views.Vcl.pas b/Grijjy.Mvvm.Views.Vcl.pas
index 86565fc..68313f4 100644
--- a/Grijjy.Mvvm.Views.Vcl.pas
+++ b/Grijjy.Mvvm.Views.Vcl.pas
@@ -55,6 +55,9 @@   TgoFormView<TVM: class> = class(TForm, IgoView, IgoView<TVM>)
       Should usually be overridden to set up the data bindings. }
     procedure InitView(const AViewModel: TVM; const AOwnsViewModel: Boolean);
 
+    { Executes the view }
+    procedure Execute;
+
     { Executes the view in a modal way.
 
       Parameters:
@@ -98,6 +101,11 @@ procedure TgoFormView<TVM>.DoClose(var Action: TCloseAction);
   inherited;
 end;
 
+procedure TgoFormView<TVM>.Execute;
+begin
+  Show;
+end;
+
 procedure TgoFormView<TVM>.ExecuteModal(const AResultProc: TProc<TModalResult>);
 var
   Result: TModalResult;

From 118ac998cef5c6411c8b87b32e4347bcb6c3487a Mon Sep 17 00:00:00 2001
From: Andrea Ciotti <a.ciotti@nanosystems.it>
Date: Mon, 13 Jan 2020 09:30:32 +0100
Subject: [PATCH 2/2] Added GetStyle function on TgoDataTemplate (at the moment
 is only used on ListBoxItem)

---
 Grijjy.Mvvm.Controls.Fmx.pas | 1 +
 Grijjy.Mvvm.Types.pas        | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/Grijjy.Mvvm.Controls.Fmx.pas b/Grijjy.Mvvm.Controls.Fmx.pas
index c98c85d..a2dc05f 100644
--- a/Grijjy.Mvvm.Controls.Fmx.pas
+++ b/Grijjy.Mvvm.Controls.Fmx.pas
@@ -1222,6 +1222,7 @@ procedure TListBoxCollectionView.UpdateListBoxItem(
   AListBoxItem.ItemData.Detail := Template.GetDetail(AItem);
   AListBoxItem.ImageIndex := Template.GetImageIndex(AItem);
   AListBoxItem.Data := AItem;
+  AListBoxItem.StyleLookup := Template.GetStyle(AItem);
 end;
 
 { TListView }
diff --git a/Grijjy.Mvvm.Types.pas b/Grijjy.Mvvm.Types.pas
index 1a6c82a..77c1a1b 100644
--- a/Grijjy.Mvvm.Types.pas
+++ b/Grijjy.Mvvm.Types.pas
@@ -338,6 +338,7 @@   TgoDataTemplate = class abstract
 
       Returns -1 by default. }
     class function GetImageIndex(const AItem: TObject): Integer; virtual;
+    class function GetStyle(const AItem: TObject): string; virtual;
   end;
   TgoDataTemplateClass = class of TgoDataTemplate;
 
@@ -651,6 +652,11 @@ class function TgoDataTemplate.GetImageIndex(const AItem: TObject): Integer;
   Result := -1;
 end;
 
+class function TgoDataTemplate.GetStyle(const AItem: TObject): string;
+begin
+  Result := '';
+end;
+
 { TgoValueConverter }
 
 class function TgoValueConverter.ConvertTargetToSource(