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


C# MessageDialog.Destroy方法代码示例

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


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

示例1: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();
        mySqlConnection.Open();
        MySqlCommand mySqlCommand=mySqlConnection.CreateCommand();
        mySqlCommand.CommandText= "select * from categoria";
        MySqlDataReader mysqlDataReader= mySqlCommand.ExecuteReader();
        int fieldcount=mysqlDataReader.FieldCount;

        creaColumnas(fieldcount,mysqlDataReader);
        ListStore listStore=new ListStore(creaTipos(fieldcount));
        rellenar(fieldcount,listStore,mysqlDataReader);
        mysqlDataReader.Close();

        removeAction.Sensitive=false;
        treeView.Model=listStore;
        TreeIter iter;

        treeView.Selection.Changed+=delegate{
            bool isSelected=treeView.Selection.GetSelected(out iter);
            if(isSelected)
                removeAction.Sensitive=true;
            else
                removeAction.Sensitive=false;
        };

        removeAction.Activated +=delegate{
            string nombre=listStore.GetValue(iter,1).ToString();
            MessageDialog md2 = new MessageDialog
                        (this, DialogFlags.Modal, MessageType.Warning, ButtonsType.YesNo,"¿Seguro que quieres borrarlo? \n Borrar: "+nombre);

            ResponseType result = (ResponseType)md2.Run ();
            string op=listStore.GetValue(iter,0).ToString();

            if (result == ResponseType.Yes){
                MySqlCommand delete=mySqlConnection.CreateCommand();
                delete.CommandText= "Delete from categoria where id="+op+"";
                delete.ExecuteNonQuery();
                md2.Destroy();

                for (int i=0;i<fieldcount;i++){//elimina columnas
                    treeView.RemoveColumn(treeView.GetColumn(0));
                }
                listStore.Clear();//vacia el modelo
                //volvemos a mostrar treview actualizado
                actualizar(mySqlCommand,listStore);

            }
            else{
                md2.Destroy();

            }
        };
    }
开发者ID:nerea123,项目名称:ad,代码行数:55,代码来源:MainWindow.cs

示例2: OnButtonLoginClicked

    protected void OnButtonLoginClicked(object sender, EventArgs e)
    {
        try{
            string connectionString = "Server=localhost;" + "Database=dbprueba;" +
                "User ID=" + entryUser.Text.ToString () + ";" + "Password=" + entryPwd.Text.ToString ();
            this.mySqlConnection = new MySqlConnection (connectionString);
            this.mySqlConnection.Open ();

            this.SetSizeRequest (500, 250);
            vboxLogin.Visible = false;
            vboxTable.Visible = true;

            OnRefreshActionActivated ();

        }
        catch (MySqlException){
            messageDialog = new MessageDialog (
                this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "\t\tConnection Error\t\t\nCannot connect to database");
            messageDialog.Title = "SQL DataBase Error";
            messageDialog.Run ();
            messageDialog.Destroy ();

            entryUser.Text = "";
            entryPwd.Text = "";

        }
        catch{
            Console.WriteLine ("\nError 404 Not Found");
            Application.Quit ();
        }
    }
开发者ID:juankza,项目名称:ad,代码行数:31,代码来源:MainWindow.cs

示例3: OnButton1Clicked

    protected void OnButton1Clicked(object sender, EventArgs e)
    {
        int aciertos = 0;

        if (this.radb1.Active) {
            aciertos += 1;
        }

        if (this.chPortu.Active) {
            aciertos += 1;
        }

        if (this.chReino.Active) {
            aciertos += 1;
        }

        if (this.chMace.Active) {
            aciertos += 1;
        }

        if (this.spinb1.Text == "31") {
            aciertos += 1;
        }

        if (this.calendar1.GetDate ().ToShortDateString () == "07/05/1945") {
            aciertos +=1;
        }

        MessageDialog ve=new MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Código: " + this.entry1.Text
                                           + "\nNombre: " + this.entry2.Text + "\n" + Convert.ToString(aciertos) + " aciertos.");
        ve.Run();
        ve.Destroy();
        aciertos=0;
    }
开发者ID:Rafa-el,项目名称:Practica6,代码行数:34,代码来源:MainWindow.cs

示例4: clicked

    protected void clicked(object sender, EventArgs e)
    {
        double pes;
        double cam;
        double res;

        if (double.TryParse (pesos.Text, out pes) && double.TryParse (camb.Text, out cam)) {
            if(pes == 0 || cam == 0){
                MessageDialog cero;
                cero = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "Conversion invalida entre cero");
                cero.Run();
                cero.Destroy();
        }
            else{
                res = pes / cam;
                dol.Text = Convert.ToString (res);
            }
        }
        else if(pesos.Text == "" || camb.Text == ""){
            MessageDialog d;
            d = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "Campos vacios, ingrese numeros");
            d.Run();
            d.Destroy();
        }else {
            MessageDialog dia;
            dia = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "Ingrese solo numeros");
            dia.Run();
            dia.Destroy();
        }
    }
