当前位置: 首页>>代码示例>>C#>>正文


C# IImmutableSet.GetSelectedNodesPaths方法代码示例

本文整理汇总了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);
 }
开发者ID:Microsoft,项目名称:RTVS,代码行数:11,代码来源:SourceFilesCommand.cs

示例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;
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:40,代码来源:SourceFilesCommand.cs


注:本文中的IImmutableSet.GetSelectedNodesPaths方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。