/// <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); } }
/// <summary> /// Runs this instance. /// </summary> public void Run() { this.AddTraceHeader("PluginsController", "Run"); if (this.VisualStudioService.IsMvvmCrossSolution) { PluginsForm form = new PluginsForm(this.GetViewModelNames(), this.SettingsService.DisplayLogo); form.ShowDialog(); if (form.Continue) { this.WriteStatusBarMessage("Ninja Coder is running...."); try { IEnumerable <string> messages = this.pluginsService.AddPlugins( this.VisualStudioService, form.RequiredPlugins, form.ImplementInViewModel, form.IncludeUnitTests); //// needs fixing - this is when we create the constructor parameters for the unit tests. this.VisualStudioService.DTE2.ReplaceText(",)", ")", false); this.VisualStudioService.DTE2.SaveAll(); //// show the readme. this.ShowReadMe("Add Plugins", messages); this.WriteStatusBarMessage("Ninja Coder has completed the adding of the plugins."); } catch (Exception exception) { TraceService.WriteError("Cannot create plugins exception=" + exception.Message); } } } else { this.ShowNotMvvmCrossSolutionMessage(); } }
/// <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); } }