public AccessObjectStoredProcedureCollectionModel(RotApplicationModel rotApplicationModel) { try { Initialize(rotApplicationModel.Application.CurrentData.AllStoredProcedures); } catch { } }
public AccessObjectViewCollectionModel(RotApplicationModel rotApplicationModel) { try { Initialize(rotApplicationModel.Application.CurrentData.AllViews); } catch { } }
public AccessObjectDatabaseDiagramCollectionModel(RotApplicationModel rotApplicationModel) { try { Initialize(rotApplicationModel.Application.CurrentData.AllDatabaseDiagrams); } catch { } }
public AccessObjectQueryCollectionModel(RotApplicationModel rotApplicationModel) { try { Initialize(rotApplicationModel.Application.CurrentData.AllQueries); } catch { } }
public AccessObjectMacroCollectionModel(RotApplicationModel rotApplicationModel) { try { Initialize(rotApplicationModel.Application.CurrentProject.AllMacros); } catch { } }
public AccessObjectReportCollectionModel(RotApplicationModel rotApplicationModel) { try { Initialize(rotApplicationModel.Application.CurrentProject.AllReports); } catch { } }
private IEnumerable <TreeNode> GetFormNodes(RotApplicationModel rotApplicationModel) { var formAccessObjects = new AccessObjectFormCollectionModel(rotApplicationModel); foreach (var accessObject in formAccessObjects.OrderByDescending(f => f.IsLoaded).ThenBy(f => f.Name)) { if (accessObject.IsLoaded) { yield return(GetLoadedFormNode(rotApplicationModel.Application, accessObject.Name)); } else { yield return(new LazyTreeNode(accessObject).EmptyChildren()); } } }
//private void controlsTree_DrawNode(object sender, DrawTreeNodeEventArgs e) //{ // if (e.Node.Text == "") // return; // if (e.Node.Tag is AccessControlModel accessControlModel) // { // var boldText = accessControlModel.Caption ?? ""; // var normalText = $"{accessControlModel.Name} {accessControlModel.Type}"; // using (Font font = new Font(controlsTree.Font, FontStyle.Bold)) // { // using (Brush brush = new SolidBrush(controlsTree.ForeColor)) // { // e.Graphics.DrawString(boldText, font, brush, e.Bounds.Left, e.Bounds.Top); // var s = e.Graphics.MeasureString(boldText, controlsTree.Font); // e.Graphics.DrawString(normalText, controlsTree.Font, brush, e.Bounds.Left + (int)s.Width + 10, e.Bounds.Top); // } // } // } // else // { // e.DrawDefault = true; // } //} internal void SelectedApplicationChanged(RotApplicationModel model) { if (model.Application == null) { controlsTree.Nodes.Clear(); return; } selectedTreeNode = controlsTree.SelectedNode; CollectExpandedTreeNodeModels(controlsTree.Nodes); controlsTree.BeginUpdate(); controlsTree.Nodes.Clear(); var application = model.Application; var currentDb = new Lazy <Database>(() => application.CurrentDb()); controlsTree.Nodes.AddRange( new TreeNode[] { new LazyTreeNode(ApplicationLabel, model).AddRange(() => GetApplicationNodes(model)), new LazyTreeNode(FormsLabel, model).AddRange(() => GetFormNodes(model)), new LazyTreeNode(MacrosLabel, model).AddRange(() => GetAccessObjectNodes(new AccessObjectMacroCollectionModel(model))), new LazyTreeNode(ReportsLabel, model).AddRange(() => GetReportNodes(new AccessReportCollectionModel(application.Reports))), new LazyTreeNode(ResourcesLabel, model).AddRange(() => GetResourceNodes(new AccessResourceCollectionModel(application.CurrentProject.Resources))), new LazyTreeNode(ModulesLabel, model).AddRange(() => GetModuleNodes(new AccessModuleCollectionModel(application.Modules))), new TreeNode(DatabaseLabel) { Nodes = { new LazyTreeNode(DatabaseDiagramsLabel, model).AddRange(() => GetAccessObjectNodes(new AccessObjectDatabaseDiagramCollectionModel(model))), new LazyTreeNode(FunctionsLabel, model).AddRange(() => GetAccessObjectNodes(new AccessObjectFunctionCollectionModel(model))), new LazyTreeNode(QueryDefsLabel, model).AddRange(() => GetQueryNodes(new AccessQueryDefCollectionModel(currentDb.Value))), new LazyTreeNode(StoredProceduresLabel, model).AddRange(() => GetAccessObjectNodes(new AccessObjectStoredProcedureCollectionModel(model))), new LazyTreeNode(TablesLabel, model).AddRange(() => GetTableDefNodes(new AccessTableDefCollectionModel(currentDb.Value.TableDefs))), new LazyTreeNode(ViewsLabel, model).AddRange(() => GetAccessObjectNodes(new AccessObjectViewCollectionModel(model))), new LazyTreeNode(ContainersLabel, model).AddRange(() => GetContainerNodes(new AccessContainerCollectionModel(currentDb.Value.Containers))), new LazyTreeNode(RecordsetsLabel, model).AddRange(() => GetRecordsetNodes(new AccessRecordsetCollectionModel(currentDb.Value.Recordsets))) }, }, new LazyTreeNode(PrintersLabel, model).AddRange(() => GetPrinterNodes(new AccessPrinterCollectionModel(application.Printers))), } ); ApplyExpandedTreeNodes(controlsTree.Nodes); controlsTree.EndUpdate(); }
private List <TreeNode> GetApplicationNodes(RotApplicationModel rotApplicationModel) { var result = new List <TreeNode>(); //var app = rotApplicationModel.Application; var model = new AccessApplicationModel(rotApplicationModel.Application); var vbe = model.VBE.Value; var vbeProjectsNode = new LazyTreeNode(vbe.Projects).AddRange(() => vbe.Projects.Select(p => new LazyTreeNode(p))); var vbeWindowsNode = new LazyTreeNode(vbe.Windows).AddRange(() => vbe.Windows.Select(w => new LazyTreeNode(w))); var vbeAddinsNode = new LazyTreeNode(vbe.Addins).AddRange(() => vbe.Addins.Select(a => new LazyTreeNode(a))); var vbeNode = new LazyTreeNode(vbe) .AddRange(() => new TreeNode[] { new LazyTreeNode("MainWindow").AddRange(() => GetObjectPropertiesAsTreeNodes(vbe.MainWindow)), vbeWindowsNode, new LazyTreeNode("Active project").AddRange(() => GetVBProjectNodes(vbe.ActiveVBProject)), vbeProjectsNode, vbeAddinsNode } ); result.Add(vbeNode); var tempVars = model.TempVars.Value; if (tempVars.Any()) { result.Add(new TreeNode($"Temp Vars", tempVars.Select(t => new TreeNode(t.ToString())).ToArray())); } result.Add(GetCurrentProjectParentNode(model.CurrentProject)); result.AddRange(GetObjectPropertiesAsTreeNodes(model)); return(result); }
public AccessQueryDefCollectionModel(RotApplicationModel rotApplicationModel) : this(rotApplicationModel.Application.CurrentDb()) { }
public AccessObjectFunctionCollectionModel(RotApplicationModel rotApplicationModel) : this(rotApplicationModel.Application.CurrentData.AllFunctions) { }