private Task getDetails(DriveItem drive) { return(Task.Factory.StartNew(() => { var info = new DriveInfo(drive.DisplayName); drive.Path = info.RootDirectory.FullName; drive.IsReady = info.IsReady; drive.DisplayName = drive.FilterString = GetDriveInfoString(info); var tmb = ShellNative.GetLargeBitmapSource(drive.Path); tmb.Freeze(); drive.Thumbnail = tmb; })); }
protected override async Task <IEnumerable <RtfItem> > GetItems() { Title = Path; Thumbnail = ShellNative.GetLargeBitmapSource(Path); PathName = System.IO.Path.GetFileName(Path); var extension = System.IO.Path.GetExtension(Path); var encoding = GetEncoding(); _syntaxHighlighter = new SyntaxHighlighter(encoding); if (encoding == null) { return(await Task.Run(() => _syntaxHighlighter.InitBinary(Path))); } return(await _syntaxHighlighter.Init(Path, extension)); }
private static BaseItem GetBaseItem(string s) { try { var b = new BaseItem(s); var enumValue = (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), b.DisplayName); b.Path = Environment.GetFolderPath(enumValue); b.Thumbnail = ShellNative.GetLargeBitmapSource(b.Path); return(b); } catch (Exception) { return(null); } }