summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2020-02-07 09:49:57 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2020-02-07 09:49:57 +0100
commit6a470840d9c4e7682e6d75db75adca96d06222e4 (patch)
tree47c7bd12a68c086a40d36da03e31825ba99294b3
parentdfa678e9dc6d4473dda854c5671e28a28465b3d4 (diff)
mono-examples: Adapt to latest syntax (EventArgs.arg -> Arg)
Also workaround some temporary inability to set struct members.
-rw-r--r--apps/csharp/calculator/src/calculator.cs2
-rw-r--r--apps/csharp/life/src/life_main.cs13
-rw-r--r--apps/csharp/life/src/life_render.cs10
-rw-r--r--apps/csharp/mvvm-example/src/mvvm_basic.cs2
-rw-r--r--apps/csharp/texteditor/src/texteditor_main.cs2
-rw-r--r--reference/csharp/ui/src/focus_main.cs2
-rw-r--r--reference/csharp/ui/src/ui_container.cs2
-rw-r--r--reference/csharp/ui/src/ui_custom_widget.cs2
-rw-r--r--reference/csharp/ui/src/ui_sizing.cs2
-rw-r--r--tutorial/csharp/hello-gui/src/gui_main.cs2
-rw-r--r--tutorial/csharp/hello-world/src/hello-world.cs2
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
14 // Quits the application 14 // Quits the application
15 private void GUIQuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ea) 15 private void GUIQuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ea)
16 { 16 {
17 if (ea.arg == false) 17 if (ea.Arg == false)
18 Efl.App.AppMain.Quit(0); 18 Efl.App.AppMain.Quit(0);
19 } 19 }
20 20
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
14 void QuitEvent(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ev) 14 void QuitEvent(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ev)
15 { 15 {
16 // quit the mainloop 16 // quit the mainloop
17 if (ev.arg == false) 17 if (ev.Arg == false)
18 Efl.App.AppMain.Quit(0); 18 Efl.App.AppMain.Quit(0);
19 } 19 }
20 20
21 void TouchEvent(object sender, Efl.Input.InterfacePointerDownEventArgs ev) 21 void TouchEvent(object sender, Efl.Input.InterfacePointerDownEventArgs ev)
22 { 22 {
23 int cellx, celly; 23 int cellx, celly;
24 var position = ev.arg.GetPosition(); 24 var position = ev.Arg.GetPosition();
25 lifeRender.CellForCoords(win, position, out cellx, out celly); 25 lifeRender.CellForCoords(win, position, out cellx, out celly);
26 26
27 int i = LifeBoard.IndexForPosition(cellx, celly); 27 int i = LifeBoard.IndexForPosition(cellx, celly);
@@ -31,7 +31,7 @@ public class LifeWindow : Efl.Csharp.Application
31 31
32 void KeyDownEvent(object sender, Efl.Input.InterfaceKeyDownEventArgs ev) 32 void KeyDownEvent(object sender, Efl.Input.InterfaceKeyDownEventArgs ev)
33 { 33 {
34 if (ev.arg.GetKeySym() == "space") 34 if (ev.Arg.GetKeySym() == "space")
35 lifeBoard.TogglePause(win); 35 lifeBoard.TogglePause(win);
36 } 36 }
37 37
@@ -44,10 +44,6 @@ public class LifeWindow : Efl.Csharp.Application
44 // when the user clicks "close" on a window there is a request to hide 44 // when the user clicks "close" on a window there is a request to hide
45 ((Efl.Gfx.IEntity)win).VisibilityChangedEvent += QuitEvent; 45 ((Efl.Gfx.IEntity)win).VisibilityChangedEvent += QuitEvent;
46 46
47 Eina.Size2D sz;
48 sz.W = (int)(10 * LifeBoard.Width * win.GetScale());
49 sz.H = (int)(10 * LifeBoard.Height * win.GetScale());
50
51 lifeBoard = new LifeBoard(); 47 lifeBoard = new LifeBoard();
52 lifeRender = new LifeRender(win, lifeBoard); 48 lifeRender = new LifeRender(win, lifeBoard);
53 lifeRender.Refresh(win); 49 lifeRender.Refresh(win);
@@ -56,7 +52,8 @@ public class LifeWindow : Efl.Csharp.Application
56 ((Efl.Input.IInterface)win).PointerDownEvent += TouchEvent; 52 ((Efl.Input.IInterface)win).PointerDownEvent += TouchEvent;
57 ((Efl.Input.IInterface)win).KeyDownEvent += KeyDownEvent; 53 ((Efl.Input.IInterface)win).KeyDownEvent += KeyDownEvent;
58 54
59 win.SetSize(sz); 55 win.SetSize(new Eina.Size2D((int)(10 * LifeBoard.Width * win.GetScale()),
56 (int)(10 * LifeBoard.Height * win.GetScale())));
60 57
61 lifeBoard.Run(win); 58 lifeBoard.Run(win);
62 } 59 }
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
39 var rect = lifeCells[LifeBoard.IndexForPosition(x, y)]; 39 var rect = lifeCells[LifeBoard.IndexForPosition(x, y)];
40 40
41 // the little +1 here will avoid tearing as we layout non-multiple sizes 41 // the little +1 here will avoid tearing as we layout non-multiple sizes
42 Eina.Size2D sz; 42 rect.SetSize(new Eina.Size2D((int)(cw + 1), (int)(ch + 1)));
43 sz.W = (int)(cw + 1);
44 sz.H = (int)(ch + 1);
45 rect.SetSize(sz);
46 43
47 Eina.Position2D pos; 44 rect.SetPosition(new Eina.Position2D((int)(x * cw), (int)(y * ch)));
48 pos.X = (int)(x * cw);
49 pos.Y = (int)(y * ch);
50 rect.SetPosition(pos);
51 } 45 }
52 } 46 }
53 47
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
55 55
56 void QuitEvt(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ev) 56 void QuitEvt(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ev)
57 { 57 {
58 if (ev.arg == false) 58 if (ev.Arg == false)
59 { 59 {
60 Efl.App.AppMain.Quit(0); 60 Efl.App.AppMain.Quit(0);
61 } 61 }
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
34 // Quits the application 34 // Quits the application
35 private void GUIQuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ea) 35 private void GUIQuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs ea)
36 { 36 {
37 if (ea.arg == false) 37 if (ea.Arg == false)
38 Efl.App.AppMain.Quit(0); 38 Efl.App.AppMain.Quit(0);
39 } 39 }
40 40
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
15 win.SetAutohide(true); 15 win.SetAutohide(true);
16 win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => { 16 win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => {
17 // Exit the EFL main loop 17 // Exit the EFL main loop
18 if (e.arg == false) 18 if (e.Arg == false)
19 Efl.Ui.Config.Exit(); 19 Efl.Ui.Config.Exit();
20 }; 20 };
21 21
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
65 win.SetAutohide(true); 65 win.SetAutohide(true);
66 win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => { 66 win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => {
67 // Exit the EFL main loop 67 // Exit the EFL main loop
68 if (e.arg == false) 68 if (e.Arg == false)
69 Efl.Ui.Config.Exit(); 69 Efl.Ui.Config.Exit();
70 }; 70 };
71 // Give the window an initial size so there is room to resize the panes. 71 // 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
38 win.SetAutohide(true); 38 win.SetAutohide(true);
39 win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => { 39 win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => {
40 // Exit the EFL main loop when the window is closed 40 // Exit the EFL main loop when the window is closed
41 if (e.arg == false) 41 if (e.Arg == false)
42 Efl.Ui.Config.Exit(); 42 Efl.Ui.Config.Exit();
43 }; 43 };
44 // Give the window an initial size 44 // 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
18 win.SetAutohide(true); 18 win.SetAutohide(true);
19 win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => { 19 win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => {
20 // Exit the EFL main loop 20 // Exit the EFL main loop
21 if (e.arg == false) 21 if (e.Arg == false)
22 Efl.Ui.Config.Exit(); 22 Efl.Ui.Config.Exit();
23 }; 23 };
24 24
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
6 public static void QuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) 6 public static void QuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e)
7 { 7 {
8 // Exit the EFL main loop 8 // Exit the EFL main loop
9 if (e.arg == false) 9 if (e.Arg == false)
10 Efl.App.AppMain.Quit(0); 10 Efl.App.AppMain.Quit(0);
11 } 11 }
12 12
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
6 public static void QuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) 6 public static void QuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e)
7 { 7 {
8 // Exit the EFL main loop 8 // Exit the EFL main loop
9 if (e.arg == false) 9 if (e.Arg == false)
10 Efl.App.AppMain.Quit(0); 10 Efl.App.AppMain.Quit(0);
11 } 11 }
12 12