ThumbnailCommand.Execute C# (CSharp) Method

Execute() public method

public Execute ( IPhoto photos ) : bool
photos IPhoto
return bool
	public bool Execute (IPhoto [] photos)
	{
		ProgressDialog progress_dialog = null;
		var loader = ThumbnailLoader.Default;
		
		if (photos.Length > 1) {
			progress_dialog = new ProgressDialog (Mono.Unix.Catalog.GetString ("Updating Thumbnails"),
							      ProgressDialog.CancelButtonType.Stop,
							      photos.Length, parent_window);
		}

		int count = 0;
		foreach (IPhoto photo in photos) {
			if (progress_dialog != null
			    && progress_dialog.Update (String.Format (Mono.Unix.Catalog.GetString ("Updating picture \"{0}\""), photo.Name)))
				break;

			foreach (IPhotoVersion version in photo.Versions) {
				loader.Request (version.Uri, ThumbnailSize.Large, 10);
			}

			count++;
		}

		if (progress_dialog != null)
			progress_dialog.Destroy ();

		return true;
	}
}

Usage Example

コード例 #1
0
	void HandleUpdateThumbnailCommand (object sender, EventArgs args)
	{
		ThumbnailCommand command = new ThumbnailCommand (main_window);

		int [] selected_ids = SelectedIds ();
		if (command.Execute (SelectedPhotos (selected_ids)))
#if MONO_1_9_0
			query.MarkChanged (selected_ids, new PhotoChanges {DataChanged = true});
#else
		{
			PhotoChanges changes = new PhotoChanges ();
			changes.DataChanged = true;
			query.MarkChanged (selected_ids, changes);
		}
#endif
	}
All Usage Examples Of ThumbnailCommand::Execute