public MetroItemViewModel(ItemClass item, int x, int y, int spanx, int spany, MetroExplorer explorer) { Explorer = explorer; Item = item; Col = x; Row = y; ColSpan = spanx; RowSpan = spany; Image = Item.ImagePath; switch (item.Type) { case ItemType.folder: var di = new DirectoryInfo(item.Path); Name = di.Name; Image = "http://www.tno.nl/images/contactpers/mihielvandermeulen.jpg"; foreach (var f in di.GetFiles()) { if (f.Name.ToLower().Contains(di.Name.ToLower() + ".")) { Image = f.FullName; } } break; case ItemType.image: var fi = new FileInfo(item.Path); Name = fi.Name.Split('.')[0]; Image = item.Path; break; case ItemType.video: var fv = new FileInfo(item.Path); Name = fv.Name.Split('.')[0]; Image = item.ImagePath; break; case ItemType.unknown: var fu = new FileInfo(item.Path); Name = fu.Name.Split('.')[0]; Image = item.ImagePath; break; } }
public Folder(ItemClass item, MetroExplorer explorer) { Directory = new DirectoryInfo(item.Path); Name = Directory.Name; InitTemplates(); Explorer = explorer; }