Esempio n. 1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
            var connection = ConfigurationExtensions.GetConnectionString(this.Configuration, "DefaultConnection");

            services.AddDbContext <CswContext>(options => options.UseSqlServer(connection));

            services.AddSwaggerGen(c => {
                c.SwaggerDoc("v1", new Info
                {
                    Version     = "v1",
                    Title       = "CSW API",
                    Description = "CSW API TECH UNIT"
                });
            });
            DependencyServices.ConfigureServices(ref services);
            DependencyRepositories.ConfigureServices(ref services);
        }
Esempio n. 2
0
        private async Task NavigateToAsync(IProjectTree node)
        {
            string?browsePath = await DependencyServices.GetBrowsePathAsync(_project, node);

            if (browsePath == null)
            {
                return;
            }

            await _threadingService.SwitchToUIThread();

            // Find the hierarchy based on the project file, and then select it
            var hierarchy = (IVsUIHierarchy?)_projectServices.GetHierarchyByProjectName(browsePath);

            if (hierarchy == null || !_solutionExplorer.IsAvailable)
            {
                return;
            }

            _ = _solutionExplorer.Select(hierarchy, HierarchyId.Root);
        }
        public async Task <IEnumerable <Tuple <int, IntPtr> > > GetPointerToDataAsync(IReadOnlyCollection <int> types, IEnumerable <IProjectTree> selectedNodes, IProjectTreeProvider currentProvider)
        {
            var paths = new StringBuilder();
            var data  = new List <Tuple <int, IntPtr> >();

            foreach (IProjectTree node in selectedNodes)
            {
                string?path = await DependencyServices.GetBrowsePathAsync(_project, node);

                if (path == null)
                {
                    continue;
                }

                // Note we leave trailing slashes to mimic what happens with normal folders
                if (node.Flags.Contains(DependencyTreeFlags.SupportsFolderBrowse))
                {
                    path = PathHelper.EnsureTrailingSlash(path);
                }

                if (paths.Length > 0)
                {
                    paths.AppendLine();
                }

                paths.Append(path);
            }

            if (types.Contains(ClipboardFormat.CF_TEXT))
            {
                data.Add(new Tuple <int, IntPtr>(ClipboardFormat.CF_TEXT, Marshal.StringToHGlobalAnsi(paths.ToString())));
            }

            if (types.Contains(ClipboardFormat.CF_UNICODETEXT))
            {
                data.Add(new Tuple <int, IntPtr>(ClipboardFormat.CF_UNICODETEXT, Marshal.StringToHGlobalUni(paths.ToString())));
            }

            return(data);
        }
Esempio n. 4
0
        protected override async Task <bool> TryHandleCommandAsync(IImmutableSet <IProjectTree> nodes, bool focused, long commandExecuteOptions, IntPtr variantArgIn, IntPtr variantArgOut)
        {
            // Only handle when Solution Explorer has focus so that we don't take over Tab Well handling
            if (focused && nodes.All(CanOpen))
            {
                foreach (IProjectTree node in nodes)
                {
                    string?path = await DependencyServices.GetBrowsePathAsync(_project, node);

                    if (path == null)
                    {
                        continue;
                    }

                    Open(path);
                }

                return(true);
            }

            return(false);
        }