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


C# Photo.GetVersionName方法代码示例

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


在下文中一共展示了Photo.GetVersionName方法的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.GetVersionName (id));
			menu_item.Show ();
			menu_item.Sensitive = true;
			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:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:26,代码来源: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.GetVersionName (photo.DefaultVersionId);
				version_name_entry.SelectRegion (0, -1);
				break;
			}

			version_name_entry.ActivatesDefault = true;

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

			Update ();
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:26,代码来源:PhotoVersionCommands.cs

示例3: Dump

	static void Dump (Photo photo)
	{
		Console.WriteLine ("\t[{0}] {1}", photo.Id, photo.Path);
		Console.WriteLine ("\t{0}", photo.Time.ToLocalTime ());

		if (photo.Description != String.Empty)
			Console.WriteLine ("\t{0}", photo.Description);
		else
			Console.WriteLine ("\t(no description)");

		Console.WriteLine ("\tTags:");

		if (photo.Tags.Count == 0) {
			Console.WriteLine ("\t\t(no tags)");
		} else {
			foreach (Tag t in photo.Tags)
				Console.WriteLine ("\t\t{0}", t.Name);
		}

		Console.WriteLine ("\tVersions:");

		foreach (uint id in photo.VersionIds)
			Console.WriteLine ("\t\t[{0}] {1}", id, photo.GetVersionName (id));
	}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:24,代码来源:PhotoStore.cs

示例4: Update

	private void Update (Photo photo) {
		// Update photo.

		Database.ExecuteNonQuery (new DbCommand ("UPDATE photos SET description = :description, " +
						     "default_version_id = :default_version_id, time = :time WHERE id = :id ",
						     "description", photo.Description,
						     "default_version_id", photo.DefaultVersionId,
						     "time", DbUtils.UnixTimeFromDateTime (photo.Time),
						     "id", photo.Id));

		// Update tags.

		Database.ExecuteNonQuery (new DbCommand ("DELETE FROM photo_tags WHERE photo_id = :id", "id", photo.Id));

		foreach (Tag tag in photo.Tags) {
			Database.ExecuteNonQuery (new DbCommand ("INSERT INTO photo_tags (photo_id, tag_id) " +
                                         " VALUES (:photo_id, :tag_id)",
                                         "photo_id", photo.Id, "tag_id", tag.Id));
		}

		// Update versions.

		Database.ExecuteNonQuery (new DbCommand ("DELETE FROM photo_versions WHERE photo_id = :id", "id", photo.Id));

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

			string version_name = photo.GetVersionName (version_id);

			Database.ExecuteNonQuery(new DbCommand ("INSERT INTO photo_versions (photo_id, version_id, name) " +
							     "       VALUES (:photo_id, :version_id, :name)",
							     "photo_id", photo.Id, "version_id", version_id, "name", version_name));
		}
	}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:35,代码来源:PhotoStore.cs

示例5: 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.GetVersionName (photo.DefaultVersionId);
			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) {
					// FIXME show error dialog.
					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:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:44,代码来源:PhotoVersionCommands.cs


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