private void MenuItemCallback(object sender, EventArgs e) { if (!GlobalVariables.ProjectsLoaded) { var message = "Solution isn't loaded completely."; VsShellUtilities.ShowMessageBox( this.ServiceProvider, message, "Show module window", OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); return; } var dte = (DTE)Package.GetGlobalService(typeof(SDTE)); List <ProjectItem> configFiles = dte.Solution.FindProjectItems( p => p.Name.Contains("Facton"), p => (p.Name.EndsWith(".config") || p.Name.EndsWith(".xml")) && p.Name != "CodeAnalysisDictionary.xml" && p.Name != "App.config"); Dictionary <string, ProjectItem> projectItemDictionary = configFiles.GroupBy(t => t.ModuleName()) .ToDictionary(grp => grp.Key, grp => grp.First()); List <ModuleProxy> factonModules = this.GetProjectItems(dte.GetActiveDocumentText(), projectItemDictionary).Select(p => new ModuleProxy(p)).ToList(); using (ModuleForm moduleForm = new ModuleForm(projectItemDictionary, factonModules)) { moduleForm.ShowDialog(); } }
public void EvaluateModuleForm() { ModuleForm form = new ModuleForm("mymodule"); Assert.AreEqual("mymodule", form.Name); Module module = new Module(null); form.Evaluate(module.Context); Assert.AreEqual("mymodule", form.Name); }
private void moduleToolStripMenuItem_Click(object sender, EventArgs e) { if (MdiChildren.Length > 0) { return; } var module = new ModuleForm { MdiParent = this }; module.Show(); }
public async Task <JsonResult> Create(ReqCreateForm req) { try { if (!string.IsNullOrEmpty(req.AppModuleId)) { var appModule = await _appModuleRepository.Get(req.AppModuleId); if (appModule != null) { if (appModule.Forms == null) { appModule.Forms = new List <ModuleForm>(); } ObjectId documentTypeId; ObjectId appModuleId; if (ObjectId.TryParse(req.AppModuleId, out appModuleId) && ObjectId.TryParse(req.DocumentTypeId, out documentTypeId)) { if (appModule.Forms.Any(n => n.Name.ToLower().Trim() == req.Name.ToLower().Trim())) { var ErrorResult1 = new JsonGenericResult { IsSuccess = false, Message = "A Form of the same name already exists." }; return(Json(ErrorResult1)); } var formId = ObjectId.GenerateNewId(); var newForm = new ModuleForm { Id = formId, Name = req.Name, Description = req.Description, DocumentTypeId = documentTypeId, SubDocumentTypeId = null }; if (!string.IsNullOrEmpty(req.SubDocumentTypeId)) { ObjectId subDocumentTypeId; if (ObjectId.TryParse(req.SubDocumentTypeId, out subDocumentTypeId)) { newForm.SubDocumentTypeId = subDocumentTypeId; } } appModule.Forms.Add(newForm); await _appModuleRepository.Update(req.AppModuleId, appModule); var result = new JsonGenericResult { IsSuccess = true, Result = formId.ToString() }; return(Json(result)); } var ErrorResult2 = new JsonGenericResult { IsSuccess = false, Message = "Invalid app module id or document type id." }; return(Json(ErrorResult2)); } } var ErrorResult = new JsonGenericResult { IsSuccess = false, Message = "No app selected." }; return(Json(ErrorResult)); } catch (Exception ex) { return(Json(new JsonGenericResult { IsSuccess = false, Message = ex.Message })); } }
private void MenuItemCallback(object sender, EventArgs e) { if (!GlobalVariables.ProjectsLoaded) { var message = "Solution isn't loaded completely."; VsShellUtilities.ShowMessageBox( this.ServiceProvider, message, "Show module window", OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); return; } var dte = (DTE)Package.GetGlobalService(typeof(SDTE)); List<ProjectItem> configFiles = dte.Solution.FindProjectItems( p => p.Name.Contains("Facton"), p => (p.Name.EndsWith(".config") || p.Name.EndsWith(".xml")) && p.Name != "CodeAnalysisDictionary.xml" && p.Name != "App.config"); Dictionary<string, ProjectItem> projectItemDictionary = configFiles.GroupBy(t => t.ModuleName()) .ToDictionary(grp => grp.Key, grp => grp.First()); List<ModuleProxy> factonModules = this.GetProjectItems(dte.GetActiveDocumentText(), projectItemDictionary).Select(p => new ModuleProxy(p)).ToList(); using (ModuleForm moduleForm = new ModuleForm(projectItemDictionary, factonModules)) { moduleForm.ShowDialog(); } }
public override void Run() { var form = new ModuleForm(); WorkbenchSingleton.AddChild(form); }