当前位置: 首页>>代码示例>>C#>>正文


C# Photo.GetVersion方法代码示例

本文整理汇总了C#中Photo.GetVersion方法的典型用法代码示例。如果您正苦于以下问题:C# Photo.GetVersion方法的具体用法?C# Photo.GetVersion怎么用?C# Photo.GetVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Photo的用法示例。


在下文中一共展示了Photo.GetVersion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PhotoVersionMenu

    public PhotoVersionMenu(Photo photo)
    {
        version_id = photo.DefaultVersionId;

        uint [] version_ids = photo.VersionIds;
        item_infos = new MenuItemInfo [version_ids.Length];

        int i = 0;
        foreach (uint id in version_ids) {
            MenuItem menu_item = new MenuItem (photo.GetVersion (id).Name);
            menu_item.Show ();
            menu_item.Sensitive = true;
            ((Gtk.Label)menu_item.Child).UseUnderline = false;
            menu_item.Activated += new EventHandler (HandleMenuItemActivated);

            item_infos [i ++] = new MenuItemInfo (menu_item, id);

            Append (menu_item);
        }

        if (version_ids.Length == 1) {
            MenuItem no_edits_menu_item = new MenuItem (Mono.Unix.Catalog.GetString ("(No Edits)"));
            no_edits_menu_item.Show ();
            no_edits_menu_item.Sensitive = false;
            Append (no_edits_menu_item);
        }
    }
开发者ID:iainlane,项目名称:f-spot,代码行数:27,代码来源:PhotoVersionMenu.cs

示例2: VersionNameRequest

		public VersionNameRequest (RequestType request_type, Photo photo, Gtk.Window parent_window) : base ("version_name_dialog")
		{
			this.request_type = request_type;
			this.photo = photo;

			switch (request_type) {
			case RequestType.Create:
				this.Dialog.Title = Catalog.GetString ("Create New Version");
				prompt_label.Text = Catalog.GetString ("Name:");
				break;

			case RequestType.Rename:
				this.Dialog.Title = Catalog.GetString ("Rename Version");
				prompt_label.Text = Catalog.GetString ("New name:");
				version_name_entry.Text = photo.GetVersion (photo.DefaultVersionId).Name;
				version_name_entry.SelectRegion (0, -1);
				break;
			}

			version_name_entry.ActivatesDefault = true;

			this.Dialog.TransientFor = parent_window;
			this.Dialog.DefaultResponse = ResponseType.Ok;

			Update ();
		}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:26,代码来源:PhotoVersionCommands.cs

示例3: Execute

        public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window)
        {
            // FIXME HIG-ify.
            Dialog dialog = new Dialog ();
            dialog.BorderWidth = 6;
            dialog.TransientFor = parent_window;
            dialog.HasSeparator = false;
            dialog.Title = Catalog.GetString ("Really Delete?");
            dialog.AddButton (Catalog.GetString ("Cancel"), (int) ResponseType.Cancel);
            dialog.AddButton (Catalog.GetString ("Delete"), (int) ResponseType.Ok);
            dialog.DefaultResponse = ResponseType.Ok;

            string version_name = photo.GetVersion (photo.DefaultVersionId).Name;
            Label label = new Label (String.Format (Catalog.GetString ("Really delete version \"{0}\"?"), version_name));
            label.Show ();
            dialog.VBox.PackStart (label, false, true, 6);;

            if (dialog.Run () == (int) ResponseType.Ok) {
                try {
                    photo.DeleteVersion (photo.DefaultVersionId);
                    store.Commit (photo);
                } catch (Exception e) {
                    Log.DebugException (e);
                    string msg = Catalog.GetString ("Could not delete a version");
                    string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to delete version \"{1}\""),
                                     e.Message, photo.Name);

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

                dialog.Destroy ();
                return true;
            }

            dialog.Destroy ();
            return false;
        }
开发者ID:iainlane,项目名称:f-spot,代码行数:44,代码来源:PhotoVersionCommands.cs

