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


C# MessageDialog.Run方法代码示例

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


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

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

示例2: ShowWarningMessage

 public static void ShowWarningMessage(Window window, string message)
 {
     Dialog dialog = new MessageDialog(window, DialogFlags.DestroyWithParent | DialogFlags.Modal,
             MessageType.Warning, ButtonsType.Ok, message);
         dialog.Run();
         dialog.Hide();
 }
开发者ID:hughperkins,项目名称:SpringMapDesigner,代码行数:7,代码来源:DialogHelpers.cs

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: OnButton1Clicked

 protected void OnButton1Clicked(object sender, EventArgs a)
 {
     using (var dialog = new MessageDialog(
         this, DialogFlags.Modal, MessageType.Info,
         ButtonsType.Ok, "World!")) {
         dialog.Run ();
     }
 }
开发者ID:oklahomaok,项目名称:MonoDevelopSamples,代码行数:8,代码来源:MainWindow.cs

示例15: ShowError

 private void ShowError(string errorMessage)
 {
     MessageDialog errorMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, errorMessage);
     errorMsg.Title = "Error";
     if ((ResponseType) errorMsg.Run() == ResponseType.Close)
     {
         errorMsg.Destroy();
     }
 }
开发者ID:ArsenShnurkov,项目名称:libvirt-csharp,代码行数:9,代码来源:MainWindow.cs


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