public InfoItem(InfoItem target) { if (target != null) { canvas = target.canvas; fileName = target.fileName; GroupName = target.GroupName; } }
public void GenerateItems() { //Erzeugt Items für den Container aus den rtf Datein im Documents/Info Verzeichnis //Der Dateiname bestimmt den Darstellungsnamen, der Unterordner die Kategorie try { infoItems.Clear(); if (view != null) { view.GroupDescriptions.Clear(); } view = CollectionViewSource.GetDefaultView(infoItems); docContainer.DataContext = "docContainer"; view.GroupDescriptions.Add(new PropertyGroupDescription("GroupName")); docContainer.ItemsSource = view; infoItems.Clear(); foreach (string folder in Directory.GetDirectories(@"Documents\Info")) { foreach (string file in Directory.GetFiles(folder)) { FileInfo fileInfo = new FileInfo(file); if (fileInfo.Extension.Equals(".rtf") || fileInfo.Extension.Equals(".png")) { InfoItem item = new InfoItem(folder, fileInfo.Name, folder.Replace("Documents\\Info\\", "")); infoItems.Add(item); //infoBackup = infoItems; } } } } catch (Exception e) { Console.WriteLine("GenerateItems: " + e.Message); } }
public void GenerateItems() { //Erzeugt Items für den Container aus den rtf Datein im Documents/Info Verzeichnis //Der Dateiname bestimmt den Darstellungsnamen, der Unterordner die Kategorie try { infoItems.Clear(); if (view != null) { view.GroupDescriptions.Clear(); } view = CollectionViewSource.GetDefaultView(infoItems); docContainer.DataContext = "docContainer"; view.GroupDescriptions.Add(new PropertyGroupDescription("GroupName")); docContainer.ItemsSource = view; infoItems.Clear(); foreach (string folder in Directory.GetDirectories(@"Documents\Info")) { foreach (string file in Directory.GetFiles(folder)) { FileInfo fileInfo = new FileInfo(file); if(fileInfo.Extension.Equals(".rtf")||fileInfo.Extension.Equals(".png")) { InfoItem item = new InfoItem(folder, fileInfo.Name, folder.Replace("Documents\\Info\\", "")); infoItems.Add(item); //infoBackup = infoItems; } } } } catch (Exception e) { Console.WriteLine("GenerateItems: " + e.Message); } }