本文整理汇总了C#中Gtk.Dialog.AddButton方法的典型用法代码示例。如果您正苦于以下问题:C# Dialog.AddButton方法的具体用法?C# Dialog.AddButton怎么用?C# Dialog.AddButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Dialog
的用法示例。
在下文中一共展示了Dialog.AddButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Agregar
void Agregar( object o, EventArgs args )
{
// crear dialogo
Dialog dialog = new Dialog ("Agregar", window, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.AddButton ("Aceptar", ResponseType.Ok);
dialog.AddButton ("Cerrar", ResponseType.Close);
Label lab = new Label("Información que desea agregar:");
lab.Show();
dialog.VBox.PackStart (lab , true, true, 5 );
Table table = new Table (2, 2, false);
Label labNombre = new Label("Nombre:");
labNombre.Show();
table.Attach(labNombre , 0, 1, 0, 1);
entryNombre = new Entry();
entryNombre.Show();
table.Attach(entryNombre, 1, 2, 0, 1);
Label labApe = new Label("Apellidos:");
labApe.Show();
table.Attach(labApe , 0, 1, 1, 2);
entryApe = new Entry();
entryApe.Show();
table.Attach(entryApe , 1, 2, 1, 2);
table.Show();
dialog.VBox.PackStart (table, true, true, 5 );
dialog.Response += new ResponseHandler (on_dialog_agregar);
dialog.Run ();
dialog.Destroy ();
}
示例2: OnButtonIngresarClicked
protected void OnButtonIngresarClicked(object sender, EventArgs e)
{
ControladorBaseDatos Bd = new ControladorBaseDatos();
string[] usuarioClave = new string[2];
usuarioClave = Bd.ObtenerUsuarioContraseñaBd(entryUsuario.Text);
if(usuarioClave[0].Equals(entryUsuario.Text) & usuarioClave[1].Equals(entryClave.Text))
{
//PrincipalWindow principal = new PrincipalWindow(entryUsuario.Text);
VenderProductosDialog principal = new VenderProductosDialog(entryUsuario.Text);
base.Destroy();
principal.Show();
}
else
{
Dialog dialog = new Dialog("Iniciar Sesion", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label();
etiqueta.Markup = "Usuario/Clave incorrectos";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart(etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll();
dialog.Run ();
dialog.Destroy ();
}
}
示例3: onClick
private void onClick(object Sender, EventArgs e)
{
Dialog d = new Dialog ("Test", this, DialogFlags.DestroyWithParent);
d.Modal = true;
d.AddButton ("Close", ResponseType.Close);
d.Run ();
d.Destroy ();
}
示例4: OnButtonEditarNumBoletaClicked
protected void OnButtonEditarNumBoletaClicked(object sender, EventArgs e)
{
numBoleta = this.db.ObtenerBoleta ();
if (Int32.Parse (entryNumBoleta.Text.Trim ()) > numBoleta) {
try {
Venta nuevaVenta = new Venta (Int32.Parse (entryNumBoleta.Text.Trim ()), DateTime.Now.ToString ("yyyy-MM-dd"), "0", "inicioBoletaNueva", Int32.Parse ("0"), usuario_, "false");
db.AgregarVentaBd (nuevaVenta);
entryNumBoleta.Text = "";
Dialog dialog = new Dialog ("EDITAR BOLETA", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label ();
etiqueta.Markup = "La operación ha sido realizada con éxito";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart (etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll ();
dialog.Run ();
dialog.Destroy ();
} catch (Exception ex) {
Dialog dialog = new Dialog ("EDITAR BOLETA", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label ();
etiqueta.Markup = "Ha ocurrido un error al editar boleta";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart (etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll ();
dialog.Run ();
dialog.Destroy ();
Console.WriteLine ("error editar boleta: " + ex);
}
} else {
Dialog dialog = new Dialog ("EDITAR BOLETA", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label ();
etiqueta.Markup = "La boleta ingresada es menor a la del sistema";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart (etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll ();
dialog.Run ();
dialog.Destroy ();
}
}
示例5: OnButton1Clicked
protected void OnButton1Clicked(object sender, EventArgs e)
{
dialog = new Dialog ("Sample", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.AddButton ("Close", ResponseType.Close);
dialog.Response += (o, args) => Console.WriteLine(args.ResponseId);
dialog.Run ();
dialog.Destroy ();
}
示例6: Execute
public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window)
{
// FIXME HIG-ify.
Dialog dialog = new Dialog ();
dialog.BorderWidth = 6;
dialog.TransientFor = parent_window;
dialog.HasSeparator = false;
dialog.Title = Catalog.GetString ("Really Delete?");
dialog.AddButton (Catalog.GetString ("Cancel"), (int) ResponseType.Cancel);
dialog.AddButton (Catalog.GetString ("Delete"), (int) ResponseType.Ok);
dialog.DefaultResponse = ResponseType.Ok;
string version_name = photo.GetVersion (photo.DefaultVersionId).Name;
Label label = new Label (String.Format (Catalog.GetString ("Really delete version \"{0}\"?"), version_name));
label.Show ();
dialog.VBox.PackStart (label, false, true, 6);;
if (dialog.Run () == (int) ResponseType.Ok) {
try {
photo.DeleteVersion (photo.DefaultVersionId);
store.Commit (photo);
} catch (Exception e) {
Log.DebugException (e);
string msg = Catalog.GetString ("Could not delete a version");
string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to delete version \"{1}\""),
e.Message, photo.Name);
HigMessageDialog md = new HigMessageDialog (parent_window, DialogFlags.DestroyWithParent,
Gtk.MessageType.Error, ButtonsType.Ok,
msg,
desc);
md.Run ();
md.Destroy ();
dialog.Destroy (); // Delete confirmation window.
return false;
}
dialog.Destroy ();
return true;
}
dialog.Destroy ();
return false;
}
示例7: OnButtonIngresarDineroClicked
protected void OnButtonIngresarDineroClicked(object sender, EventArgs e)
{
ControladorBaseDatos baseDatos = new ControladorBaseDatos();
try {
int boleta = baseDatos.ObtenerBoleta();
Venta nVenta = new Venta(boleta,
DateTime.Now.ToString("yyyy-MM-dd"),
entryMontoDinero.Text.Trim(),
"IngresoDineroCaja",
Int32.Parse("0"),
usuario_,
"false");
baseDatos.AgregarVentaBd(nVenta);
entryMontoDinero.Text = "";
Dialog dialog = new Dialog("INGRESAR MONTO DINERO", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label();
etiqueta.Markup = "La operación ha sido realizada con éxito";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart(etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll();
dialog.Run ();
dialog.Destroy ();
}
catch (Exception ex)
{
Dialog dialog = new Dialog("INGRESAR MONTO DINERO", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label();
etiqueta.Markup = "Ha ocurrido un error al ingresar monto dinero";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart(etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll();
dialog.Run ();
dialog.Destroy ();
Console.WriteLine("error ingresar monto: "+ex);
}
}
示例8: EditarNumBoletaDialog
public EditarNumBoletaDialog(string usuario)
{
this.usuario_ = usuario;
this.Build ();
numBoleta = this.db.ObtenerBoleta () - 1;
Dialog dialog = new Dialog ("EDITAR BOLETA", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label ();
etiqueta.Markup = "Número de boleta actual: "+numBoleta.ToString();
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart (etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll ();
dialog.Run ();
dialog.Destroy ();
}
示例9: OnBotonModificarClicked
protected void OnBotonModificarClicked(object sender, EventArgs e)
{
ControladorBaseDatos db = new ControladorBaseDatos();
try {
string [] aux = db.ObtenerusuarioAntiguoBd(entryUsuarioEdit.Text.Trim());
Usuario usuarioAntiguo = new Usuario(aux[0],aux[1],aux[2],aux[3],aux[4],aux[5],aux[6]);
Usuario usuarioNuevo = new Usuario(entryUsuarioEdit.Text.Trim(),
entryContraseñaEdit.Text.Trim(),
entryNombreEdit.Text.Trim(),
entryApellidosEdit.Text.Trim(),
entryTelefonoEdit.Text.Trim(),
entryRutEdit.Text.Trim(),
comboboxTipoUsuarioMod.ActiveText);
db.ActualizarUsuarioBd(usuarioAntiguo,usuarioNuevo);
Dialog dialog = new Dialog("USUARIO ACTUALIZADO", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label();
etiqueta.Markup = "Actualización correcta";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart(etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll();
dialog.Run ();
dialog.Destroy ();
}
catch (Exception ex)
{
Console.WriteLine("Excepcion:"+ex);
}
}
示例10: TextPrompt
public static void TextPrompt(string title, string labelText, string entryText, string buttonText,
int position, int selectStart, int selectEnd, TextPromptHandler onOk)
{
Dialog d = new Dialog();
d.Modal = false;
d.ActionArea.Layout = ButtonBoxStyle.Spread;
d.HasSeparator = false;
d.BorderWidth = 10;
d.Title = title;
Label label = new Label (labelText);
label.UseUnderline = false;
d.VBox.Add (label);
Entry e = new Entry (entryText);
e.WidthChars = Math.Min(100, e.Text.Length + 10);
e.Activated += new EventHandler (delegate { d.Respond(ResponseType.Ok); });
d.VBox.Add (e);
d.AddButton (buttonText, ResponseType.Ok);
d.Response += new ResponseHandler(delegate (object obj, ResponseArgs args) {
if (args.ResponseId == ResponseType.Ok) {
onOk(e.Text);
} else {
LogError (args.ResponseId);
}
d.Unrealize ();
d.Destroy ();
});
d.ShowAll ();
e.Position = position;
e.SelectRegion(selectStart, selectEnd);
}
示例11: OnButtonPickDatePeriodClicked
protected void OnButtonPickDatePeriodClicked(object sender, EventArgs e)
{
#region Widget creation
Window parentWin = (Window)Toplevel;
var selectDate = new Dialog ("Укажите период", parentWin, DialogFlags.DestroyWithParent);
selectDate.Modal = true;
selectDate.AddButton ("Отмена", ResponseType.Cancel);
selectDate.AddButton ("Ok", ResponseType.Ok);
periodSummary = new Label();
selectDate.VBox.Add(periodSummary);
HBox hbox = new HBox (true, 6);
StartDateCalendar = new Calendar ();
StartDateCalendar.DisplayOptions = DisplayOptions;
StartDateCalendar.Date = StartDateOrNull ?? DateTime.Today;
StartDateCalendar.DaySelected += StartDateCalendar_DaySelected;
EndDateCalendar = new Calendar ();
EndDateCalendar.DisplayOptions = DisplayOptions;
EndDateCalendar.Date = EndDateOrNull ?? DateTime.Today;
EndDateCalendar.DaySelected += EndDateCalendar_DaySelected;
hbox.Add (StartDateCalendar);
hbox.Add (EndDateCalendar);
selectDate.VBox.Add (hbox);
selectDate.ShowAll ();
#endregion
int response = selectDate.Run ();
if (response == (int)ResponseType.Ok) {
startDate = StartDateCalendar.GetDate ();
endDate = EndDateCalendar.GetDate ();
OnPeriodChanged ();
}
#region Destroy
EndDateCalendar.Destroy ();
StartDateCalendar.Destroy ();
hbox.Destroy ();
selectDate.Destroy ();
#endregion
}
示例12: UpdateDialog
private static void UpdateDialog(string format, params object[] args)
{
string text = String.Format (format, args);
if (dialog == null)
{
dialog = new Dialog ();
dialog.Title = "Loading data from assemblies...";
dialog.AddButton (Stock.Cancel, 1);
dialog.Response += new ResponseHandler (ResponseCB);
dialog.SetDefaultSize (480, 100);
VBox vbox = dialog.VBox;
HBox hbox = new HBox (false, 4);
vbox.PackStart (hbox, true, true, 0);
Gtk.Image icon = new Gtk.Image (Stock.DialogInfo, IconSize.Dialog);
hbox.PackStart (icon, false, false, 0);
dialog_label = new Label (text);
hbox.PackStart (dialog_label, false, false, 0);
dialog.ShowAll ();
} else {
dialog_label.Text = text;
while (Application.EventsPending ())
Application.RunIteration ();
}
}
示例13: OnActualizarButtonClicked
protected virtual void OnActualizarButtonClicked(object sender, System.EventArgs e)
{
Gtk.TreeIter iter;
this.FamiliaProductosTreeview.Selection.GetSelected(out iter);
FamiliaProducto familia_vieja = new FamiliaProducto(this.familiaModel.GetValue(iter, 0).ToString());
FamiliaProducto familia_nueva = new FamiliaProducto(entryFamilia.Text.Trim());
if (!this.db.ExisteFamiliaBd(familia_vieja))
{
Dialog dialog = new Dialog("No se pudo actualizar la familia", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label();
etiqueta.Markup = "No se pudo actualizar la familia porque no existe una en la base de datos.\nIntente recargar la lista de familias.";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart(etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll();
dialog.Run ();
dialog.Destroy ();
}
else
{
if (this.db.ActualizarFamilia(familia_vieja, familia_nueva))
{
this.familias.RemoveAt(this.familiaModel.GetPath(iter).Indices[0]);
this.familias.Insert(this.familiaModel.GetPath(iter).Indices[0], familia_nueva);
this.familiaModel.SetValue(iter, 0, familia_nueva.Nombre);
this.entryFamilia.Text = "";
this.quitar_button.Sensitive = false;
this.actualizar_button.Sensitive = false;
this.FamiliaProductosTreeview.Selection.UnselectAll();
//Console.WriteLine("Actualizado");
this.cambiado = true;
}
else
{
Dialog dialog = new Dialog("No se pudo actualizar la familia", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label();
etiqueta.Markup = "No se pudo actualizar la familia, ha ocurrido un error al actualizar en la base de datos.";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart(etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll();
dialog.Run ();
dialog.Destroy ();
}
}
}
示例14: OnTreeviewListaProductosKeyPressEvent
protected void OnTreeviewListaProductosKeyPressEvent(object o, KeyPressEventArgs args)
{
if (args.Event.Key == Gdk.Key.F12) {
Gtk.TreeIter iter;
if (this.treeviewListaProductos.Selection.GetSelected (out iter)) {
Dialog dialog = new Dialog ("Quitar Producto De la lista", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label ();
etiqueta.Markup = "Está intentando quitar el producto seleccionado de la lista.\n\n<b>¿Desea continuar con la eliminación del producto?</b>\n";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart (etiqueta, false, false, 0);
dialog.AddButton ("Si", ResponseType.Accept);
dialog.AddButton ("No", ResponseType.Cancel);
dialog.Response += new ResponseHandler (OnQuitarProductoDialogResponse);
dialog.ShowAll ();
dialog.Run ();
dialog.Destroy ();
}
}
}
示例15: OnCalendarFInicialDaySelected
protected void OnCalendarFInicialDaySelected(object sender, EventArgs e)
{
ControladorBaseDatos db = new ControladorBaseDatos ();
string fechaI="";
//DateTime.Now.ToString("yyyy-MM-dd")
fechaI = calendarFInicial.GetDate ().ToString ("yyyy-MM-dd").Trim ();
Console.WriteLine("fecha seleccionada I: "+fechaI);
if (!db.ExisteFechaBd (fechaI)) {
Console.WriteLine ("NO existe venta");
Dialog dialog = new Dialog("Advertencia", this, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.Resizable = false;
Gtk.Label etiqueta = new Gtk.Label();
etiqueta.Markup = "No existen ventas en el día seleccionado";
dialog.BorderWidth = 8;
dialog.VBox.BorderWidth = 8;
dialog.VBox.PackStart(etiqueta, false, false, 0);
dialog.AddButton ("Cerrar", ResponseType.Close);
dialog.ShowAll();
dialog.Run ();
dialog.Destroy ();
} else {
Console.WriteLine ("existe venta");
}
}