コード例 #1
0
        void HandleSendButtonClicked(object sender, EventArgs e)
        {
            string email = mailEntry.Text;

            if (!ValidateEmail(email))
            {
                mailWarningLabel.Show();
                mailEntry.GrabFocus();
                return;
            }
            mailWarningLabel.Hide();

            if (textEntry.Buffer.Text.Length == 0)
            {
                bodyWarningLabel.Show();
                textEntry.GrabFocus();
                return;
            }

            FeedbackService.SendFeedback(email, textEntry.Buffer.Text);

            mainFrame.Remove(mainBox);
            mainBox.Destroy();

            Gtk.VBox box = new Gtk.VBox(false, 18);
            box.PackStart(new Gtk.Label(), true, true, 0); // Filler
            string txt = "<big>" + GettextCatalog.GetString("Thank you for your feedback!") + "</big>";

            Gtk.Label lab = new Gtk.Label();
            lab.Markup = txt;
            box.PackStart(lab, false, false, 0);

            lab = new Gtk.Label(GettextCatalog.GetString("Feedbacks sent: {0}", FeedbackService.FeedbacksSent));
            box.PackStart(lab, false, false, 0);

            box.PackStart(new Gtk.Label(), true, true, 0); // Filler
            box.ShowAll();

            mainFrame.Add(box);
            GLib.Timeout.Add(1000, delegate
            {
                Close();
                return(false);
            });
            sent = true;
        }