Example #1
0
        private void on_avatarButton_clicked(object o, EventArgs args)
        {
            FileSelector selector = new FileSelector("Select Image");

            selector.Show();
            int result = selector.Run();

            if (result == (int)Gtk.ResponseType.Ok)
            {
                try {
                    Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(selector.Filename);

                    if (pixbuf.Width > 80 | pixbuf.Height > 80)
                    {
                        pixbuf = pixbuf.ScaleSimple(80, 80, Gdk.InterpType.Hyper);
                    }

                    avatarImage.Pixbuf    = pixbuf;
                    avatarImage.Sensitive = true;
                } catch (Exception ex) {
                    selector.Hide();
                    Gui.ShowMessageDialog(ex.Message);
                    return;
                }
            }
            selector.Hide();
        }
Example #2
0
        private void browseButton_clicked(object o, EventArgs args)
        {
            FileSelector selector = new FileSelector("Select Image");

            selector.Show();
            int result = selector.Run();

            if (result == (int)Gtk.ResponseType.Ok)
            {
                try {
                    AddFile(selector.Filename);
                } catch (Exception ex) {
                    selector.Hide();
                    Gui.ShowMessageDialog(ex.Message);
                    return;
                }
            }
            selector.Hide();
        }
Example #3
0
        private void on_avatarButton_clicked(object o, EventArgs args)
        {
            FileSelector selector = new FileSelector ("Select Image");
            selector.Show ();
            int result = selector.Run ();
            if (result == (int)Gtk.ResponseType.Ok) {
                try {
                    Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (selector.Filename);

                    if (pixbuf.Width > 80 | pixbuf.Height > 80)
                        pixbuf = pixbuf.ScaleSimple (80, 80, Gdk.InterpType.Hyper);

                    avatarImage.Pixbuf = pixbuf;
                    avatarImage.Sensitive = true;
                } catch (Exception ex) {
                    selector.Hide ();
                    Gui.ShowMessageDialog (ex.Message);
                    return;
                }
            }
            selector.Hide ();
        }