• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Photo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: AvatarPhoto_Drop

        /// <summary>
        /// Handles Drop Event for setting the Avatar photo.
        /// </summary>
        private void AvatarPhoto_Drop(object sender, DragEventArgs e)
        {
            string[] fileNames = e.Data.GetData(DataFormats.FileDrop, true) as string[];

            if (fileNames.Length > 0)
            {
                Photo photo = new Photo(fileNames[0]);
                if (App.patient != null && App.patient.Photos != null)
                {
                    // Set IsAvatar to false for the existing photos
                    foreach (Photo existingPhoto in App.patient.Photos)
                    {
                        existingPhoto.IsAvatar = false;
                    }

                    // Make the dropped photo the  avatar photo
                    photo.IsAvatar = true;

                    // Add the avatar photo to the person photos
                    App.patient.Photos.Add(photo);

                    // Bitmap image for the avatar
                    BitmapImage bitmap = new BitmapImage(new Uri(photo.FullyQualifiedPath));

                    // Use BitmapCacheOption.OnLoad to prevent binding the source holding on to the photo file.
                    bitmap.CacheOption = BitmapCacheOption.OnLoad;

                    // Show the avatar
                    AvatarPhoto.Source = bitmap;
                }
            }

            // Mark the event as handled, so the control's native Drop handler is not called.
            e.Handled = true;
        }
开发者ID:sivarajankumar,项目名称:dentalsmile,代码行数:38,代码来源:PatientDetails.xaml.cs


示例2: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			Photo photo = null;
			if ( json != null && !json.IsNull )
			{
				photo = new Photo();
				photo.ID          = json.ContainsName("id"          ) ? json.GetValue<string>("id"      ) : String.Empty;
				photo.Name        = json.ContainsName("name"        ) ? json.GetValue<string>("name"    ) : String.Empty;
				photo.Icon        = json.ContainsName("icon"        ) ? json.GetValue<string>("icon"    ) : String.Empty;
				photo.Picture     = json.ContainsName("picture"     ) ? json.GetValue<string>("picture" ) : String.Empty;
				photo.Source      = json.ContainsName("source"      ) ? json.GetValue<string>("source"  ) : String.Empty;
				photo.Height      = json.ContainsName("height"      ) ? json.GetValue<int   >("height"  ) : 0;
				photo.Width       = json.ContainsName("width"       ) ? json.GetValue<int   >("width"   ) : 0;
				photo.Link        = json.ContainsName("link"        ) ? json.GetValue<string>("link"    ) : String.Empty;
				photo.Position    = json.ContainsName("position"    ) ? json.GetValue<int   >("position") : 0;
				photo.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;
				photo.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue<string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;
				
				photo.From        = mapper.Deserialize<Reference>(json.GetValue("from" ));
				photo.Place       = mapper.Deserialize<Page     >(json.GetValue("place"));
				photo.Tags        = mapper.Deserialize<List<Tag>>(json.GetValue("tags" ));
				photo.Images      = mapper.Deserialize<List<Photo.Image>>(json.GetValue("images"));
				if ( photo.Images != null )
				{
					int i = 0;
					if ( photo.Images.Count >= 5 ) photo.OversizedImage = photo.Images[i++];
					if ( photo.Images.Count >= 1 ) photo.SourceImage    = photo.Images[i++];
					if ( photo.Images.Count >= 2 ) photo.AlbumImage     = photo.Images[i++];
					if ( photo.Images.Count >= 3 ) photo.SmallImage     = photo.Images[i++];
					if ( photo.Images.Count >= 4 ) photo.TinyImage      = photo.Images[i++];
				}
			}
			return photo;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:34,代码来源:PhotoDeserializer.cs


示例3: Main

    static void Main()
    {
        // Application.Run acts as a simple client
        Photo photo;
        TaggedPhoto foodTaggedPhoto, colorTaggedPhoto, tag;
        BorderedPhoto composition;

        // Compose a photo with two TaggedPhotos and a blue BorderedPhoto
        photo = new Photo();
        foodTaggedPhoto = new TaggedPhoto(photo, "Food");
        colorTaggedPhoto = new TaggedPhoto(foodTaggedPhoto, "Yellow");
        Application.Run(colorTaggedPhoto);
        Console.WriteLine(colorTaggedPhoto.ListTaggedPhotos());

        // Compose a photo with one TaggedPhoto and a yellow BorderedPhoto
        photo = new Photo();
        composition = new BorderedPhoto(photo, Color.Yellow);
        Application.Run(composition);

        // Compose a Hominid with one TaggedPhoto hominid and a yellow BorderedPhoto hominid
        var hominid = new Hominid();
        tag = new TaggedPhoto(hominid, "Shocked!");
        Application.Run(tag);
        Console.WriteLine(tag.ListTaggedPhotos());
    }