示例4: UpdateMD5Sum

	public void UpdateMD5Sum (Photo photo) {
		string md5_sum = Photo.GenerateMD5 (photo.VersionUri (Photo.OriginalVersionId)); 
		photo.MD5Sum = md5_sum;

		Database.ExecuteNonQuery (
			new DbCommand (
				"UPDATE photos " +
				"SET    md5_sum = :md5_sum " +
				"WHERE  ID = :id",
				"md5_sum", md5_sum,
				"id", photo.Id
			)
		);

		foreach (uint version_id in photo.VersionIds) {
			if (version_id == Photo.OriginalVersionId)
			 	continue;

			PhotoVersion version = photo.GetVersion (version_id) as PhotoVersion;

			string version_md5_sum = Photo.GenerateMD5 (version.Uri);

			if (version.MD5Sum == version_md5_sum)
			 	continue;

			version.MD5Sum = version_md5_sum; 
			photo.Changes.ChangeVersion (version_id);
		}

		Commit (photo);
	}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:31,代码来源:PhotoStore.cs

示例5: Update

	private PhotoChanges Update (Photo photo) {
		PhotoChanges changes = photo.Changes;
		// Update photo.
		if (changes.DescriptionChanged || changes.DefaultVersionIdChanged || changes.TimeChanged || changes.UriChanged || changes.RatingChanged || changes.MD5SumChanged )
			Database.ExecuteNonQuery (
				new DbCommand (
					"UPDATE photos " + 
					"SET description = :description, " + 
					"    default_version_id = :default_version_id, " + 
					"    time = :time, " + 
					"    uri = :uri, " +
					"    rating = :rating, " +
					"    md5_sum = :md5_sum	" +
					"WHERE id = :id ",
					"description", photo.Description,
					"default_version_id", photo.DefaultVersionId,
					"time", DbUtils.UnixTimeFromDateTime (photo.Time),
					"uri", photo.VersionUri (Photo.OriginalVersionId).OriginalString,
					"rating", String.Format ("{0}", photo.Rating),
					"md5_sum", photo.MD5Sum,
					"id", photo.Id
				)
			);

		// Update tags.
		if (changes.TagsRemoved != null)
			foreach (Tag tag in changes.TagsRemoved)
				Database.ExecuteNonQuery (new DbCommand (
					"DELETE FROM photo_tags WHERE photo_id = :photo_id AND tag_id = :tag_id",
					"photo_id", photo.Id,
					"tag_id", tag.Id));

		if (changes.TagsAdded != null)
			foreach (Tag tag in changes.TagsAdded)
				Database.ExecuteNonQuery (new DbCommand (
					"INSERT OR IGNORE INTO photo_tags (photo_id, tag_id) " +
					"VALUES (:photo_id, :tag_id)",
					"photo_id", photo.Id,
					"tag_id", tag.Id));

		// Update versions.
		if (changes.VersionsRemoved != null)
			foreach (uint version_id in changes.VersionsRemoved)
				Database.ExecuteNonQuery (new DbCommand (
					"DELETE FROM photo_versions WHERE photo_id = :photo_id AND version_id = :version_id",
					"photo_id", photo.Id,
					"version_id", version_id));

		if (changes.VersionsAdded != null)
			foreach (uint version_id in changes.VersionsAdded) {
				PhotoVersion version = photo.GetVersion (version_id) as PhotoVersion;
				Database.ExecuteNonQuery (new DbCommand (
					"INSERT OR IGNORE INTO photo_versions (photo_id, version_id, name, uri, protected, md5_sum) " +
					"VALUES (:photo_id, :version_id, :name, :uri, :is_protected, :md5_sum)",
					"photo_id", photo.Id,
					"version_id", version_id,
					"name", version.Name,
					"uri", version.Uri.ToString (),
					"is_protected", version.IsProtected,
					"md5_sum", version.MD5Sum));
			}
		if (changes.VersionsModified != null)
			foreach (uint version_id in changes.VersionsModified) {
				PhotoVersion version = photo.GetVersion (version_id) as PhotoVersion;
				Database.ExecuteNonQuery (new DbCommand (
					"UPDATE photo_versions SET name = :name, " +
					"uri = :uri, protected = :protected, md5_sum = :md5_sum " +
					"WHERE photo_id = :photo_id AND version_id = :version_id",
					"name", version.Name,
					"uri", version.Uri.ToString (),
					"protected", version.IsProtected,
					"photo_id", photo.Id,
					"md5_sum", version.MD5Sum,
					"version_id", version_id));
			}
		photo.Changes = null;
		return changes;
	}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:78,代码来源:PhotoStore.cs


注:本文中的Photo.GetVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。