当前位置: 首页>>代码示例>>C#>>正文


C# Dialog.Run方法代码示例

本文整理汇总了C#中Dialog.Run方法的典型用法代码示例。如果您正苦于以下问题:C# Dialog.Run方法的具体用法?C# Dialog.Run怎么用?C# Dialog.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dialog的用法示例。


在下文中一共展示了Dialog.Run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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 ();

            }
        }
开发者ID:pelao,项目名称:punto,代码行数:33,代码来源:IniciarSesionDialog.cs

示例2: 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 ();

            }
        }
开发者ID:pelao,项目名称:punto,代码行数:58,代码来源:EditarNumBoletaDialog.cs

示例3: 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 ();
 }
开发者ID:kuga00,项目名称:gtk-test,代码行数:9,代码来源:MainWindow.cs

示例4: compileButton_Clicked

 private void compileButton_Clicked(object sender, EventArgs e)
 {
     try
     {
         softwareModel = new SoftwareModel (openTextBox.Text, softwareModelLoaded);
     }
     catch (Exception ex)
     {
         var dlg = new Dialog("Error", this, DialogFlags.Modal, ResponseType.Ok);
         dlg.VBox.Add (new Label (ex.Message));
         dlg.ShowAll ();
         dlg.Run();
         dlg.Destroy();
     }
 }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:15,代码来源:MainWindow.cs

示例5: 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);
            }
        }
开发者ID:pelao,项目名称:punto,代码行数:48,代码来源:IngresarDineroCajaDialog.cs

示例6: ShowMessage

	void ShowMessage (Window parent, string title, string message)
	{
		Dialog dialog = null;
		try {
			dialog = new Dialog (title, parent,
				DialogFlags.DestroyWithParent | DialogFlags.Modal,
				ResponseType.Ok);
			dialog.VBox.Add (new Label (message));
			dialog.ShowAll ();

			dialog.Run ();
		} finally {
			if (dialog != null)
				dialog.Destroy ();
		}
	}
开发者ID:DeeJ1230,项目名称:Photo2NASGithub,代码行数:16,代码来源:MainWindow.cs

示例7: 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;
        }
开发者ID:iainlane,项目名称:f-spot,代码行数:44,代码来源:PhotoVersionCommands.cs

示例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 ();
        }
开发者ID:pelao,项目名称:punto,代码行数:19,代码来源:EditarNumBoletaDialog.cs

示例9: OnQuitarButtonClicked

        protected void OnQuitarButtonClicked(object sender, EventArgs e)
        {
            Gtk.TreeIter iter;
            if (this.FamiliaProductosTreeview.Selection.GetSelected(out iter))
            {

                Dialog dialog = new Dialog("Quitar familia", this, Gtk.DialogFlags.DestroyWithParent);
                dialog.Modal = true;
                dialog.Resizable = false;
                Gtk.Label etiqueta = new Gtk.Label();
                etiqueta.Markup = "Está intentando quitar la familia seleccionada de la lista.\n\n<b>¿Desea continuar con la eliminación de la familia?</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 (OnQuitarFamiliaDialogResponse);
                dialog.ShowAll();
                dialog.Run ();
                dialog.Destroy ();
            }
            else
            {
                this.actualizar_button.Sensitive = false;
            }
        }
开发者ID:pelao,项目名称:punto,代码行数:26,代码来源:Familiaproductosdialog.cs

示例10: OnAgregarButtonClicked

        protected virtual void OnAgregarButtonClicked(object sender, System.EventArgs e)
        {
            FamiliaProducto prod = new FamiliaProducto(this.entryFamilia.Text.Trim());

            if (this.db.ExisteFamiliaBd(prod))
            {
                Dialog dialog = new Dialog("FAMILIA YA EXISTE", this, Gtk.DialogFlags.DestroyWithParent);
                dialog.Modal = true;
                dialog.Resizable = false;
                Gtk.Label etiqueta = new Gtk.Label();
                etiqueta.Markup = "La Familia que intenta agregar ya existe 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 ();
            }
            else
            {
                if (this.db.AgregarFamiliaBd(prod))
                {
                    this.familias.Add(prod);
                    this.familiaModel.AppendValues(prod.Nombre);

                    this.entryFamilia.Text = "";
                    this.FamiliaProductosTreeview.Selection.UnselectAll();
                    this.añadir_button.Sensitive = false;

                    añadir_button.Sensitive = true;

                    this.cambiado = true;
                }
                else
                {
                    Dialog dialog = new Dialog("ERROR AL AGREGAR FAMILIA", this, Gtk.DialogFlags.DestroyWithParent);
                    dialog.Modal = true;
                    dialog.Resizable = false;
                    Gtk.Label etiqueta = new Gtk.Label();
                    etiqueta.Markup = "Ha ocurrido un error al agregar la Familia a 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 ();
                    añadir_button.Sensitive = true;

                }
            }
        }
开发者ID:pelao,项目名称:punto,代码行数:53,代码来源:Familiaproductosdialog.cs