开发者ID:jboyflaga,项目名称:CSharp3.0DesignPatternsJboysSolutions,代码行数:25,代码来源:Program.cs


示例4: Create

 //
 // GET: /Photo/Create
 public ActionResult Create()
 {
     // return View();
     Photo newPhoto = new Photo();
     newPhoto.CreatedDate = DateTime.Today;
     return View("Create", newPhoto);
 }
开发者ID:vel654321,项目名称:velsample,代码行数:9,代码来源:PhotoController.cs


示例5: SetPhoto

 public void SetPhoto(Photo p)
 {
     if (photo != null) photo.PropertyChanged -= new PropertyChangedEventHandler(photo_PropertyChanged);
     photo = p;
     if (photo != null) photo.PropertyChanged += new PropertyChangedEventHandler(photo_PropertyChanged);
     ShowImage();
 }
开发者ID:Infarch,项目名称:MyPerlModules,代码行数:7,代码来源:PhotoBinder.cs


示例6: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        user = Membership.GetUser();
        if (user != null)
            userName = user.UserName;

        if (Request.Params.AllKeys.Contains<string>("id"))
        {

            photoId = int.Parse(Request.Params.Get("id"));
            try
            {
                photo = new Photo(photoId);
                album = photo.getAlbum();
                photoUrl = "Photos/" + photo.getId() + ".jpg";
                comments = photo.getComments();
            }
            catch (Exception ex)
            {
                Response.Redirect("Default.aspx");
            }

        }
        else
        {
            Response.Redirect("Default.aspx");
        }
    }
开发者ID:hasnarobert,项目名称:Share-Photos,代码行数:28,代码来源:PhotoWall.aspx.cs


示例7: VisitPhoto

        public override Photo VisitPhoto(Photo photo, AnalyzerExecutionContext executionContext)
        {
            var tag = photo.Tag(Constants.Namespace, Constants.HashMetadataKey);

            if (tag != null)
            {
                List<Photo> list = null;

                if (_cache.ContainsKey(tag.Value))
                {
                    list = _cache[tag.Value];
                }
                else
                {
                    list = new List<Photo>();
                    _cache.Add(tag.Value, list);
                }

                list.Add(photo);

                if (list.Count == 2)
                {
                    var activity = new ResolveDuplicateActivity(list);

                    _currentFolderDuplicates.Add(activity);
                }
            }

            return photo;
        }
开发者ID:PhotoArchive,项目名称:core,代码行数:30,代码来源:DuplicateDetectionAnalyzer.cs


示例8: Execute

        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;
        }
开发者ID:iainlane,项目名称:f-spot,代码行数:30,代码来源:PhotoVersionCommands.cs


示例9: ConvertToDatabase

 internal static Db.Photo ConvertToDatabase(Photo dmn, Db.Photo db)
 {
     CvrtPhoto domain = new CvrtPhoto(dmn);
     db.Url = domain.Url;
     db.Description = domain.Description;
     return db;
 }
开发者ID:steve-haar,项目名称:StoreApp,代码行数:7,代码来源:CvrtPhoto.cs


示例10: AddButton_Click

        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            // Create a new person with the specified inputs
            Person newPerson = new Person(FirstNameInputTextBox.Text, LastNameInputTextBox.Text);

            // Setup the properties based on the input
            newPerson.Gender = ((bool)MaleRadioButton.IsChecked) ? Gender.Male : Gender.Female;
            newPerson.BirthPlace = BirthPlaceInputTextBox.Text;
            newPerson.IsLiving = true;

            DateTime birthdate = App.StringToDate(BirthDateInputTextBox.Text);
            if (birthdate != DateTime.MinValue)
                newPerson.BirthDate = birthdate;

            // Setup the avatar photo
            if (!string.IsNullOrEmpty(avatarPhotoPath))
            {
                Photo photo = new Photo(avatarPhotoPath);
                photo.IsAvatar = true;

                // Add the avatar photo to the person photos
                newPerson.Photos.Add(photo);
            }

            family.Current = newPerson;
            family.Add(newPerson);

            family.OnContentChanged();

            RaiseEvent(new RoutedEventArgs(AddButtonClickEvent));
        }
