public ToolWindowDemo() { InitializeComponent(); FileExplorer.Models.FileSystemInfoExProfile profile = new FileExplorer.Models.FileSystemInfoExProfile(null, null); var desktopDir = AsyncUtils.RunSync(() => profile.ParseAsync("")); _rootDirs = new FileExplorer.Models.IEntryModel[] { desktopDir }; _mask = "Texts (.txt)|*.txt|Pictures (.jpg, .png)|*.jpg,*.png|Songs (.mp3)|*.mp3|All Files (*.*)|*.*"; _selectedPath = "c:\\"; }
public IEnumerable <ICommandModel> GetCommands(FileSystemInfoExModel appliedModel) { if (!appliedModel.IsDirectory) { string ext = PathEx.GetExtension(appliedModel.Name); foreach (OpenWithInfo info in FileTypeInfoProvider.GetFileTypeInfo(ext).OpenWithList) { if (info.OpenCommand != null) { string executePath = OpenWithInfo.GetExecutablePath(info.OpenCommand); string exeName = Path.GetFileNameWithoutExtension(executePath); if (info.OpenCommand != null && File.Exists(executePath)) { IEntryModel exeModel = AsyncUtils.RunSync(() => _profile.ParseAsync(executePath)); if (exeModel != null) { yield return new CommandModel(new OpenWithScriptCommand(info)) { Header = String.Format("{0} ({1})", exeName, info.KeyName), ToolTip = info.Description, HeaderIconExtractor = ModelIconExtractor <ICommandModel> .FromTaskFunc(t => _profile.GetIconExtractSequence(exeModel) .Last().GetIconBytesForModelAsync(exeModel, CancellationToken.None)), IsEnabled = true } } ; } } } yield return(new CommandModel(new OpenWithScriptCommand(OpenWithInfo.OpenAs)) { Header = "Open with...", IsEnabled = true }); } } }