示例11: AskUserForRepositoryCreation

    private bool AskUserForRepositoryCreation(string path)
    {
        var dialog = new Dialog (Catalog.GetString ("Please decide"), this, DialogFlags.Modal);
        dialog.VBox.PackStart (new Label (string.Format (Catalog.GetString ("ID_AskUserForCreationOfARepository"), path)));
        dialog.AddButton (Catalog.GetString ("Yes"), ResponseType.Yes);
        dialog.AddButton (Catalog.GetString ("No"), ResponseType.No);

        bool yesNo = false;
        dialog.ShowAll ();
        if (dialog.Run () == (int)ResponseType.Yes) {
            yesNo = true;
        }
        dialog.Destroy ();
        return yesNo;
    }
开发者ID:scheibenkaes,项目名称:DirectoryHistory,代码行数:15,代码来源:MainWindow.cs

示例12: AskSave

    // This returns ResponseType.Yes, No, or Cancel
    ResponseType AskSave(string info)
    {
        if (Project == null)
            return ResponseType.No;

        ResponseType response;
        Gtk.Dialog d = new Dialog("Save Project?", this,
                DialogFlags.DestroyWithParent,
                Gtk.Stock.Yes, ResponseType.Yes,
                Gtk.Stock.No, ResponseType.No,
                Gtk.Stock.Cancel, ResponseType.Cancel);
        Alignment a = new Alignment(1,0.25f,1,0);
        a.SetSizeRequest(0, 50);
        a.Add(new Gtk.Label(info));
        d.VBox.Add(a);
        d.VBox.ShowAll();
        response = (ResponseType)d.Run();
        d.Destroy();
        if (response == ResponseType.Yes) {
            Project.Save();
        }

        return response;
    }
开发者ID:Drenn1,项目名称:LynnaLab,代码行数:25,代码来源:MainWindow.cs

示例13: 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 ();
                }

            }
        }
开发者ID:pelao,项目名称:punto,代码行数:23,代码来源:VenderProductosDialog.cs

示例14: Run

        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            this.icon = GetIcon (message.Icon);
            if (ConvertButtons (message.Buttons, out buttons) && message.Options.Count == 0) {
                // Use a system message box
                if (message.SecondaryText == null)
                    message.SecondaryText = String.Empty;
                else {
                    message.Text = message.Text + "\r\n\r\n" + message.SecondaryText;
                    message.SecondaryText = String.Empty;
                }
                var parent =  Toolkit.CurrentEngine.GetNativeWindow(transientFor) as System.Windows.Window;
                if (parent != null) {
                    this.dialogResult = MessageBox.Show (parent, message.Text, message.SecondaryText,
                                                        this.buttons, this.icon, this.defaultResult, this.options);
                }
                else {
                    this.dialogResult = MessageBox.Show (message.Text, message.SecondaryText, this.buttons,
                                                        this.icon, this.defaultResult, this.options);
                }
                return ConvertResultToCommand (this.dialogResult);
            }
            else {
                // Custom message box required
                Dialog dlg = new Dialog ();
                dlg.Resizable = false;
                dlg.Padding = 0;
                HBox mainBox = new HBox { Margin = 25 };

                if (message.Icon != null) {
                    var image = new ImageView (message.Icon.WithSize (32,32));
                    mainBox.PackStart (image, vpos: WidgetPlacement.Start);
                }
                VBox box = new VBox () { Margin = 3, MarginLeft = 8, Spacing = 15 };
                mainBox.PackStart (box, true);
                var text = new Label {
                    Text = message.Text ?? ""
                };
                Label stext = null;
                box.PackStart (text);
                if (!string.IsNullOrEmpty (message.SecondaryText)) {
                    stext = new Label {
                        Text = message.SecondaryText
                    };
                    box.PackStart (stext);
                }
                foreach (var option in message.Options) {
                    var check = new CheckBox (option.Text);
                    check.Active = option.Value;
                    box.PackStart(check);
                    check.Toggled += (sender, e) => message.SetOptionValue(option.Id, check.Active);
                }
                dlg.Buttons.Add (message.Buttons.ToArray ());
                if (message.DefaultButton >= 0 && message.DefaultButton < message.Buttons.Count)
                    dlg.DefaultCommand = message.Buttons[message.DefaultButton];
                if (mainBox.Surface.GetPreferredSize (true).Width > 480) {
                    text.Wrap = WrapMode.Word;
                    if (stext != null)
                        stext.Wrap = WrapMode.Word;
                    mainBox.WidthRequest = 480;
                }
                var s = mainBox.Surface.GetPreferredSize (true);

                dlg.Content = mainBox;
                return dlg.Run ();
            }
        }
开发者ID:akrisiun,项目名称:xwt,代码行数:67,代码来源:AlertDialogBackend.cs

示例15: 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 ();
                }
            }
        }
开发者ID:pelao,项目名称:punto,代码行数:58,代码来源:Familiaproductosdialog.cs


注:本文中的Dialog.Run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。