本文整理汇总了C#中IImmutableSet.GetSelectedNodesPaths方法的典型用法代码示例。如果您正苦于以下问题:C# IImmutableSet.GetSelectedNodesPaths方法的具体用法?C# IImmutableSet.GetSelectedNodesPaths怎么用?C# IImmutableSet.GetSelectedNodesPaths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IImmutableSet
的用法示例。
在下文中一共展示了IImmutableSet.GetSelectedNodesPaths方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCommandStatusAsync
public Task<CommandStatusResult> GetCommandStatusAsync(IImmutableSet<IProjectTree> nodes, long commandId, bool focused, string commandText, CommandStatus progressiveStatus) {
if ((commandId == RPackageCommandId.icmdSourceSelectedFiles || commandId == RPackageCommandId.icmdSourceSelectedFilesWithEcho) && nodes.GetSelectedNodesPaths().Count() > 0) {
foreach (var n in nodes) {
if (n.IsFolder || !Path.GetExtension(n.FilePath).EqualsIgnoreCase(".r")) {
return Task.FromResult(CommandStatusResult.Unhandled);
}
}
return Task.FromResult(new CommandStatusResult(true, commandText, CommandStatus.Enabled | CommandStatus.Supported));
}
return Task.FromResult(CommandStatusResult.Unhandled);
}
示例2: TryHandleCommandAsync
public async Task<bool> TryHandleCommandAsync(IImmutableSet<IProjectTree> nodes, long commandId, bool focused, long commandExecuteOptions, IntPtr variantArgIn, IntPtr variantArgOut) {
if (commandId == RPackageCommandId.icmdSourceSelectedFiles || commandId == RPackageCommandId.icmdSourceSelectedFilesWithEcho) {
bool echo = commandId == RPackageCommandId.icmdSourceSelectedFilesWithEcho;
IFileSystem fs = new FileSystem();
IEnumerable<string> rFiles = Enumerable.Empty<string>();
var workflow = _interactiveWorkflowProvider.GetOrCreate();
try {
var session = workflow.RSession;
if (session.IsRemote) {
var files = nodes.GetSelectedNodesPaths().Where(x =>
Path.GetExtension(x).EqualsIgnoreCase(RContentTypeDefinition.FileExtension) &&
fs.FileExists(x));
var properties = _configuredProject.Services.ExportProvider.GetExportedValue<ProjectProperties>();
string projectDir = Path.GetDirectoryName(_configuredProject.UnconfiguredProject.FullPath);
string projectName = properties.GetProjectName();
string remotePath = await properties.GetRemoteProjectPathAsync();
await SendToRemoteAsync(files, projectDir, projectName, remotePath, CancellationToken.None);
rFiles = files.Select(p => p.MakeRelativePath(projectDir).ProjectRelativePathToRemoteProjectPath(remotePath, projectName));
} else {
rFiles = nodes.GetSelectedNodesPaths().Where(x =>
Path.GetExtension(x).EqualsIgnoreCase(RContentTypeDefinition.FileExtension) &&
fs.FileExists(x));
}
workflow.Operations.SourceFiles(rFiles, echo);
} catch (IOException ex) {
_appShell.ShowErrorMessage(string.Format(CultureInfo.InvariantCulture, Resources.Error_CannotTransferFile, ex.Message));
}
catch (RHostDisconnectedException) {
workflow.ActiveWindow.InteractiveWindow.WriteErrorLine(Resources.Error_CannotTransferNoRSession);
}
return true;
}
return false;
}