コード例 #1
0
        /// <summary>
        /// Builds the projects.
        /// </summary>
        public void BuildProjects()
        {
            this.AddTraceHeader("BuildProjects");

            string defaultLocation;
            string defaultProjectName = string.Empty;

            //// if this fails it will almost certainly be the COM integration with VStudio.
            try
            {
                defaultLocation = this.visualStudioService.DTE2.GetDefaultProjectsLocation();

                Project project = this.visualStudioService.CoreProject;

                if (project != null)
                {
                    TraceService.WriteLine("MvvmCrossController::BuildProjects defaultProject=" + project.Name);

                    defaultProjectName = project.Name.Replace(ProjectSuffixes.Core, string.Empty);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(@"Error Communicating with Visual Studio Error:-" + exception.Message);
                return;
            }

            List <ProjectTemplateInfo> projectTemplateInfos = this.visualStudioService.AllowedProjectTemplates;

            if (projectTemplateInfos.Count > 0)
            {
                SolutionOptionsForm form = new SolutionOptionsForm(defaultLocation, defaultProjectName, projectTemplateInfos);

                form.ShowDialog();

                if (form.Continue)
                {
                    this.visualStudioService.DTE2.WriteStatusBarMessage("Ninja Coder is running....");

                    Solution2 solution2 = this.visualStudioService.DTE2.GetSolution() as Solution2;

                    solution2.AddProjects(form.Path, form.Presenter.GetRequiredTemplates(), true);

                    //// now collapse the solution!
                    this.visualStudioService.DTE2.CollapseSolution();

                    this.visualStudioService.DTE2.WriteStatusBarMessage("Ninja Coder has completed the build of the MvvmCross solution.");
                }
            }
            else
            {
                MessageBox.Show(@"This solution has already been setup with the MvvmCross projects", Settings.ApplicationName);
            }
        }
コード例 #2
0
        /// <summary>
        /// Runs this instance.
        /// </summary>
        public void Run()
        {
            this.AddTraceHeader("ProjectsController", "Run");

            string defaultLocation;
            string defaultProjectName = this.GetDefaultProjectName();

            //// if this fails it will almost certainly be the COM integration with VStudio.
            try
            {
                defaultLocation = this.VisualStudioService.DTE2.GetDefaultProjectsLocation();
            }
            catch (Exception exception)
            {
                MessageBox.Show(@"Error Communicating with Visual Studio Error:-" + exception.Message);
                return;
            }

            List <ProjectTemplateInfo> projectTemplateInfos = this.VisualStudioService.AllowedProjectTemplates;

            if (projectTemplateInfos.Count > 0)
            {
                SolutionOptionsForm form = new SolutionOptionsForm(
                    defaultLocation,
                    defaultProjectName,
                    projectTemplateInfos,
                    this.SettingsService.DisplayLogo,
                    this.SettingsService.UseNugetForProjectTemplates);

                form.ShowDialog();

                if (form.Continue)
                {
                    this.WriteStatusBarMessage("Ninja Coder is running....");

                    Solution2 solution2 = this.VisualStudioService.DTE2.GetSolution() as Solution2;

                    //// create the solution if we don't have one!
                    if (string.IsNullOrEmpty(solution2.FullName))
                    {
                        string solutionPath = form.Presenter.GetSolutionPath();

                        if (Directory.Exists(solutionPath) == false)
                        {
                            Directory.CreateDirectory(solutionPath);
                        }

                        solution2.Create(solutionPath, form.ProjectName);
                    }

                    IEnumerable <string> messages = solution2.AddProjects(
                        form.Presenter.GetSolutionPath(),
                        form.Presenter.GetRequiredTemplates(),
                        true,
                        this.SettingsService.IncludeLibFolderInProjects);

                    this.WriteStatusBarMessage("Ninja Coder is updating files...");

                    //// create the version files.
                    this.CreateNinjaVersionFile(this.SettingsService.ApplicationVersion);
                    this.CreateMvvmCrossVersionFile(this.SettingsService.MvvmCrossVersion);

                    //// show the readme.
                    this.ShowReadMe("Add Projects", messages);

                    this.WriteStatusBarMessage("Ninja Coder has completed the build of the MvvmCross solution.");
                }
            }
            else
            {
                MessageBox.Show(@"This solution has already been setup with the MvvmCross projects", Settings.ApplicationName);
            }
        }
コード例 #3
0
        /// <summary>
        /// Builds the projects.
        /// </summary>
        public void BuildProjects()
        {
            this.AddTraceHeader("BuildProjects");

            string defaultLocation;
            string defaultProjectName = string.Empty;

            //// if this fails it will almost certainly be the COM integration with VStudio.
            try
            {
                defaultLocation = this.visualStudioService.DTE2.GetDefaultProjectsLocation();

                Project project = this.visualStudioService.CoreProject;

                if (project != null)
                {
                    TraceService.WriteLine("MvvmCrossController::BuildProjects defaultProject=" + project.Name);

                    defaultProjectName = project.Name.Replace(ProjectSuffixes.Core, string.Empty);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(@"Error Communicating with Visual Studio Error:-" + exception.Message);
                return;
            }

            List<ProjectTemplateInfo> projectTemplateInfos = this.visualStudioService.AllowedProjectTemplates;

            if (projectTemplateInfos.Count > 0)
            {
                SolutionOptionsForm form = new SolutionOptionsForm(defaultLocation, defaultProjectName, projectTemplateInfos);

                form.ShowDialog();

                if (form.Continue)
                {
                    this.visualStudioService.DTE2.WriteStatusBarMessage("Ninja Coder is running....");

                    Solution2 solution2 = this.visualStudioService.DTE2.GetSolution() as Solution2;

                    solution2.AddProjects(form.Path, form.Presenter.GetRequiredTemplates(), true);

                    //// now collapse the solution!
                    this.visualStudioService.DTE2.CollapseSolution();

                    this.visualStudioService.DTE2.WriteStatusBarMessage("Ninja Coder has completed the build of the MvvmCross solution.");
                }
            }
            else
            {
                MessageBox.Show(@"This solution has already been setup with the MvvmCross projects", Settings.ApplicationName);

            }
        }