Пример #1
0
 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;
     }));
 }
Пример #2
0
        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));
        }
Пример #3
0
 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);
     }
 }