From b5cc8b1e466a552a309647373d335444c8b64401 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicol=C3=A1s=20Dimov?= Date: Sun, 19 Jun 2005 02:05:51 +0000 Subject: [PATCH] From Gazer : * Inicio un ABM Generico usando Reflection para ahorrar el tiempo de hacer 1 ABM por cada clase simple. Esto serviria para : - Planes - Promotores - Zonas - Caps * Algunos fixes menores en otros lados. --- demo/glade/abm_generico.glade | 229 ++++++++++++++++++++++++++++ demo/src/Main.cs | 4 + demo/src/Vistas/ABMGenerico.cs | 39 +++++ demo/src/Vistas/RegistrarVisitas.cs | 17 +++ 4 files changed, 289 insertions(+) create mode 100644 demo/glade/abm_generico.glade create mode 100644 demo/src/Vistas/ABMGenerico.cs diff --git a/demo/glade/abm_generico.glade b/demo/glade/abm_generico.glade new file mode 100644 index 0000000..83d3b7a --- /dev/null +++ b/demo/glade/abm_generico.glade @@ -0,0 +1,229 @@ + + + + + + + True + Dirección + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 12 + True + 7 + 2 + False + 8 + 8 + + + 0 + True + True + + + + + + + + True + Planes + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + -7 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 12 + True + False + 0 + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_DEFAULT_STYLE + 0 + + + + True + True + True + gtk-delete + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-edit + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-add + True + GTK_RELIEF_NORMAL + True + + + + + + 0 + False + True + + + + + 0 + True + True + + + + + + + diff --git a/demo/src/Main.cs b/demo/src/Main.cs index af31ee8..806420e 100644 --- a/demo/src/Main.cs +++ b/demo/src/Main.cs @@ -52,6 +52,10 @@ public class App public void OnRegistrarVisitas (object o, EventArgs args) { + /*Plan p = new Plan (1); + ABMGenerico g = new ABMGenerico (p.GetType()); + g.Run (); + return;*/ VRegistrarVisitas v = new VRegistrarVisitas (); v.Run (); } diff --git a/demo/src/Vistas/ABMGenerico.cs b/demo/src/Vistas/ABMGenerico.cs new file mode 100644 index 0000000..3471b20 --- /dev/null +++ b/demo/src/Vistas/ABMGenerico.cs @@ -0,0 +1,39 @@ + +using System; +using System.Reflection; +using System.Collections; +using Gtk; +using Glade; + +public class ABMGenerico +{ + Glade.XML xml; + [Widget] Table tabla; + + public ABMGenerico (Type objectType) + { + PropertyInfo[] properties = objectType.GetProperties (); + + xml = new Glade.XML (null, "abm_generico.glade", "abm_one", null); + xml.Autoconnect (this); + + uint i=0; + foreach( PropertyInfo mf in properties ) { + Label l = new Label (mf.Name + " : "); + Entry e = new Entry (); + tabla.Attach (l, 0, 1, i, i+1); + tabla.Attach (e, 1, 2, i, i+1); + l.Show (); + e.Show (); + i++; + } + } + + public void Run () + { + Dialog w = (Dialog)xml.GetWidget ("abm_one"); + w.Run (); + w.Destroy (); + } +} + diff --git a/demo/src/Vistas/RegistrarVisitas.cs b/demo/src/Vistas/RegistrarVisitas.cs index 83d4e7b..079aeae 100644 --- a/demo/src/Vistas/RegistrarVisitas.cs +++ b/demo/src/Vistas/RegistrarVisitas.cs @@ -75,6 +75,23 @@ public class VRegistrarVisitas /* Nada seleccionado */ return; } + + /* Confirmo la operacion */ + MessageDialog md = new MessageDialog ( + null, + DialogFlags.DestroyWithParent, + MessageType.Question, + ButtonsType.YesNo, "Esta seguro de quere eliminar el solicitante?" + ); + + ResponseType result = (ResponseType)md.Run (); + + if (result == ResponseType.No) { + md.Destroy (); + return; + } + md.Destroy (); + ETipoDocumento tipoDoc; int nroDoc; tipoDoc = (ETipoDocumento)Enum.Parse (typeof (ETipoDocumento), (string)store.GetValue (iter, 0), true); -- 2.43.0