FileFind.Meshwork.GtkClient.Windows.PreferencesDialog.on_avatarButton_clicked C# (CSharp) Method

on_avatarButton_clicked() private method

private on_avatarButton_clicked ( object o, EventArgs args ) : void
o object
args System.EventArgs
return void
        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 ();
        }