상속: FSpot.UI.Dialog.BuilderDialog
예제 #1
0
        public void Run(IBrowsableCollection selection)
        {
            dialog = new FacebookExportDialog (selection);

            if (selection.Items.Length > max_photos_per_album) {
                HigMessageDialog mbox = new HigMessageDialog (dialog,
                        Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
                        Gtk.ButtonsType.Ok, Catalog.GetString ("Too many images to export"),
                        String.Format (Catalog.GetString ("Facebook only permits {0} photographs per album.  Please refine your selection and try again."), max_photos_per_album));
                mbox.Run ();
                mbox.Destroy ();
                return;
            }

            if (dialog.Run () != (int)ResponseType.Ok) {
                dialog.Destroy ();
                return;
            }

            if (dialog.CreateAlbum) {
                string name = dialog.AlbumName;
                if (String.IsNullOrEmpty (name)) {
                    HigMessageDialog mbox = new HigMessageDialog (dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                            Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Album must have a name"),
                            Catalog.GetString ("Please name your album or choose an existing album."));
                    mbox.Run ();
                    mbox.Destroy ();
                    return;
                }

                string description = dialog.AlbumDescription;
                string location = dialog.AlbumLocation;

                try {
                    album = dialog.Account.Facebook.CreateAlbum (name, description, location);
                }
                catch (FacebookException fe) {
                    HigMessageDialog mbox = new HigMessageDialog (dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                            Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Creating a new album failed"),
                            String.Format (Catalog.GetString ("An error occurred creating a new album.\n\n{0}"), fe.Message));
                    mbox.Run ();
                    mbox.Destroy ();
                    return;
                }
            } else {
                album = dialog.ActiveAlbum;
            }

            if (dialog.Account != null) {
                dialog.Hide ();

                command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (Upload));
                command_thread.Name = Mono.Unix.Catalog.GetString ("Uploading Pictures");

                progress_dialog = new ThreadProgressDialog (command_thread, selection.Items.Length);
                progress_dialog.Start ();
            }

            dialog.Destroy ();
        }
예제 #2
0
        public void Run(IBrowsableCollection selection)
        {
            dialog = new FacebookExportDialog(selection);

            if (selection.Items.Count() > max_photos_per_album)
            {
                HigMessageDialog mbox = new HigMessageDialog(dialog,
                                                             Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
                                                             Gtk.ButtonsType.Ok, Catalog.GetString("Too many images to export"),
                                                             string.Format(Catalog.GetString("Facebook only permits {0} photographs per album.  Please refine your selection and try again."), max_photos_per_album));
                mbox.Run();
                mbox.Destroy();
                return;
            }

            if (dialog.Run() != (int)ResponseType.Ok)
            {
                dialog.Destroy();
                return;
            }

            if (dialog.CreateAlbum)
            {
                string name = dialog.AlbumName;
                if (string.IsNullOrEmpty(name))
                {
                    HigMessageDialog mbox = new HigMessageDialog(dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                                                                 Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Album must have a name"),
                                                                 Catalog.GetString("Please name your album or choose an existing album."));
                    mbox.Run();
                    mbox.Destroy();
                    return;
                }

                string description = dialog.AlbumDescription;
                string location    = dialog.AlbumLocation;

                try {
                    album = dialog.Account.Facebook.CreateAlbum(name, description, location);
                }
                catch (FacebookException fe) {
                    HigMessageDialog mbox = new HigMessageDialog(dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                                                                 Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Creating a new album failed"),
                                                                 string.Format(Catalog.GetString("An error occurred creating a new album.\n\n{0}"), fe.Message));
                    mbox.Run();
                    mbox.Destroy();
                    return;
                }
            }
            else
            {
                album = dialog.ActiveAlbum;
            }

            if (dialog.Account != null)
            {
                dialog.Hide();

                command_thread      = new System.Threading.Thread(new System.Threading.ThreadStart(Upload));
                command_thread.Name = Mono.Unix.Catalog.GetString("Uploading Pictures");

                progress_dialog = new ThreadProgressDialog(command_thread, selection.Items.Count());
                progress_dialog.Start();
            }

            dialog.Destroy();
        }