public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            // Get the full path
            var path = (string)value;

            // If the path is null, ignore
            if (path == null)
            {
                return(null);
            }

            // Get the name of the file/folder
            var name = FoldersTreeView.GetFileFolderName(path);

            // By default, we presume an image
            var image = "images/file.png";

            // If the name is blank, we presume it's a drive as we cannot have a blank file or folder name
            if (string.IsNullOrEmpty(name))
            {
                image = "images/diskdrive.png";
            }
            else if (new FileInfo(path).Attributes.HasFlag(FileAttributes.Directory))
            {
                image = "images/folder-closed.png";
            }

            return(new BitmapImage(new Uri($"pack://application:,,,/{image}")));
        }
Exemple #2
0
        public static void ConvertDemo()
        {
            var projectDirectory = Environment.CurrentDirectory;
            var exportFolder     = System.IO.Directory.GetParent(projectDirectory).Parent.FullName;
            var exportFile       = System.IO.Path.Combine(exportFolder, "Demo.pdf");

            using (var writer = new PdfWriter(exportFile))
            {
                using (var pdf = new PdfDocument(writer))
                {
                    var doc = new Document(pdf);
                    doc.Add(new iText.Layout.Element.Paragraph("Team Foxcatcher"));
                }
            }

            FoldersTreeView foldersTreeView = new FoldersTreeView();

            string curPath = foldersTreeView.getFullPath();
        }