开发者ID:ssickles,项目名称:archive,代码行数:31,代码来源:NewUserControl.xaml.cs


示例11: buildNewPhotoData

    // The job of the PhotoRecorder is to create parameters for Photo objects.
    // Rendering of Photo objects can then be performed by PhotoVisualiser.
    public Photo buildNewPhotoData(int para_questGiverID,
	                                 				int para_activityOwnerID,
	                                 				ApplicationID para_activityKey,
	                                 				int para_langAreaID,
	                                 				int para_difficultyIndex)
    {
        // The photo will fall under the quest giver's album.
        GhostbookManagerLight gbMang = GhostbookManagerLight.getInstance();
        //IGBDifficultyReference diffRefMat = gbMang.getDifficultyReferenceMaterial();

        // Extract player avatar details.
        GameObject poRef = PersistentObjMang.getInstance();
        DatastoreScript ds = poRef.GetComponent<DatastoreScript>();
        PlayerAvatarSettings playerAvSettings = (PlayerAvatarSettings) ds.getData("PlayerAvatarSettings");

        // Add background randomisation when assets become available.
        int backgroundID = Random.Range(0,2);

        // Get difficulty name.
        string diffName = gbMang.createDifficultyShortDescription(para_langAreaID,para_difficultyIndex);
        if(diffName == null) { diffName = "N/A"; }

        Photo nwPhoto = new Photo(para_activityKey,
                                  				  backgroundID,
                                  				  new PhotoCharacterElement(para_questGiverID,Random.Range(1,4),null),
                                                  new PhotoCharacterElement(para_activityOwnerID,Random.Range(1,4),null),
                                                  playerAvSettings,
                                  				  Random.Range(1,4),
                                                  diffName,
                                                  null);

        return nwPhoto;
    }
开发者ID:TAPeri,项目名称:WordsMatter,代码行数:35,代码来源:PhotoRecorder.cs


示例12: Execute

	public bool Execute (Photo [] photos)
	{
		ProgressDialog progress_dialog = null;

		if (photos.Length > 1) {
			progress_dialog = new ProgressDialog ("Updating Thumbnails",
							      ProgressDialog.CancelButtonType.Stop,
							      photos.Length, parent_window);
		}

		int count = 0;
		foreach (Photo p in photos) {
			if (progress_dialog != null
			    && progress_dialog.Update (String.Format ("Updating picture \"{0}\"", p.Name)))
				break;

			foreach (uint version_id in p.VersionIds) {
				Gdk.Pixbuf thumb = FSpot.ThumbnailGenerator.Create (p.VersionUri (version_id));
				if (thumb !=  null)
					thumb.Dispose ();
			}
			
			count++;
		}

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

		return true;
	}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:30,代码来源:ThumbnailCommand.cs


示例13: Populate

	public void Populate (Photo [] photos) {
		Hashtable hash = new Hashtable ();
		if (photos != null) {
			foreach (Photo p in photos) {
				foreach (Tag t in p.Tags) {
					if (!hash.Contains (t.Id)) {
						hash.Add (t.Id, t);
					}
				}
			}
		}

		foreach (Widget w in this.Children) {
			w.Destroy ();
		}
		
		if (hash.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 hash.Values) {
			TagMenuItem item = new TagMenuItem (t);
			this.Append (item);
			item.ShowAll ();
			item.Activated += HandleActivate;
		}
				
	}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:34,代码来源:PhotoTagMenu.cs


示例14: Add

        public int Add(Photo newPhoto)
        {
            this.photos.Add(newPhoto);
            this.photos.Save();

            return newPhoto.Id;
        }
开发者ID:MichaelaIvanova,项目名称:ReaLocate,代码行数:7,代码来源:PhotosService.cs


示例15: PhotoRequestedArgs

 public PhotoRequestedArgs(string user, IPAddress host, Database db, Photo photo)
 {
     this.user = user;
     this.host = host;
     this.db = db;
     this.photo = photo;
 }
开发者ID:nathansamson,项目名称:F-Spot-Album-Exporter,代码行数:7,代码来源:Server.cs


