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


C# IVisualStudioService.GetDefaultProjectName方法代码示例

本文整理汇总了C#中IVisualStudioService.GetDefaultProjectName方法的典型用法代码示例。如果您正苦于以下问题:C# IVisualStudioService.GetDefaultProjectName方法的具体用法?C# IVisualStudioService.GetDefaultProjectName怎么用?C# IVisualStudioService.GetDefaultProjectName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVisualStudioService的用法示例。


在下文中一共展示了IVisualStudioService.GetDefaultProjectName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProjectsViewModel

        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectsViewModel" /> class.
        /// </summary>
        /// <param name="visualStudioService">The visual studio service.</param>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="projectFactory">The project factory.</param>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="messageBoxService">The message box service.</param>
        /// <param name="folderBrowserDialogService">The folder browser dialog service.</param>
        /// <param name="viewModelAndViewsFactory">The view model and views factory.</param>
        public ProjectsViewModel(
            IVisualStudioService visualStudioService,
            ISettingsService settingsService,
            IProjectFactory projectFactory,
            IFileSystem fileSystem,
            IMessageBoxService messageBoxService,
            IFolderBrowserDialogService folderBrowserDialogService,
            IViewModelAndViewsFactory viewModelAndViewsFactory)
            : base(settingsService)
        {
            TraceService.WriteLine("ProjectsViewModel::Constructor Start");

            this.settingsService = settingsService;
            this.fileSystem = fileSystem;
            this.messageBoxService = messageBoxService;
            this.folderBrowserDialogService = folderBrowserDialogService;

            this.projects = new ObservableCollection<SelectableItemViewModel<ProjectTemplateInfo>>();

            IEnumerable<ProjectTemplateInfo> projectTemplateInfos = projectFactory.GetAllowedProjects();

            foreach (SelectableItemViewModel<ProjectTemplateInfo> viewModel in projectTemplateInfos
                .Select(projectTemplateInfo => new SelectableItemViewModel<ProjectTemplateInfo>(projectTemplateInfo, projectTemplateInfo.PreSelected)))
            {
                this.projects.Add(viewModel);
            }

            //// set the defaults!
            this.Project = visualStudioService.GetDefaultProjectName();

            string defaultPath = this.settingsService.DefaultProjectsPath;

            //// if we are already in the solution disable project name and path.
            this.solutionAlreadyCreated = this.Project.Length > 0;

            this.Path = string.IsNullOrEmpty(defaultPath) == false ? defaultPath : visualStudioService.DTEService.GetDefaultProjectsLocation();

            this.useNuget = this.settingsService.UseNugetForProjectTemplates;

            this.viewTypes = viewModelAndViewsFactory.GetAvailableViewTypes();
            this.selectedViewType = this.settingsService.SelectedViewType;

            TraceService.WriteLine("ProjectsViewModel::Constructor End");
        }
开发者ID:rahulpnath,项目名称:NinjaCoderForMvvmCross,代码行数:54,代码来源:ProjectsViewModel.cs

示例2: ProjectsViewModel

        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectsViewModel" /> class.
        /// </summary>
        /// <param name="visualStudioService">The visual studio service.</param>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="projectFactory">The project factory.</param>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="messageBoxService">The message box service.</param>
        /// <param name="folderBrowserDialogService">The folder browser dialog service.</param>
        /// <param name="cachingService">The caching service.</param>
        public ProjectsViewModel(
            IVisualStudioService visualStudioService,
            ISettingsService settingsService,
            IProjectFactory projectFactory,
            IFileSystem fileSystem,
            IMessageBoxService messageBoxService,
            IFolderBrowserDialogService folderBrowserDialogService,
            ICachingService cachingService)
        {
            TraceService.WriteLine("ProjectsViewModel::Constructor Start");

            this.visualStudioService = visualStudioService;
            this.settingsService = settingsService;
            this.fileSystem = fileSystem;
            this.projectFactory = projectFactory;
            this.messageBoxService = messageBoxService;
            this.folderBrowserDialogService = folderBrowserDialogService;
            this.cachingService = cachingService;

            this.projects = new ObservableCollection<SelectableItemViewModel<ProjectTemplateInfo>>();

            //// set the defaults!
            this.Project = visualStudioService.GetDefaultProjectName();

            if (string.IsNullOrEmpty(this.Project)
                && this.settingsService.UseTempProjectName)
            {
                this.Project = "P" + DateTime.Now.ToString("yyMMddHHmm");
            }

            string defaultPath = this.settingsService.DefaultProjectsPath;

            //// if we are already in the solution disable project name and path.
            this.solutionAlreadyCreated = this.visualStudioService.SolutionAlreadyCreated;

            if (this.solutionAlreadyCreated)
            {
                TraceService.WriteLine("Solution already created");

                this.Path = visualStudioService.SolutionService.GetParentDirectoryName();
            }
            else
            {
                this.Path = string.IsNullOrEmpty(defaultPath) == false
                                ? defaultPath
                                : visualStudioService.DTEService.GetDefaultProjectsLocation();
            }

            TraceService.WriteLine("ProjectsViewModel::Constructor End");
        }
开发者ID:asudbury,项目名称:NinjaCoderForMvvmCross,代码行数:60,代码来源:ProjectsViewModel.cs


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