Beispiel #1
0
        public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window)
        {
            VersionNameRequest request = new VersionNameRequest(VersionNameRequest.RequestType.Create,
                                                                photo, parent_window);

            string       name;
            ResponseType response = request.Run(out name);

            if (response != ResponseType.Ok)
            {
                return(false);
            }

            try {
                photo.DefaultVersionId = photo.CreateVersion(name, photo.DefaultVersionId, true);
                store.Commit(photo);
            } catch (Exception e) {
                string msg  = Catalog.GetString("Could not create a new version");
                string desc = String.Format(Catalog.GetString("Received exception \"{0}\". Unable to create version \"{1}\""),
                                            e.Message, name);

                HigMessageDialog md = new HigMessageDialog(parent_window, DialogFlags.DestroyWithParent,
                                                           Gtk.MessageType.Error, ButtonsType.Ok,
                                                           msg,
                                                           desc);
                md.Run();
                md.Destroy();
                return(false);
            }

            return(true);
        }
        public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window)
        {
            VersionNameRequest request = new VersionNameRequest (VersionNameRequest.RequestType.Create,
                                         photo, parent_window);

            string name;
            ResponseType response = request.Run (out name);

            if (response != ResponseType.Ok)
                return false;

            try {
                photo.DefaultVersionId = photo.CreateVersion (name, photo.DefaultVersionId, true);
                store.Commit (photo);
            } catch (Exception e) {
                    string msg = Catalog.GetString ("Could not create a new version");
                    string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to create version \"{1}\""),
                                     e.Message, name);

                    HigMessageDialog md = new HigMessageDialog (parent_window, DialogFlags.DestroyWithParent,
                                            Gtk.MessageType.Error, ButtonsType.Ok,
                                            msg,
                                            desc);
                    md.Run ();
                    md.Destroy ();
                    return false;
            }

            return true;
        }
        public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window)
        {
            VersionNameRequest request = new VersionNameRequest (VersionNameRequest.RequestType.Create,
                                         photo, parent_window);

            string name;
            ResponseType response = request.Run (out name);

            if (response != ResponseType.Ok)
                return false;

            try {
                photo.DefaultVersionId = photo.CreateVersion (name, photo.DefaultVersionId, true);
                store.Commit (photo);
                return true;
            } catch (Exception e) {
                HandleException ("Could not create a new version", e, parent_window);
                return false;
            }
        }
        public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window)
        {
            VersionNameRequest request = new VersionNameRequest(VersionNameRequest.RequestType.Rename,
                                                                photo, parent_window);

            string       new_name;
            ResponseType response = request.Run(out new_name);

            if (response != ResponseType.Ok)
            {
                return(false);
            }

            try {
                photo.RenameVersion(photo.DefaultVersionId, new_name);
                store.Commit(photo);
                return(true);
            } catch (Exception e) {
                HandleException("Could not rename a version", e, parent_window);
                return(false);
            }
        }