Ejemplo n.º 1
0
        public void PluginsFormConstructorTest()
        {
            PluginsForm target = new PluginsForm();

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
        /// <summary>
        /// Adds the plugins.
        /// </summary>
        public void AddPlugins()
        {
            this.AddTraceHeader("AddPlugins");

            if (this.visualStudioService.IsMvvmCrossSolution)
            {
                List<string> viewModelNames = new List<string>();

                Project coreProject = this.visualStudioService.CoreProject;

                //// look for the current view models in the project.
                if (coreProject != null)
                {
                    ProjectItem projectItem = coreProject.GetFolder("ViewModels");

                    IEnumerable<ProjectItem> projectItems = projectItem.GetSubProjectItems();

                    viewModelNames.AddRange(projectItems.Select(item => Path.GetFileNameWithoutExtension(item.Name)));
                }

                PluginsForm form = new PluginsForm(viewModelNames);

                form.ShowDialog();

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

                    pluginsService.AddPlugins(
                        this.visualStudioService,
                        form.RequiredPlugins,
                        form.ImplementInViewModel,
                        this.settingsService.CodeSnippetsPath);

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

                    this.visualStudioService.DTE2.WriteStatusBarMessage("Ninja Coder has completed the adding of the plugins.");
                }
            }
            else
            {
                MessageBox.Show("This solution is not a MvvmCross solution.", Settings.ApplicationName);
            }
        }