Пример #1
0
        void PathChanged(object sender, EventArgs e)
        {
            string solutionPath = ProjectSolution;

            try {
                if (solutionPath.Length > 3 && Path.IsPathRooted(solutionPath))
                {
                    solutionPath = solutionPath.Substring(3);
                    bool      didCut    = false;
                    const int maxLength = 62;
                    while (solutionPath.Length > maxLength && solutionPath.Length > 1)
                    {
                        int idx = solutionPath.IndexOf(Path.DirectorySeparatorChar, 1);
                        if (idx < 0)
                        {
                            break;
                        }
                        solutionPath = solutionPath.Substring(idx);
                        didCut       = true;
                    }
                    solutionPath = ProjectSolution.Substring(0, 3) + (didCut ? "..." : "") + solutionPath;
                    if (solutionPath.Length > maxLength + 6)
                    {
                        solutionPath = solutionPath.Substring(0, maxLength + 3) + "...";
                    }
                }
            } catch (ArgumentException) {
                ControlDictionary["createInLabel"].Text = ResourceService.GetString("ICSharpCode.SharpDevelop.Gui.Dialogs.NewProjectDialog.IllegalProjectNameError").Replace("\n", " ").Replace("\r", "");
                return;
            }
            ControlDictionary["createInLabel"].Text = ResourceService.GetString("Dialog.NewProject.ProjectAtDescription") + " " + solutionPath;
        }
Пример #2
0
        private void DatabaseDropdown_SelectedIndexChanged(Object sender, EventArgs e)
        {
            _currentSolution = null;

            this.SuspendLayout();
            this.GeneratorDalButton.Enabled = (this.CurrentDatabase != null);
            if (this.CurrentDatabase != null)
            {
                // Populate the domain dropdown within the entity details
                this.EntityDomainDropdown.Items.Clear();
                this.EntityDomainDropdown.Items.Add(new { Name = "" });
                this.EntityDomainDropdown.Items.AddRange(this.CurrentDatabase.Domains);
                this.EntityDomainDropdown.DisplayMember = "Name";

                // Populate the generator options with the solution information
                this.GeneratorSolutionNameTextbox.Text      = this.CurrentSolution.SolutionName;
                this.GeneratorSolutionVersionTextbox.Text   = this.CurrentSolution.SolutionVersion.ToString();
                this.GeneratorSolutionDirectoryTextbox.Text = this.CurrentSolution.SolutionPath.ToString();

                // Remove all nodes from the tree
                this.DomainTree.Nodes.Clear();
                this.DomainTree.Nodes.Add(this.RootNode);

                // Add a node to contain the entities that have not been added to a domain
                this.RootNode.Nodes.Clear();
                foreach (DataEntity entity in this.CurrentDatabase.Entities)
                {
                    this.AddTreeNode(this.RootNode.Nodes, entity);
                }

                // Add a node for each of the domains
                foreach (DataDomain domain in this.CurrentDatabase.Domains)
                {
                    this.AddTreeNode(this.DomainTree.Nodes, domain);
                    foreach (DataEntity entity in domain.Entities)
                    {
                        this.AddTreeNode(this.DomainTree.Nodes[domain.Identifier].Nodes, entity);
                    }
                }

                // Ensure all nodes are collapsed then select the first available entity
                this.DomainTree.CollapseAll();
                this.DomainTree.SelectedNode = this.DomainTree.Nodes.OfType <TreeNode>().Where(node => node != this.RootNode && node.Nodes.Count > 0).Select(node => node.Nodes[0]).FirstOrDefault() ?? this.RootNode.Nodes.OfType <TreeNode>().FirstOrDefault();
                this.DomainTree.Focus();
            }
            this.ResumeLayout(true);
        }
Пример #3
0
 /// <summary>
 ///     Initialises a new <see cref="Data.GeneratedProject"/> instance.
 /// </summary>
 /// <param name="solution">
 ///     Sets the parent solution within which, the project is location.
 /// </param>
 public GeneratedProject(ProjectSolution solution) : base(solution)
 {
 }
Пример #4
0
 /// <summary>
 ///     Initialises a new code generator
 /// </summary>
 public CodeGenerator(Database database, ProjectSolution solution, Boolean generateBaseTypes)
 {
     this.CurrentDatabase   = database;
     this.CurrentSolution   = solution;
     this.GenerateBaseTypes = generateBaseTypes;
 }