From 6a470840d9c4e7682e6d75db75adca96d06222e4 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Fri, 7 Feb 2020 09:49:57 +0100 Subject: [PATCH] mono-examples: Adapt to latest syntax (EventArgs.arg -> Arg) Also workaround some temporary inability to set struct members. --- apps/csharp/calculator/src/calculator.cs | 2 +- apps/csharp/life/src/life_main.cs | 13 +++++-------- apps/csharp/life/src/life_render.cs | 10 ++-------- apps/csharp/mvvm-example/src/mvvm_basic.cs | 2 +- apps/csharp/texteditor/src/texteditor_main.cs | 2 +- reference/csharp/ui/src/focus_main.cs | 2 +- reference/csharp/ui/src/ui_container.cs | 2 +- reference/csharp/ui/src/ui_custom_widget.cs | 2 +- reference/csharp/ui/src/ui_sizing.cs | 2 +- tutorial/csharp/hello-gui/src/gui_main.cs | 2 +- tutorial/csharp/hello-world/src/hello-world.cs | 2 +- 11 files changed, 16 insertions(+), 25 deletions(-) diff --git a/apps/csharp/calculator/src/calculator.cs b/apps/csharp/calculator/src/calculator.cs index 933f3dc5..725dacd1 100644 --- a/apps/csharp/calculator/src/calculator.cs +++ b/apps/csharp/calculator/src/calculator.cs @@ -14,7 +14,7 @@ public class Calculator : Efl.Csharp.Application // Quits the application private void GUIQuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ea) { - if (ea.arg == false) + if (ea.Arg == false) Efl.App.AppMain.Quit(0); } diff --git a/apps/csharp/life/src/life_main.cs b/apps/csharp/life/src/life_main.cs index ebfc8798..dc1a4d64 100644 --- a/apps/csharp/life/src/life_main.cs +++ b/apps/csharp/life/src/life_main.cs @@ -14,14 +14,14 @@ public class LifeWindow : Efl.Csharp.Application void QuitEvent(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ev) { // quit the mainloop - if (ev.arg == false) + if (ev.Arg == false) Efl.App.AppMain.Quit(0); } void TouchEvent(object sender, Efl.Input.InterfacePointerDownEventArgs ev) { int cellx, celly; - var position = ev.arg.GetPosition(); + var position = ev.Arg.GetPosition(); lifeRender.CellForCoords(win, position, out cellx, out celly); int i = LifeBoard.IndexForPosition(cellx, celly); @@ -31,7 +31,7 @@ public class LifeWindow : Efl.Csharp.Application void KeyDownEvent(object sender, Efl.Input.InterfaceKeyDownEventArgs ev) { - if (ev.arg.GetKeySym() == "space") + if (ev.Arg.GetKeySym() == "space") lifeBoard.TogglePause(win); } @@ -44,10 +44,6 @@ public class LifeWindow : Efl.Csharp.Application // when the user clicks "close" on a window there is a request to hide ((Efl.Gfx.IEntity)win).VisibilityChangedEvent += QuitEvent; - Eina.Size2D sz; - sz.W = (int)(10 * LifeBoard.Width * win.GetScale()); - sz.H = (int)(10 * LifeBoard.Height * win.GetScale()); - lifeBoard = new LifeBoard(); lifeRender = new LifeRender(win, lifeBoard); lifeRender.Refresh(win); @@ -56,7 +52,8 @@ public class LifeWindow : Efl.Csharp.Application ((Efl.Input.IInterface)win).PointerDownEvent += TouchEvent; ((Efl.Input.IInterface)win).KeyDownEvent += KeyDownEvent; - win.SetSize(sz); + win.SetSize(new Eina.Size2D((int)(10 * LifeBoard.Width * win.GetScale()), + (int)(10 * LifeBoard.Height * win.GetScale()))); lifeBoard.Run(win); } diff --git a/apps/csharp/life/src/life_render.cs b/apps/csharp/life/src/life_render.cs index 6592aeb7..155c87a0 100644 --- a/apps/csharp/life/src/life_render.cs +++ b/apps/csharp/life/src/life_render.cs @@ -39,15 +39,9 @@ public class LifeRender var rect = lifeCells[LifeBoard.IndexForPosition(x, y)]; // the little +1 here will avoid tearing as we layout non-multiple sizes - Eina.Size2D sz; - sz.W = (int)(cw + 1); - sz.H = (int)(ch + 1); - rect.SetSize(sz); + rect.SetSize(new Eina.Size2D((int)(cw + 1), (int)(ch + 1))); - Eina.Position2D pos; - pos.X = (int)(x * cw); - pos.Y = (int)(y * ch); - rect.SetPosition(pos); + rect.SetPosition(new Eina.Position2D((int)(x * cw), (int)(y * ch))); } } diff --git a/apps/csharp/mvvm-example/src/mvvm_basic.cs b/apps/csharp/mvvm-example/src/mvvm_basic.cs index cd3fdd50..f75af64e 100644 --- a/apps/csharp/mvvm-example/src/mvvm_basic.cs +++ b/apps/csharp/mvvm-example/src/mvvm_basic.cs @@ -55,7 +55,7 @@ class Application : Efl.Csharp.Application void QuitEvt(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ev) { - if (ev.arg == false) + if (ev.Arg == false) { Efl.App.AppMain.Quit(0); } diff --git a/apps/csharp/texteditor/src/texteditor_main.cs b/apps/csharp/texteditor/src/texteditor_main.cs index 339441bd..c8f0b802 100644 --- a/apps/csharp/texteditor/src/texteditor_main.cs +++ b/apps/csharp/texteditor/src/texteditor_main.cs @@ -34,7 +34,7 @@ public class TextEditor : Efl.Csharp.Application // Quits the application private void GUIQuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ea) { - if (ea.arg == false) + if (ea.Arg == false) Efl.App.AppMain.Quit(0); } diff --git a/reference/csharp/ui/src/focus_main.cs b/reference/csharp/ui/src/focus_main.cs index 20fcf9b0..5bc6ace2 100644 --- a/reference/csharp/ui/src/focus_main.cs +++ b/reference/csharp/ui/src/focus_main.cs @@ -15,7 +15,7 @@ public class Example : Efl.Csharp.Application win.SetAutohide(true); win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => { // Exit the EFL main loop - if (e.arg == false) + if (e.Arg == false) Efl.Ui.Config.Exit(); }; diff --git a/reference/csharp/ui/src/ui_container.cs b/reference/csharp/ui/src/ui_container.cs index f52a5bdb..61f48ad0 100644 --- a/reference/csharp/ui/src/ui_container.cs +++ b/reference/csharp/ui/src/ui_container.cs @@ -65,7 +65,7 @@ public class Example : Efl.Csharp.Application win.SetAutohide(true); win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => { // Exit the EFL main loop - if (e.arg == false) + if (e.Arg == false) Efl.Ui.Config.Exit(); }; // Give the window an initial size so there is room to resize the panes. diff --git a/reference/csharp/ui/src/ui_custom_widget.cs b/reference/csharp/ui/src/ui_custom_widget.cs index 0907c47f..978b8ac5 100644 --- a/reference/csharp/ui/src/ui_custom_widget.cs +++ b/reference/csharp/ui/src/ui_custom_widget.cs @@ -38,7 +38,7 @@ public class Example : Efl.Csharp.Application win.SetAutohide(true); win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => { // Exit the EFL main loop when the window is closed - if (e.arg == false) + if (e.Arg == false) Efl.Ui.Config.Exit(); }; // Give the window an initial size diff --git a/reference/csharp/ui/src/ui_sizing.cs b/reference/csharp/ui/src/ui_sizing.cs index 5749d2b1..e875f1d9 100644 --- a/reference/csharp/ui/src/ui_sizing.cs +++ b/reference/csharp/ui/src/ui_sizing.cs @@ -18,7 +18,7 @@ public class Example : Efl.Csharp.Application win.SetAutohide(true); win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => { // Exit the EFL main loop - if (e.arg == false) + if (e.Arg == false) Efl.Ui.Config.Exit(); }; diff --git a/tutorial/csharp/hello-gui/src/gui_main.cs b/tutorial/csharp/hello-gui/src/gui_main.cs index 235de800..caa8064b 100644 --- a/tutorial/csharp/hello-gui/src/gui_main.cs +++ b/tutorial/csharp/hello-gui/src/gui_main.cs @@ -6,7 +6,7 @@ public class Example : Efl.Csharp.Application public static void QuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) { // Exit the EFL main loop - if (e.arg == false) + if (e.Arg == false) Efl.App.AppMain.Quit(0); } diff --git a/tutorial/csharp/hello-world/src/hello-world.cs b/tutorial/csharp/hello-world/src/hello-world.cs index 2eac0bfe..f99e55ad 100644 --- a/tutorial/csharp/hello-world/src/hello-world.cs +++ b/tutorial/csharp/hello-world/src/hello-world.cs @@ -6,7 +6,7 @@ public class Example : Efl.Csharp.Application public static void QuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) { // Exit the EFL main loop - if (e.arg == false) + if (e.Arg == false) Efl.App.AppMain.Quit(0); }