public void Start() { // Initialize backround worker _backgroundWorker = new BackgroundWorker() { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; _backgroundWorker.DoWork += OnStart; _backgroundWorker.ProgressChanged += OnProgress; _backgroundWorker.RunWorkerCompleted += OnComplete; // Run task _backgroundWorker.RunWorkerAsync(); // Autoclear console, if required if (Settings.Default.NANT_CLEAR_OUTPUT) { VisualStudioUtils.GetConsole(ApplicationObject, AppConstants.NAntRunner).Clear(); } // Trace start build WriteConsole(string.Format("{0}[{2}]: Target '{1}' started...{0}{0}", Environment.NewLine, TargetNode["name"], AppConstants.NAntRunner)); }
// Validates the model returned by the Visual Studio dialog. // We always force a Visual Studio build so we have a model // that we can use with the Entity Framework. private void Validate() { CodeType modelType = _codeGeneratorViewModel.ModelType.CodeType; ModelType dbContextType = _codeGeneratorViewModel.DbContextModelType; string dbContextTypeName = (dbContextType != null) ? dbContextType.TypeName : null; if (modelType == null) { throw new InvalidOperationException(Resources.WebFormsScaffolder_SelectModelType); } if (dbContextType == null || String.IsNullOrEmpty(dbContextTypeName)) { throw new InvalidOperationException(Resources.WebFormsScaffolder_SelectDbContextType); } // always force the project to build so we have a compiled // model that we can use with the Entity Framework var visualStudioUtils = new VisualStudioUtils(); visualStudioUtils.BuildProject(Context.ActiveProject); Type reflectedModelType = GetReflectionType(modelType.FullName); if (reflectedModelType == null) { throw new InvalidOperationException(Resources.WebFormsScaffolder_ProjectNotBuilt); } }
/// <summary> /// Initialize the thread for NAnt process. /// </summary> public void StartTarget() { if (!NAntProcess.IsWorking) { NAntProcess.Filename = Filename; NAntProcess.TargetNode = CurrentNode; // Sets focus to console VisualStudioUtils.ShowWindow(ApplicationObject, "Output"); NAntProcess.Start(); } }
/// <summary> /// Select the line of NAntNode in the VisualStudio editor. /// </summary> public void SelectNodeLine() { // First load the file into VisualStudio VisualStudioUtils.ShowFile(ApplicationObject, Filename); // Refocus AddIn (lost while opening the file) VisualStudioUtils.ShowWindow(ApplicationObject, Resources.Common.NAntRunner); // Display the node's line within the file VisualStudioUtils.ShowLine(ApplicationObject, Filename, CurrentNode.LineNumber, false); // Finally display the document VisualStudioUtils.ShowDocument(ApplicationObject, Filename); }
// Validates the model returned by the Visual Studio dialog. // We always force a Visual Studio build so we have a model private void Validate() { CodeType modelType = _moduleViewModel.ModelType.CodeType; if (modelType == null) { throw new InvalidOperationException("请选择一个有效的实体类。"); } var visualStudioUtils = new VisualStudioUtils(); visualStudioUtils.BuildProject(Context.ActiveProject); Type reflectedModelType = GetReflectionType(modelType.FullName); if (reflectedModelType == null) { throw new InvalidOperationException("不能加载的实体类型。如果项目没有编译,请编译后重试。"); } }
public void WriteConsole(string message) { VisualStudioUtils.GetConsole(ApplicationObject, AppConstants.NAntRunner).OutputString(message); }
public MvcScaffolder(CodeGenerationContext context, CodeGeneratorInformation information) : base(context: context, information: information) { _visualStudioUtils = new VisualStudioUtils(); }