示例16: Upload

	public void Upload (Photo photo, string gallery)
	{
		if (login == null || passwd == null)
			throw new Exception ("Must Login First");

		string path = string.Format ("/{0}/{1}/", login, gallery);
		
		FormClient client = new FormClient (cookies);
		client.SuppressCookiePath = true;
		client.Add ("cmd", "uploadns1");
		client.Add ("start", System.Web.HttpUtility.UrlEncode (path));
		client.Add ("photo", new FileInfo (photo.DefaultVersionUri.LocalPath));
		client.Add ("desc", photo.Description);
		if (photo.Tags != null) {
			StringBuilder taglist = new StringBuilder ();

			foreach (Tag t in photo.Tags) {
				taglist.Append (t.Name + " ");
			}
			
			client.Add ("keywords", taglist.ToString ());
		}

		string upload_url = UploadBaseUrl + path + "?";

		Stream response = client.Submit (upload_url).GetResponseStream ();
		StreamReader reader = new StreamReader (response, Encoding.UTF8);

		Console.WriteLine (reader.ReadToEnd ());
	}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:30,代码来源:FotkiRemote.cs


示例17: UpdateFromSelection

		public void UpdateFromSelection (Photo [] sel)
		{
			Hashtable taghash = new Hashtable ();
	
			for (int i = 0; i < sel.Length; i++) {
				foreach (Tag tag in sel [i].Tags) {
					int count = 1;
	
					if (taghash.Contains (tag))
						count = ((int) taghash [tag]) + 1;
	
					if (count <= i)
						taghash.Remove (tag);
					else 
						taghash [tag] = count;
				}
				
				if (taghash.Count == 0)
					break;
			}
	
			selected_photos_tagnames = new ArrayList ();
			foreach (Tag tag in taghash.Keys)
				if ((int) (taghash [tag]) == sel.Length)
					selected_photos_tagnames.Add (tag.Name);
	
			Update ();
		}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:28,代码来源:TagEntry.cs


示例18: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     if (Product.ProductPhotos.Any())
     {
         var mainOffer = Product.Offers.FirstOrDefault(item => item.Main);
         if (mainOffer != null )
         {
             if (mainOffer.ColorID != null)
             {
                MainPhoto = Product.ProductPhotos.FirstOrDefault(item => item.ColorID == mainOffer.ColorID) ??
                             Product.ProductPhotos.OrderBy(item => item.Main).ThenBy(item => item.PhotoSortOrder)
                                    .FirstOrDefault() ?? new Photo(0, Product.ProductId, PhotoType.Product);
             }
             else
             {
                 MainPhoto = Product.ProductPhotos.FirstOrDefault(item => item.Main) ?? new Photo(0, Product.ProductId, PhotoType.Product);
             }
         }
         else
         {
             MainPhoto = new Photo(0, Product.ProductId, PhotoType.Product);
         }
     }
     else
     {
     MainPhoto = new Photo(0, Product.ProductId, PhotoType.Product);
     }
 }
开发者ID:AzarinSergey,项目名称:learn,代码行数:28,代码来源:ProductPhotoView.ascx.cs


示例19: WriteMetadataToImage

		//FIXME: Won't work on non-file uris
		void WriteMetadataToImage (Photo photo)
		{
			string path = photo.DefaultVersionUri.LocalPath;
	
			using (FSpot.ImageFile img = FSpot.ImageFile.Create (photo.DefaultVersionUri)) {
				if (img is FSpot.JpegFile) {
					FSpot.JpegFile jimg = img as FSpot.JpegFile;
				
					jimg.SetDescription (photo.Description);
					jimg.SetDateTimeOriginal (photo.Time.ToLocalTime ());
					jimg.SetXmp (UpdateXmp (photo, jimg.Header.GetXmp ()));
	
					jimg.SaveMetaData (path);
				} else if (img is FSpot.Png.PngFile) {
					FSpot.Png.PngFile png = img as FSpot.Png.PngFile;
				
					if (img.Description != photo.Description)
						png.SetDescription (photo.Description);
				
					png.SetXmp (UpdateXmp (photo, png.GetXmp ()));
	
					png.Save (path);
				}
			}
		}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:26,代码来源:SyncMetadataJob.cs


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PhotoCamera类代码示例发布时间:2022-05-24
下一篇:
C# PhoneNumber类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap