static public Gdk.Pixbuf LoadAtMaxSize(IPhoto item, int width, int height) { using (var img = ImageFile.Create(item.DefaultVersion.Uri)) { Gdk.Pixbuf pixbuf = img.Load(width, height); return(pixbuf); } }
public void RemovePhoto(IPhoto photo) { var p = new Photo(photo); _db.Delete(p); _db.SaveChanges(); }
static public Gdk.Pixbuf Load(IPhoto item) { using (var img = ImageFile.Create(item.DefaultVersion.Uri)) { Gdk.Pixbuf pixbuf = img.Load(); return(pixbuf); } }
public void AddPhoto(IPhoto photo) { var p = new Photo(photo); _db.Update(p); _db.SaveChanges(); }
void HandleItemChanged(object sender, BrowsablePointerChangedEventArgs args) { //back_button.Sensitive = (Item.Index > 0 && collection.Count > 0); //forward_button.Sensitive = (Item.Index < collection.Count - 1); if (item.IsValid) { IPhoto curr_item = item.Current; name_label.Text = Uri.UnescapeDataString(curr_item.Name); old_label.Text = (curr_item.Time).ToString(); int i = collection.Count > 0 ? item.Index + 1: 0; // Note for translators: This indicates the current photo is photo {0} of {1} out of photos count_label.Text = string.Format(Catalog.GetString("{0} of {1}"), i, collection.Count); DateTime actual = curr_item.Time; date_edit.Time = actual; gnome_dateedit_sucks = date_edit.Time - actual; } HandleTimeChanged(this, EventArgs.Empty); photo_spin.Value = item.Index + 1; }
public CustomerController() { photorepo = new PhotoRepo(); userRepo = new UserRepo(); catRepo = new CategaryRepo(); cartRepo = new CartRepo(); }
public HospitalController(IPhoto iPhoto) { this.iPhoto = iPhoto; dbContext = new CaremeDBContext(); hospitalRepo = new HospitalRepository(dbContext); docHosRepo = new DoctorHospitalRepository(dbContext); }
public PhotoVersionMenu(IPhoto photo) { Version = photo.DefaultVersion; version_mapping = new Dictionary<MenuItem, IPhotoVersion> (); foreach (IPhotoVersion version in photo.Versions) { MenuItem menu_item = new MenuItem (version.Name); menu_item.Show (); menu_item.Sensitive = true; Gtk.Label child = ((Gtk.Label) menu_item.Child); if (version == photo.DefaultVersion) { child.UseMarkup = true; child.Markup = String.Format ("<b>{0}</b>", version.Name); } version_mapping.Add (menu_item, version); Append (menu_item); } if (version_mapping.Count == 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); } }
public void UpdateThumbnail(int thumbnail_num) { IPhoto photo = Collection [thumbnail_num]; Cache.Remove(photo.DefaultVersion.Uri); InvalidateCell(thumbnail_num); }
public static int CompareDefaultVersionUri(this IPhoto photo1, IPhoto photo2) { var photo1_uri = Path.Combine(photo1.DefaultVersion.BaseUri, photo1.DefaultVersion.Filename); var photo2_uri = Path.Combine(photo2.DefaultVersion.BaseUri, photo2.DefaultVersion.Filename); return(string.Compare(photo1_uri, photo2_uri)); }
public bool Import(Photo photo, IPhoto importing_from) { using (var metadata = Metadata.Parse(importing_from.DefaultVersion.Uri)) { if (metadata == null) { return(true); } // Copy Rating var rating = metadata.ImageTag.Rating; if (rating.HasValue) { var rating_val = Math.Min(metadata.ImageTag.Rating.Value, 5); photo.Rating = Math.Max(0, rating_val); } // Copy Keywords foreach (var keyword in metadata.ImageTag.Keywords) { AddTagToPhoto(photo, keyword); } // XXX: We might want to copy more data. } return(true); }
private bool DelayedUpdateHistogram() { if (Photos.Length == 0) { return(false); } IPhoto photo = Photos[0]; Gdk.Pixbuf hint = histogram_hint; histogram_hint = null; int max = histogram_expander.Allocation.Width; try { if (hint == null) { using (var img = ImageFile.Create(photo.DefaultVersion.Uri)) { hint = img.Load(256, 256); } } histogram_image.Pixbuf = histogram.Generate(hint, max); hint.Dispose(); } catch (System.Exception e) { Hyena.Log.Debug(e.StackTrace); using (Gdk.Pixbuf empty = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 256, 256)) { empty.Fill(0x0); histogram_image.Pixbuf = histogram.Generate(empty, max); } } return(false); }
public static Gdk.Pixbuf Load(IPhoto item) { using (var img = ImageFile.Create (item.DefaultVersion.Uri)) { Gdk.Pixbuf pixbuf = img.Load (); return pixbuf; } }
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; }
public bool SaveAsMore(IPhoto imageBuffer, string filename) { var retVal = false; if (imageBuffer.Image == null) { return(retVal); } using (var ms = new MemoryStream(imageBuffer.Image)) { using (System.Drawing.Image FullsizeImage = System.Drawing.Image.FromStream(ms)) { try { FullsizeImage.Save(filename); retVal = true; } catch (ExternalException ex) { //ERROR MESSAGE NEEDED //log.Error("The was in interop error while trying to save an IImageStorage image to the following file name {0}.".FormatWith(filename), ex); } catch (Exception ex) { //ERROR MESSAGE NEEDED //log.Error("The was in error while trying to save an IImageStorage image to the following file name {0}.".FormatWith(filename), ex); } } } return(retVal); }
public static Gdk.Pixbuf LoadAtMaxSize(IPhoto item, int width, int height) { using (var img = ImageFile.Create (item.DefaultVersion.Uri)) { Gdk.Pixbuf pixbuf = img.Load (width, height); return pixbuf; } }
public void Save(IPhoto photo, out bool success) { success = false; Checks.Argument.IsNotNull(photo, "photo"); //ValidateTempImageStorage(tempImageStorage, out validationState); //if (!validationState.IsValid) //{ // return; //} if (null == this.GetPhoto(photo.PhotoId)) { try { _repo.Add(photo); success = true; } catch (Exception ex) { success = false; //var valState = new ValidationState(); //valState.Errors.Add(new ValidationError("Id.AlreadyExists", tempImageStorage, ex.Message)); //validationState.Append(typeof(ITempImageStorage), valState); } } }
public void Populate(IPhoto [] photos) { Dictionary<uint, Tag> dict = new Dictionary<uint, Tag> (); if (photos != null) { foreach (IPhoto p in photos) { foreach (Tag t in p.Tags) { if (!dict.ContainsKey (t.Id)) { dict.Add (t.Id, t); } } } } foreach (Widget w in this.Children) { w.Destroy (); } if (dict.Count == 0) { /* Fixme this should really set parent menu items insensitve */ MenuItem item = new MenuItem (Mono.Unix.Catalog.GetString ("(No Tags)")); this.Append (item); item.Sensitive = false; item.ShowAll (); return; } foreach (Tag t in dict.Values) { MenuItem item = new TagMenu.TagMenuItem (t); this.Append (item); item.ShowAll (); item.Activated += HandleActivate; } }
public Photo CreateFrom(IPhoto item, uint roll_id) { Photo photo; long unix_time = DateTimeUtil.FromDateTime(item.Time); string description = item.Description ?? String.Empty; uint id = (uint)Database.Execute( new HyenaSqliteCommand( "INSERT INTO photos (time, base_uri, filename, description, roll_id, default_version_id, rating) " + "VALUES (?, ?, ?, ?, ?, ?, ?)", unix_time, item.DefaultVersion.BaseUri.ToString(), item.DefaultVersion.Filename, description, roll_id, Photo.OriginalVersionId, "0" ) ); photo = new Photo(id, unix_time); photo.AddVersionUnsafely(Photo.OriginalVersionId, item.DefaultVersion.BaseUri, item.DefaultVersion.Filename, item.DefaultVersion.ImportMD5, Catalog.GetString("Original"), true); photo.AllVersionsLoaded = true; InsertVersion(photo, photo.DefaultVersion as PhotoVersion); EmitAdded(photo); return(photo); }
public void Save(IPhoto tempImageStorage, IImageFormatSpec mediaFormat, out bool success) { success = false; Checks.Argument.IsNotNull(tempImageStorage, "tempImageStorage"); Checks.Argument.IsNotNull(mediaFormat, "mediaFormat"); Checks.Argument.IsNotNull(_tempImageStorageRepository, "_tempImageStorageRepository"); //ValidateTempImageStorage(tempImageStorage, out validationState); //if (!validationState.IsValid) //{ // return; //} if (null == this.GetImage(tempImageStorage.PhotoId)) { try { _tempImageStorageRepository.Add(tempImageStorage); success = true; } catch (Exception ex) { success = false; //var valState = new ValidationState(); //valState.Errors.Add(new ValidationError("Id.AlreadyExists", tempImageStorage, ex.Message)); //validationState.Append(typeof(ITempImageStorage), valState); } } }
/// <summary> /// Авторизовать пользователя для изменения (добавления, /// удаления) фотографии. /// </summary> /// <param name="photo">Фотография.</param> private void AuthorizeForPhotoOperations(IPhoto photo) { if (photo.FirmId != null && photo.RealtyObjectId != null) { throw new InvalidOperationException( "Фотография не может иметь id фирмы и id объекта недвижимости одновременно."); } if (photo.FirmId != null) { if (!this.AuthorizationMechanism.UserHasAccessToPhotos( this.CurrentUserInfo, this.firms.Find(photo.FirmId ?? 0))) { this.ThrowUnauthorizedResponseException( "Данный пользователь не может редактировать фотографии данной фирмы."); } } else if (photo.RealtyObjectId != null) { if (!this.AuthorizationMechanism.UserHasAccessToPhotos( this.CurrentUserInfo, this.realtyObjects.Find(photo.RealtyObjectId ?? 0))) { this.ThrowUnauthorizedResponseException( "Данный пользователь не может редактировать фотографии данного объекта недвижимости."); } } else { throw new InvalidOperationException( "Фотография должна иметь либо Id фирмы, либо Id объекта недвижимости."); } }
public ProductsController(INews news, IModule module, IPhoto photo, ICacheManager cache) { _news = news; _module = module; _cache = cache; _photo = photo; }
public Task <bool> DeletePhoto(IPhoto result) { string fullFileName = string.Format("{0}{1}.{2}", AppPath, result.File, result.Ext); using (var db = new OcphDbContext()) { var trans = db.BeginTransaction(); try { var isDeleted = db.Photos.Delete(O => O.Id == result.Id); if (isDeleted) { File.Delete(fullFileName); trans.Commit(); return(Task.FromResult(isDeleted)); } else { throw new SystemException("Photo Tidak Terhapus"); } } catch (Exception ex) { trans.Rollback(); throw new SystemException(ex.Message); } } }
public BrowsablePointerChangedEventArgs(IPhoto previous_item, int previous_index, IBrowsableItemChanges changes) : base() { PreviousItem = previous_item; PreviousIndex = previous_index; Changes = changes; }
static public Gdk.Pixbuf Load(IPhoto item) { using (var img = App.Instance.Container.Resolve <IImageFileFactory> ().Create(item.DefaultVersion.Uri)) { Gdk.Pixbuf pixbuf = img.Load(); return(pixbuf); } }
public PrintOperation(IPhoto [] selected_photos) { this.selected_photos = selected_photos; CustomTabLabel = Catalog.GetString ("Image Settings"); NPages = selected_photos.Length; DefaultPageSetup = Global.PageSetup; }
public bool CreateTicketStubNow(IPhoto photo, Guid?showId) { bool final = false; var ticketStubId = Guid.NewGuid(); using (IUnitOfWork uow = UnitOfWork.Begin()) { var ticketStubService = new TicketStubService(Ioc.GetInstance <ITicketStubRepository>()); var myShowService = new MyShowService(Ioc.GetInstance <IMyShowRepository>()); var spService = new MyShowTicketStubService(Ioc.GetInstance <IMyShowTicketStubRepository>()); var userId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString()); //var myShowId = myShowService.GetMyShow(showId.Value, userId).MyShowId; TicketStub p = new TicketStub { CreatedDate = DateTime.Now, PhotoId = photo.PhotoId, TicketStubId = ticketStubId, Notes = photo.Notes, UserId = photo.UserId, ShowId = showId }; bool success = false; ticketStubService.Save(p, out success); if (success) { uow.Commit(); } } return(final); }
public override void Render(Drawable window, Widget widget, Rectangle cell_area, Rectangle expose_area, StateType cell_state, IPhoto photo) { string text = GetRenderText (photo); var layout = new Pango.Layout (widget.PangoContext); layout.SetText (text); Rectangle layout_bounds; layout.GetPixelSize (out layout_bounds.Width, out layout_bounds.Height); layout_bounds.Y = cell_area.Y; layout_bounds.X = cell_area.X + (cell_area.Width - layout_bounds.Width) / 2; if (layout_bounds.IntersectsWith (expose_area)) { Style.PaintLayout (widget.Style, window, cell_state, true, expose_area, widget, "IconView", layout_bounds.X, layout_bounds.Y, layout); } }
public override void Render(Drawable window, Widget widget, Rectangle cell_area, Rectangle expose_area, StateType cell_state, IPhoto photo) { string text = GetRenderText(photo); var layout = new Pango.Layout(widget.PangoContext); layout.SetText(text); Rectangle layout_bounds; layout.GetPixelSize(out layout_bounds.Width, out layout_bounds.Height); layout_bounds.Y = cell_area.Y; layout_bounds.X = cell_area.X + (cell_area.Width - layout_bounds.Width) / 2; if (layout_bounds.IntersectsWith(expose_area)) { Style.PaintLayout(widget.Style, window, cell_state, true, expose_area, widget, "IconView", layout_bounds.X, layout_bounds.Y, layout); } }
public void CopyIfNeeded (IPhoto item, SafeUri destinationBase) { // remember source uri for copying xmp file SafeUri defaultVersionUri = item.DefaultVersion.Uri; foreach (IPhotoVersion version in item.Versions) { // Copy into photo folder and update IPhotoVersion uri var source = version.Uri; var destination = destinationBase.Append (source.GetFilename ()); if (!source.Equals (destination)) { destination = GetUniqueFilename (destination); file_system.File.Copy (source, destination, false); copied_files.Add (destination); original_files.Add (source); version.Uri = destination; } } // Copy XMP sidecar var xmp_original = defaultVersionUri.ReplaceExtension(".xmp"); if (file_system.File.Exists (xmp_original)) { var xmp_destination = item.DefaultVersion.Uri.ReplaceExtension (".xmp"); file_system.File.Copy (xmp_original, xmp_destination, true); copied_files.Add (xmp_destination); original_files.Add (xmp_original); } }
private void OnPhotoUploaded(IPhoto item) { Debug.Assert(null != item); if (!model.AttachTags && !model.RemoveTags) { return; } PhotoStore photo_store = FSpot.App.Instance.Database.Photos; FSpot.Photo photo = photo_store.GetByUri( item.DefaultVersion.Uri); Debug.Assert(null != photo); if (null == photo) { return; } if (model.AttachTags) { photo.AddTag(model.AttachedTags); } if (model.RemoveTags) { photo.RemoveTag(model.RemovedTags); } photo_store.Commit(photo); }
public void B3_CarteMemVider() { m_maxScore += 4; ICarteMemoire target = CréerUneCarteMemoireTest(); IPhoto objPhotoTest = CréerUnePhotoTest(); // on va ajouter quelques photos int nbPhotos = m_objRandom.Next(5, 10); for (int index = 0; index < nbPhotos; index++) { target.Ajouter(CréerUnePhotoTest()); } Assert.AreEqual(nbPhotos, target.NbPhotos); m_totalScore++; // On va tester la méthode permettant de vider la carte target.Vider(); Assert.AreEqual(0, target.NbPhotos); m_totalScore++; Assert.AreEqual(0, target.EspaceUtilise); m_totalScore++; Assert.AreEqual(target.EspaceDisponible, target.TailleEnOctets); m_totalScore++; }
public PhotoSizesCollection(IReadOnlyCollection <IPhoto> source) { Source = source; var smallestLargePreviewDifference = (Double)Int32.MaxValue; var smallestPreviewDifference = (Double)Int32.MaxValue; foreach (var photo in source) { if ((Original == null) || (photo.Size.Width > Original.Size.Width) && (photo.Size.Height > Original.Size.Height) || (photo.Size.Width > Original.Size.Width) && (photo.Size.Height == Original.Size.Height) || (photo.Size.Width == Original.Size.Width) && (photo.Size.Height > Original.Size.Height)) { Original = photo; } if (LargePreview == null) { LargePreview = photo; } else if ((photo.Size.IsPortrait() && (Math.Abs(photo.Size.Width - LargePreviewBoundary) < smallestLargePreviewDifference)) || (photo.Size.IsLandscape() && (Math.Abs(photo.Size.Height - LargePreviewBoundary) < smallestLargePreviewDifference))) { smallestLargePreviewDifference = photo.Size.IsPortrait() ? Math.Abs(photo.Size.Width - LargePreviewBoundary) : Math.Abs(photo.Size.Height - LargePreviewBoundary); LargePreview = photo; } if ((Preview == null) || (photo.Size.IsPortrait() && (Math.Abs(photo.Size.Width - PreviewBoundary) < smallestPreviewDifference)) || (photo.Size.IsLandscape() && (Math.Abs(photo.Size.Height - PreviewBoundary) < smallestPreviewDifference))) { smallestPreviewDifference = photo.Size.IsPortrait() ? Math.Abs(photo.Size.Width - PreviewBoundary) : Math.Abs(photo.Size.Height - PreviewBoundary); Preview = photo; } } Size = Original.Size; }
void CopyIfNeeded(IPhoto item, SafeUri destination) { if (item.DefaultVersion.Uri.Equals(destination)) { return; } // Copy image var file = GLib.FileFactory.NewForUri(item.DefaultVersion.Uri); var new_file = GLib.FileFactory.NewForUri(destination); file.Copy(new_file, GLib.FileCopyFlags.AllMetadata, null, null); copied_files.Add(destination); original_files.Add(item.DefaultVersion.Uri); item.DefaultVersion.Uri = destination; // Copy XMP sidecar var xmp_original = item.DefaultVersion.Uri.ReplaceExtension(".xmp"); var xmp_file = GLib.FileFactory.NewForUri(xmp_original); if (xmp_file.Exists) { var xmp_destination = destination.ReplaceExtension(".xmp"); var new_xmp_file = GLib.FileFactory.NewForUri(xmp_destination); xmp_file.Copy(new_xmp_file, GLib.FileCopyFlags.AllMetadata | GLib.FileCopyFlags.Overwrite, null, null); copied_files.Add(xmp_destination); original_files.Add(xmp_original); } }
static public Gdk.Pixbuf LoadAtMaxSize(IPhoto item, int width, int height) { using (var img = App.Instance.Container.Resolve <IImageFileFactory> ().Create(item.DefaultVersion.Uri)) { Gdk.Pixbuf pixbuf = img.Load(width, height); return(pixbuf); } }
public CasesController(INews news, IModule module, IPhoto photo, ICacheManager cache) { _news = news; _module = module; _cache = cache; _photo = photo; }
public void CopyIfNeeded(IPhoto item, SafeUri destinationBase) { // remember source uri for copying xmp file SafeUri defaultVersionUri = item.DefaultVersion.Uri; foreach (IPhotoVersion version in item.Versions) { // Copy into photo folder and update IPhotoVersion uri var source = version.Uri; var destination = destinationBase.Append(source.GetFilename()); if (!source.Equals(destination)) { destination = GetUniqueFilename(destination); file_system.File.Copy(source, destination, false); copied_files.Add(destination); original_files.Add(source); version.Uri = destination; } } // Copy XMP sidecar var xmp_original = defaultVersionUri.ReplaceExtension(".xmp"); if (file_system.File.Exists(xmp_original)) { var xmp_destination = item.DefaultVersion.Uri.ReplaceExtension(".xmp"); file_system.File.Copy(xmp_original, xmp_destination, true); copied_files.Add(xmp_destination); original_files.Add(xmp_original); } }
public PhotoVersionMenu(IPhoto photo) { Version = photo.DefaultVersion; version_mapping = new Dictionary <MenuItem, IPhotoVersion> (); foreach (IPhotoVersion version in photo.Versions) { MenuItem menu_item = new MenuItem(version.Name); menu_item.Show(); menu_item.Sensitive = true; Gtk.Label child = ((Gtk.Label)menu_item.Child); if (version == photo.DefaultVersion) { child.UseMarkup = true; child.Markup = String.Format("<b>{0}</b>", version.Name); } version_mapping.Add(menu_item, version); Append(menu_item); } if (version_mapping.Count == 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); } }
public static MvcHtmlString RemovablePhoto(this HtmlHelper html, IPhoto photo, PhotoSize inlineSize = PhotoSize.SquareThumbnail, PhotoSize zoomableSize = PhotoSize.Large) { UrlHelper url = new UrlHelper(html.ViewContext.RequestContext); switch (inlineSize) { case PhotoSize.Thumbnail: case PhotoSize.SquareThumbnail: return(MvcHtmlString.Create( Tag.Img().Attr("src", url.Action(MVC.Photos.ViewPhoto(photo.StaticId, inlineSize))).Attr("alt", string.Empty).ToString() + Tag.Div().Css("actions") .InnerHtml(html.AnchorButton("View", url.Action(MVC.Photos.ViewPhoto(photo.StaticId, zoomableSize)), photo.HasCaption ? (object)new { @class = "View", rel = "facebox", data_captionurl = url.Action(MVC.Photos.Caption(photo.CaptionId)) } : new { @class = "View", rel = "facebox" }, ButtonColor.Orange, ButtonSize.Small) ).InnerText(" ") // space here is needed for proper html rendering .InnerHtml(html.AnchorButton("Remove", url.Action(MVC.Photos.Remove(photo.Id)), new { @class = "Remove" }, ButtonColor.Grey, ButtonSize.Small) ).ToString() )); default: throw new NotImplementedException(); } }
public ActionResult Index() { string identificateur = User.Identity.GetUserId(); photo = new Photo(); Session["image"] = photo.GetCurrentPhoto(identificateur); return View(); }
public PhotoVersionMenu(IPhoto photo) { Version = photo.DefaultVersion; versionMapping = new Dictionary <MenuItem, IPhotoVersion> (); foreach (var version in photo.Versions) { var menu_item = new MenuItem(version.Name); menu_item.Show(); menu_item.Sensitive = true; var child = ((Gtk.Label)menu_item.Child); if (version == photo.DefaultVersion) { child.UseMarkup = true; child.Markup = $"<b>{version.Name}</b>"; } versionMapping.Add(menu_item, version); Append(menu_item); } if (versionMapping.Count == 1) { var no_edits_menu_item = new MenuItem(Strings.ParenNoEditsParen); no_edits_menu_item.Show(); no_edits_menu_item.Sensitive = false; Append(no_edits_menu_item); } }
public Photo(IPhoto photo) { PhotoId = photo.PhotoId; PhotoName = photo.PhotoName; PhotoType = photo.PhotoType; PhotoPath = photo.PhotoPath; GalleryId = photo.GalleryId; }
public void InvalidateThumbnail (IPhoto photo) { PhotoGridViewChild child = GetDrawingChild (photo); if (child != null) { child.InvalidateThumbnail (); View.QueueDraw (); } }
/// <summary> /// Initializes a new instance of the <see cref="ViewPhotoForm"/> class. /// </summary> /// <param name="currentAlbum">The album whose photos the user is viewing.</param> /// <param name="photoToDisplay">the specific photo to view.</param> /// <remarks> /// Author(s): Miguel Gonzales and Andrea Tan /// </remarks> public ViewPhotoForm(IAlbum currentAlbum, IPhoto photoToDisplay) { this.InitializeComponent(); this.album = currentAlbum; this.Text = this.album.AlbumId + " - Photo Buddy"; this.allPhotosInAlbum = new List<IPhoto>(this.album.Photos); this.photoIndex = this.allPhotosInAlbum.IndexOf(photoToDisplay); this.DisplayPhoto(this.photoIndex); }
public FileContentResult getImg(int newWidth, int newHeight) { string identificateur = User.Identity.GetUserId(); photo = new Photo(); byte[] byteArray = photo.GetCurrentPhoto(identificateur); return byteArray != null ? new FileContentResult(ResizeImage(byteArray, newWidth, newHeight), "image/jpeg") : null; }
protected PhotoGridViewChild GetDrawingChild (IPhoto photo) { foreach (PhotoGridViewChild child in Children) { if (child != null && child.BoundPhoto == photo) { return child; } } return null; }
public PhotoVersion(IPhoto photo, uint version_id, SafeUri base_uri, string filename, string md5_sum, string name, bool is_protected) { Photo = photo; VersionId = version_id; BaseUri = base_uri; Filename = filename; ImportMD5 = md5_sum; Name = name; IsProtected = is_protected; }
/// <summary> /// Initializes a new instance of the <see cref="UploadViewForm"/> class. /// </summary> /// <param name="photo">The photo to display.</param> /// <remarks> /// <para>Author: Jim Counts and Eric Wei</para> /// <para>Created: 2011-10-25</para> /// <para>Modified: 2011-10-25</para> /// <para> /// Creates an instance of the UploadViewForm that is configured to rename a photo. /// </para> /// </remarks> public UploadViewForm(IPhoto photo) { this.InitializeComponent(); Album = photo.Album; this.Text = Format.Culture("{0} {1} - Photo Buddy", "Rename", photo.DisplayName); this.UploadViewBox.Image = photo.Image; this.displayNameTextBox.Text = photo.DisplayName; this.messageLabel.Text = "This is the photo you have selected to rename."; }
public void SaveCommit(IPhoto photo, IImageFormatSpec mediaFormat, out bool success) { using (var unitOfWork = UnitOfWork.Begin()) { Save(photo, mediaFormat, out success); if (success) { unitOfWork.Commit(); } } }
public void SaveCommit(IPhoto photo, out bool success) { using (var unitOfWork = UnitOfWork.Begin()) { Save(photo, out success); if (success) { unitOfWork.Commit(); } } }
public BrowsablePointer(IBrowsableCollection collection, int index) { if (collection == null) throw new ArgumentNullException ("collection"); this.collection = collection; Index = index; item = Current; collection.Changed += HandleCollectionChanged; collection.ItemsChanged += HandleCollectionItemsChanged; }
public static int Compare(this IPhoto photo1, IPhoto photo2) { int result = photo1.CompareDate (photo2); if (result == 0) result = CompareDefaultVersionUri (photo1, photo2); if (result == 0) result = photo1.CompareName (photo2); return result; }
public ActionResult MonProfil() { string identificateur = User.Identity.GetUserId(); photo = new Photo(); ProfileModels model = new ProfileModels(); var user = UserManager.FindById(identificateur); model.Email = user.Email; model.PhoneNumber = user.PhoneNumber; return View(model); }
public static MipMapFile LoadMipMap (IPhoto photo) { var mipmap_uri = MipMapUri (photo); try { return new MipMapFile (mipmap_uri); } catch {} GenerateMipMap (photo); return new MipMapFile (mipmap_uri); }
private PhotoViewModel MapProfilePics(IPhoto profilePic) { PhotoViewModel model = new PhotoViewModel { DateAdded = profilePic.DateAdded, IsCurrent = profilePic.IsCurrent, StudentId = profilePic.StudentId, PicId = profilePic.PicId, FileName = profilePic.FileName, Caption = profilePic.Caption, }; return model; }
public void RegisterPhoto (ICacheablePhotoSource source, IPhoto photo) { if (source.CacheId == 0) { throw new Exception ("The source needs to be registered first using RegisterPhotoSource ()"); } var cache_photo = SqliteCachedPhoto.CreateFrom (photo); cache_photo.SourceId = source.CacheId; provider.Save (cache_photo); source.RegisterCachedPhoto (photo, cache_photo.CacheId); }
public IPhotoLoader RequestLoader (IPhoto photo) { var key = photo.Uri.ToString (); WeakReference reference = null; IPhotoLoader loader = null; if (Loaders.TryGetValue (key, out reference)) { loader = reference.Target as IPhotoLoader; } if (loader == null) { loader = new MipMappedPhotoLoader (photo); Loaders[key] = new WeakReference (loader); } return loader; }
public void Render (CellContext context, Rect allocation, IPhoto photo) { string caption = GetCaptionString (photo); var text_color = context.Theme.Colors.GetWidgetColor (GtkColorClass.Text, context.State); var layout = context.Layout; layout.Ellipsize = Pango.EllipsizeMode.End; layout.Alignment = Pango.Alignment.Center; layout.Width = (int)(allocation.Width * Pango.Scale.PangoScale); layout.SetText (caption); context.Context.Color = text_color; context.Context.MoveTo (allocation.X, allocation.Y); PangoCairoHelper.ShowLayout (context.Context, layout); }
public override void Render(Drawable window, Widget widget, Rectangle cell_area, Rectangle expose_area, StateType cell_state, IPhoto photo) { if (photo.Rating > 0) { rating_renderer.Value = (int) photo.Rating; using (var rating_pixbuf = rating_renderer.RenderPixbuf ()) { rating_pixbuf.RenderToDrawable (window, widget.Style.WhiteGC, 0, 0, cell_area.X, cell_area.Y, -1, -1, RgbDither.None, 0, 0); } } }