public void SetUse(object sender, DenshaImage image, bool use) { image.IsUsed = use; if (_mainForm != null) { _mainForm.SetUse(sender, image, use); } }
public void AddTag(object sender, DenshaImage image, Tag tag) { ImageListItem item = imageList.Items.Find(delegate(ImageListItem i) { return i.DenshaImage.Id == image.Id; }); if (item != null) { AddTag(sender, item, tag); } }
public Project CreateProject(string origDirPath, string thumbDirPath) { Project project = new Project(); project.OriginalPath = origDirPath; project.ThumbnailPath = thumbDirPath; project.TagTypes = new TagTypeCollection(); Tag tag1 = new Tag(TagType.Default, "a", "あaaほあえljうぇlgkjwヶgawefwefw"); Tag tag2 = new Tag(TagType.Default, "c", "bbb"); Tag tag3 = new Tag(TagType.Default, "b", "あaaほあえljうぇlgkjwヶgawefwefw"); project.Tags.Add(tag1); project.Tags.Add(tag2); project.Tags.Add(tag3); DirectoryInfo dOriginalDirInfo = new DirectoryInfo(project.OriginalFullPath); DirectoryInfo dThumbnailDirInfo = new DirectoryInfo(project.ThumbnailFullPath); if (!dOriginalDirInfo.Exists) { } else { FileInfo[] fInfos = dOriginalDirInfo.GetFiles("*.jpg"); for (int i = 0; i < 100; i++) { foreach (FileInfo fInfo in fInfos) { DenshaImage img = new DenshaImage(project, fInfo.Name); img.AddTag(tag1); img.AddTag(tag2); img.AddTag(tag3); project.AddImage(img); } } } return project; }
public static DenshaImage ReadXml(Project project, XmlNode node) { if (node.Name != "image") return null; string origname = null; string thumbname = null; string extname = null; DateTime time = DateTime.Now; bool use = false; string recital = ""; List<Tag> tags = new List<Tag>(); foreach (XmlNode child in node.ChildNodes) { switch (child.Name) { case "origname": origname = child.InnerText.Trim(); break; case "thumbname": thumbname = child.InnerText.Trim(); break; case "extname": extname = child.InnerText.Trim(); break; case "time": DateTime.TryParseExact(child.InnerText.Trim(), SAVETIME_FORMAT, null, System.Globalization.DateTimeStyles.AllowWhiteSpaces, out time); break; case "use": use = child.InnerText.Trim() == "1"; break; case "recital": recital = child.InnerText.Trim(); break; case "tags": { foreach (XmlNode tagNode in child.ChildNodes) { int tagId = -1; int.TryParse(tagNode.InnerText.Trim(), out tagId); Tag tag = project.Tags.FindById(tagId); if (tag != null) tags.Add(tag); } } break; } } if (String.IsNullOrEmpty(origname) || String.IsNullOrEmpty(thumbname)) return null; extname = extname ?? ".jpg"; DenshaImage img = new DenshaImage(project, origname + extname, thumbname + extname); img._isUsed = use; img.Recital = recital; img.ShootingTime = time; foreach (Tag tag in tags) { img.AddTag(tag); } return img; }
public void AddImage(DenshaImage image) { if (!_imgIdMap.ContainsKey(image.Id)) { _images.Add(image); _imgIdMap.Add(image.Id, image); image.PropertyChanged += new PropertyChangedEventHandler(image_PropertyChanged); } else { #warning TODO: throw exception } }
public static Project CreateProject(string origDirPath, string thumbDirPath, string thumbnailNamePattern, BackgroundWorker worker) { worker.ReportProgress(0, "creating project"); Project project = new Project(); project.OriginalPath = origDirPath; project.ThumbnailPath = thumbDirPath; project.TagTypes = new TagTypeCollection(); DirectoryInfo dOriginalDirInfo = new DirectoryInfo(project.OriginalFullPath); DirectoryInfo dThumbnailDirInfo = new DirectoryInfo(project.ThumbnailFullPath); if (!dOriginalDirInfo.Exists) { } else { FileInfo[] fInfos = dOriginalDirInfo.GetFiles("*.jpg"); int i = 0; int imgCount = fInfos.Length; foreach (FileInfo fInfo in fInfos) { string origName = Path.GetFileNameWithoutExtension(fInfo.Name); DenshaImage img = new DenshaImage(project, fInfo.Name, Utilities.ApplyThumbnailNamePattern(fInfo.Name, thumbnailNamePattern)); project.AddImage(img); worker.ReportProgress((int)(i * 100 / imgCount), "loading images"); i++; } } project.ProjectFilePath = null; worker.ReportProgress(100, "creating project"); project._notifyChange = true; return project; }
public void UpdateImage(object sender, DenshaImage image) { if (sender != imageList) { imageList.UpdateImage(image); imageList.CloseTextBox(); } }
public void ShowLargeImage(DenshaImage image) { imageTabs.AddTab(image); }
public void SetUse(object sender, DenshaImage image, bool use) { if (image.IsUsed != use) { image.IsUsed = use; } imageList.Invalidate(); // tabの方 foreach (ImageTabPanel tab in imageTabs.TabPages) { tab.SetUse(sender, image, use); } }
public void ScrollListToImage(DenshaImage image) { imageList.ScrollToImage(image); }