private void createAlbumsTreeView() { int i = 0; PhotoComposite root = new PhotoComposite("Facebook User Albums"); treeViewAlbums.Nodes.Add(root.Node = new TreeNodeWrapper(root.ItemName, root)); foreach (Album album in m_LoggedInUser.Albums) { if (!(album.Photos.Count == 0)) { r_Albums.Add(album); PhotoComposite subAlbum = new PhotoComposite(album.Name); treeViewAlbums.Nodes[0].Nodes.Add(subAlbum.Node = new TreeNodeWrapper(subAlbum.ItemName, subAlbum)); new Thread(() => { lock (m_ObjLockAddToTreeNode) { foreach (Photo photo in r_Albums[i].Photos) { PhotoComponent photoComponent = new PhotoComponent(photo.Name, photo.ImageNormal); treeViewAlbums.Invoke(new Action(() => treeViewAlbums.Nodes[0].Nodes[i].Nodes.Add(photoComponent.Node = new TreeNodeWrapper(photoComponent.ItemName, photoComponent)))); } } i++; }).Start(); } } }
private void buttonSaveChanges_Click(object sender, EventArgs e) { PhotoComposite root; if (treeViewAlbums.Nodes.Count == 1) { root = new PhotoComposite("Edit Facebook User Photos"); treeViewAlbums.Nodes.Add(root.Node = new TreeNodeWrapper(root.ItemName, root)); } PhotoComponent photoComponent = new PhotoComponent(pictureBoxOfAlbum.Name, pictureBoxEditPhoto.BackgroundImage); treeViewAlbums.Nodes[1].Nodes.Add(photoComponent.Node = new TreeNodeWrapper(photoComponent.ItemName, photoComponent)); }
private void treeViewAlbums_SelectedIndexChanged(object sender, EventArgs e) { TreeNodeWrapper selectedNode = treeViewAlbums.SelectedNode as TreeNodeWrapper; if (selectedNode.Node is PhotoComponent) { PhotoComponent photoComponentToLoad = selectedNode.Node as PhotoComponent; pictureBoxOfAlbum.Image = photoComponentToLoad.Image; pictureBoxOfAlbum.ImageName = photoComponentToLoad.ItemName; buttonEditPhoto.Enabled = true; } else { textBoxAddPhoto.Text = treeViewAlbums.SelectedNode.Text; } }
private void buttonAddPhoto_Click(object sender, EventArgs e) { TreeNodeWrapper selectedNode = treeViewAlbums.SelectedNode as TreeNodeWrapper; PhotoComponent imageToAdd = new PhotoComponent(pictureBoxOfAlbum.ImageName, pictureBoxOfAlbum.Image); if (selectedNode.Node is PhotoComposite) { if (pictureBoxOfAlbum.Image != null) { (selectedNode.Node as PhotoComposite).OnPhotoComponentAdded(imageToAdd); } } else { (selectedNode.Node as PhotoComponent).OnPhotoComponentAdded(imageToAdd); } }
private void buttonStartDecorate_Click(object sender, EventArgs e) { IPhotoComponent photoComponentToDecorate = new PhotoComponent(pictureBoxEditPhoto.Name, pictureBoxEditPhoto.BackgroundImage); Image imageToDecorate = null; List <object> items = new List <object>(); items.Add(photoComponentToDecorate); foreach (string fetchDecorator in r_CheckedDecoratorFeatures) { string name = string.Format("C17_Ex03_Ben_304815616_Roy_203055892.{0}", fetchDecorator); Type type = Type.GetType(name); if (type.BaseType == typeof(ThugLifeDecorator)) { items.Add(r_ItemsToBlend[fetchDecorator]); } object instance = Activator.CreateInstance(type, items.ToArray()); imageToDecorate = (instance as PhotoDecorator).PhotoComponent; if (items.Count != 1) { items.Remove(r_ItemsToBlend[fetchDecorator]); } } foreach (CheckBox checkBox in panelThugLife.Controls) { if (checkBox.Checked == true) { r_ComboBoxPostsSource.Remove(checkBox.Text); pictureBoxEditPhoto.Controls.RemoveByKey(checkBox.Text); checkBox.Checked = false; } } pictureBoxEditPhoto.BackgroundImage = imageToDecorate; }
public Glasses(PhotoComponent i_Photo, PictureBoxProxy glassesPicture) : base(i_Photo) { BlendPictures(glassesPicture); }
public Hat(PhotoComponent i_Photo, PictureBoxProxy hatPicture) : base(i_Photo) { BlendPictures(hatPicture); }
public Necklace(PhotoComponent i_Photo, PictureBoxProxy necklacePicture) : base(i_Photo) { BlendPictures(necklacePicture); }
public Joint(PhotoComponent i_Photo, PictureBoxProxy jointPicture) : base(i_Photo) { BlendPictures(jointPicture); }