开发者ID:Rafa-el,项目名称:Practica5,代码行数:30,代码来源:MainWindow.cs

示例5: OnBtnokClicked

    protected virtual void OnBtnokClicked(object sender, System.EventArgs e)
    {
        if(txturl.Text==String.Empty||txtname.Text==String.Empty)
        {
            MessageDialog md = new MessageDialog (this, DialogFlags.DestroyWithParent,MessageType.Error, ButtonsType.Close, "Fields must not be empty");
        int result = md.Run ();
        md.Destroy();
        }
        else
        {
            if(!txturl.Text.Contains("http://"))
            {
                MessageDialog md = new MessageDialog(this,DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "Please Introduce a valid URL");
                int result=md.Run();
                md.Destroy();
            }
            else
            {
                url=txturl.Text;
                path=txtpath.CurrentFolder+"/"+txtname.Text;
                Thread down = new Thread(downloadStart);
                down.Start();

            }

        }
    }
开发者ID:Manuelinux,项目名称:Yotidescargo,代码行数:27,代码来源:MainWindow.cs

示例6: OnBtnGenerateClicked

    protected void OnBtnGenerateClicked(object sender, EventArgs e)
    {
        try {
            BarcodeLib.Barcode codeBar = new BarcodeLib.Barcode ();
            codeBar.Alignment = BarcodeLib.AlignmentPositions.CENTER;
            codeBar.IncludeLabel = true;
            codeBar.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER;

            BarcodeLib.TYPE bCodeType = (BarcodeLib.TYPE)Enum.Parse (typeof(BarcodeLib.TYPE), cmbBarCodeType.ActiveText.ToString ());
            System.Drawing.Image imgTmpCodeBar = codeBar.Encode (bCodeType, txtData.Text.Trim (), System.Drawing.Color.Black, System.Drawing.Color.White, 300, 300);

            MemoryStream memoryStream = new MemoryStream();
            imgTmpCodeBar.Save(memoryStream, ImageFormat.Png);
            Gdk.Pixbuf pb = new Gdk.Pixbuf (memoryStream.ToArray());

            imgCodeBar.Pixbuf = pb;

        } catch (Exception err) {
            MessageDialog dlg = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, string.Format ("Ocurrió un error \n {0}", err.Message));
            dlg.Run ();
            dlg.Destroy ();
            dlg.Dispose ();
            dlg = null;
        }
    }
开发者ID:xmalmorthen,项目名称:monoCodeBarGenerator,代码行数:25,代码来源:MainWindow.cs

示例7: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        try
        {
        CheckForUpdatesProgress cfup = new CheckForUpdatesProgress(Assembly.GetExecutingAssembly().GetName().Version);
        cfup.Show();
        if (cfup.CheckForUpdates() == false)
            cfup.Destroy();
        }
        catch
        {
            MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
                "Communication could not be established to our servers: you must be online to use the LunaLua Module Manager.\n\nPress ok so we can self destruct.");
            md.Icon = Image.LoadFromResource("Gtktester.Icons.PNG.256.png").Pixbuf;
            md.WindowPosition = WindowPosition.Center;
            md.Run();
            md.Destroy();
            this.Destroy();
            Environment.Exit(-5);
        }

        Build ();

        if (Program.ProgramSettings.StartMaximized)
            this.Maximize();

        this.hpaned2.Position = 170;
        this.hpaned1.Position = 170;

        OnWindowLoad();

        this.notebook1.CurrentPage = 0;
    }
开发者ID:Luigifan,项目名称:LuaScriptsManager,代码行数:34,代码来源:MainWindow.cs

示例8: OnBtnAnularClicked

    protected virtual void OnBtnAnularClicked(object sender, System.EventArgs e)
    {
        MessageDialog Mensaje = null;
        string Tiquete = "", REF = "", c = "";

        REF = txtEfectivo.Text;

        c = "UPDATE `cafeteria_transacciones` SET `precio_grabado`= 0.00, `cancelado` = 1 WHERE ID_ticket = '"+REF+"'";
        if (MySQL.consultar(c))
        {
            if( MySQL.Reader.RecordsAffected > 0 )
            {
                Console.WriteLine("RA:" + MySQL.Reader.RecordsAffected);
                Tiquete += Imprimidor.Imprimir("CANCELACION CAFETERIA",1);
                Tiquete += Imprimidor.Imprimir("REF: "+REF,1);
                Imprimidor.Tiquete(Tiquete, "666");

                Mensaje = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, "Tiquete anulado");
                Mensaje.Title="Éxito";
                Mensaje.Run();
                Mensaje.Destroy();
                txtEfectivo.Text = "";
                return;
            }
        }

        Mensaje = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, "Tiquete no pudo ser anulado.");
        Mensaje.Title="Error";
        Mensaje.Run();
        Mensaje.Destroy();
        txtEfectivo.GrabFocus();
        return;
    }
