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


C# Photo类代码示例

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


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


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