开发者ID:vlad88sv,项目名称:RIFT,代码行数:33,代码来源:MainWindow.cs

示例9: OnExecButtonClicked

    protected virtual void OnExecButtonClicked(object sender, System.EventArgs e)
    {
        resultString = new StringBuilder();
        try{
            parser.Execute(); // Parse selected file
        }
        catch(Exception exc){
            string errorText = "Ouch! Something bad happened and an exception" +
                " was thrown. The error message was: " + Environment.NewLine +
                    exc.Message + Environment.NewLine + Environment.NewLine +
                    "Make sure your input file is formatted correctly and try again.";

            MessageDialog md = new MessageDialog(this, DialogFlags.Modal,
                                             MessageType.Info, ButtonsType.Ok,
                                             errorText);
            ResponseType res = (ResponseType)md.Run();
            if(res == ResponseType.Ok){
                md.Destroy();
                Application.Quit();
            }
        }

        // Append each line
        foreach(string str in parser.GetResults()){
            resultString.Append(str + Environment.NewLine);
        }
        resultString.Append(Environment.NewLine);
        // Enable View and Save buttons
        TextView.Buffer.Text = "File parsed. Press View to view results or Save to save results.";
        //TextView.Buffer.Text = "File parsed. Press Save to save the results.";
        ViewButton.Sensitive = true;
        SaveButton.Sensitive = true;
    }
开发者ID:aelinden,项目名称:OruStuff,代码行数:33,代码来源:MainWindow.cs

示例10: btnEnter_Click

    protected void btnEnter_Click(object sender, EventArgs e)
    {
        TeenvioAPI api = new TeenvioAPI (txtUser.Text, txtPlan.Text, txtPassword.Text);

        try{
            api.getServerVersion ();
            MainWindow win = new MainWindow();
            win.Show();
            win.setAPI(api);
            this.Destroy();

        }catch(TeenvioException ex){
            MessageDialog msg = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, ex.Message);
            msg.Title = "Error";

            ResponseType response = (ResponseType) msg.Run();
            if (response == ResponseType.Close || response == ResponseType.DeleteEvent) {
                msg.Destroy();
            }
        }catch(Exception ex){
            MessageDialog msg = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, ex.Message);
            msg.Title = "Error";

            ResponseType response = (ResponseType) msg.Run();
            if (response == ResponseType.Close || response == ResponseType.DeleteEvent) {
                msg.Destroy();
            }
        }
    }
开发者ID:purpleflameangle,项目名称:POST-API,代码行数:29,代码来源:LoginWindow.cs

示例11: OnDeleteActionActivated

    protected void OnDeleteActionActivated(object sender, EventArgs e)
    {
        MessageDialog messageDialog = new MessageDialog (
            this,
            DialogFlags.Modal,
            MessageType.Question,
            ButtonsType.YesNo,
            "¿Quieres eliminar el registro?"
        );
        messageDialog.Title = Title;
        ResponseType response = (ResponseType) messageDialog.Run ();
        messageDialog.Destroy ();

        if (response != ResponseType.Yes)
            return;

        TreeIter treeIter;
        treeView.Selection.GetSelected (out treeIter);
        object id = listStore.GetValue (treeIter, 0);
        string deleteSql = string.Format ("delete from categoria where id={0}", id);
        IDbCommand dbCommand = dbConnection.CreateCommand ();
        dbCommand.CommandText = deleteSql;

        dbCommand.ExecuteNonQuery ();
    }
开发者ID:rubenramos,项目名称:adRuben,代码行数:25,代码来源:MainWindow.cs

示例12: OnLoginButtonClicked

    //LOGIN
    protected void OnLoginButtonClicked(object sender, EventArgs e)
    {
        try{
            string connectionString = "Server=localhost;" + "Database=dbprueba;" +
                "User ID=" + userEntry.Text.ToString () + ";" + "Password=" + pwdEntry.Text.ToString ();
            App.Instance.DbConnection = new MySqlConnection (connectionString);
            App.Instance.DbConnection.Open ();

            MainWindow mWin = new MainWindow ();
            mWin.ShowAll ();

            this.Destroy ();

        }
        catch (MySqlException){
            msgDialog = new MessageDialog (
                this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "\t\tConnection Error\t\t\nCannot connect to database");
            msgDialog.Title = "SQL DataBase Error";
            msgDialog.Run ();
            msgDialog.Destroy ();

            pwdEntry.Text = "";

        }
        catch{
            Console.WriteLine ("\nError 404 Not Found");
            Application.Quit ();

        }
    }
开发者ID:juankza,项目名称:ad,代码行数:31,代码来源:LoginWindow.cs

示例13: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        this.Resize (600, 100);
        this.Title = "metafang";
        _main = new VBox ();

        HBox title = new HBox ();
        title.PackStart (new Label ("Login to your Metasploit RPC instance to begin"), true, true, 0);

        _main.PackStart (title, true, true, 0);

        HBox loginInfo = new HBox ();

        loginInfo.PackStart (new Label ("Host:"), false, false, 20);

        Entry hostEntry = new Entry ();
        loginInfo.PackStart (hostEntry, false, false, 0);

        loginInfo.PackStart (new Label ("User:"), false, false, 20);

        Entry userEntry = new Entry ();
        loginInfo.PackStart (userEntry, false, false, 0);

        loginInfo.PackStart (new Label ("Pass:"), false, false, 20);

        Entry passEntry = new Entry ();
        loginInfo.PackStart (passEntry, false, false, 0);

        _main.PackStart (loginInfo, true, true, 0);

        Button login = new Button ("Login");

        login.Clicked += (object sender, EventArgs e) => {
            try {
                //Console.WriteLine ("Creating session");
                _session = new MetasploitSession (userEntry.Text, passEntry.Text, hostEntry.Text);
                //Console.WriteLine ("Creating manager and getting current list of payloads");
                _manager = new MetasploitManager (_session);
                _payloads = _manager.GetPayloads ();
                BuildWorkspace ();
            } catch {
                MessageDialog md = new MessageDialog (this,
                                       DialogFlags.DestroyWithParent,
                                       MessageType.Error,
                    ButtonsType.Close, "Authentication failed. Please ensure your credentials and API URL are correct.");

                md.Run ();
                md.Destroy ();
            }
        };

        HBox loginBox = new HBox ();
        loginBox.PackStart (login, false, false, 300);

        _main.PackStart (loginBox, true, true, 0);

        _main.ShowAll ();
        this.Add (_main);
    }
开发者ID:subTee,项目名称:metafang2,代码行数:60,代码来源:MainWindow.cs

示例14: click

 protected void click(object sender, System.EventArgs e)
 {
     //throw new System.NotImplementedException ();
     //label1.Text="Hola Mundo";
     MessageDialog dialogo;
     dialogo = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "MENSAJE DE ERROR");
     dialogo.Run();
     dialogo.Destroy();
 }
开发者ID:sai1080,项目名称:AD,代码行数:9,代码来源:MainWindow.cs

示例15: StartGame

 public void StartGame(Config config)
 {
     game = new Game (this.createBoard (config.Width, config.Height));
     game.GameWon += delegate(object sender, EventArgs e) {
         MessageDialog dialog = new MessageDialog (
             this,
          DialogFlags.Modal,
          MessageType.Info,
          ButtonsType.None,
          "Úroveň dokončena! Abyste zvládli víc nepřátel, dostanete další život."
         );
         dialog.AddButton ("Další kolo", ResponseType.Accept);
         dialog.AddButton ("Konec hry", ResponseType.Cancel);
         dialog.Response += delegate(object o, ResponseArgs args) {
             if (args.ResponseId == ResponseType.Accept) {
                 NextLevel (config);
             } else {
                 Application.Quit ();
             }
         };
         dialog.Run ();
         dialog.Destroy ();
     };
     game.GameLost += delegate(object sender, EventArgs e) {
         MessageDialog dialog = new MessageDialog (
             this,
          DialogFlags.Modal,
          MessageType.Info,
          ButtonsType.None,
          "Konec hry"
         );
         dialog.AddButton ("Nová hra", ResponseType.Accept);
         dialog.AddButton ("Konec", ResponseType.Close);
         dialog.Response += delegate(object o, ResponseArgs args) {
             if (args.ResponseId == ResponseType.Accept) {
                 MainClass.ShowLauncher ();
                 this.Destroy ();
             } else {
                 Application.Quit ();
             }
         };
         dialog.Run ();
         dialog.Destroy ();
     };
     game.FilledAreaChanged += delegate(object sender, int value) {
         fillCounter.Text = String.Format ("Zaplněno: {0}%", value);
     };
     game.LivesChanged += delegate(object sender, int value) {
         lifeCounter.Text = String.Format ("Životy: {0}", value);
     };
     game.RemainingTimeChanged += delegate(object sender, int value) {
         remainingTimeCounter.Text = string.Format ("Zbývající čas: {0} sekund", value);
     };
     game.Start (config);
     level = 1;
     updateLevelCounter ();
 }
开发者ID:Teyras,项目名称:Bounce,代码行数:57,代码来源:MainWindow.cs


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