Ejemplo n.º 1
0
        private void setTreeView(TreeView tv, bool isSource)
        {
            try
            {
                var            views     = allViews.Where(tb => tb.IsSourceDB == isSource).OrderBy(tb => tb.DBView.Name);
                CustomTreeNode startNode = new CustomTreeNode();
                startNode.IsParent = true;
                startNode.CanMenu  = false;
                startNode.Text     = "所有视图";

                tv.Nodes.Add(startNode);

                var tempNode = new CustomTreeNode();
                var color    = Color.Black;
                var tip      = "";
                foreach (var view in views)
                {
                    switch (view.Differences)
                    {
                    case DifferencesType.unique:
                        color = Color.Green;
                        break;

                    case DifferencesType.differences:
                        color = Color.Orange;
                        break;

                    case DifferencesType.common:
                        color = Color.Black;
                        break;

                    case DifferencesType.lack:
                        color = Color.Gray;
                        break;

                    default:
                        color = Color.Black;
                        break;
                    }
                    tempNode             = new CustomTreeNode();
                    tempNode.IsParent    = true;
                    tempNode.CanMenu     = true;
                    tempNode.Text        = view.DBView.Name;
                    tempNode.View        = view.DBView;
                    tempNode.Differences = view.Differences;
                    tempNode.IsSourceDB  = view.IsSourceDB;
                    tempNode.ForeColor   = color;
                    startNode.Nodes.Add(tempNode);
                }
                startNode.Expand();
            }
            catch (Exception ex)
            {
                txtSql.Text = string.Format("--消息:{0}", ex.Message);
                throw ex;
            }
        }
Ejemplo n.º 2
0
        private void PopulateSpatialStructure(Document document)
        {
            CustomTreeNode sitesNode = new CustomTreeNode("Liegenschaften", document.Project.Sites);

            tv.Nodes.Add(sitesNode);

            string name     = "";
            string longName = "";

            foreach (IfcSite site in document.Project.Sites)
            {
                CustomTreeNode siteNode = new CustomTreeNode("Liegenschaft", site);
                name          = String.IsNullOrEmpty(site.Name) ? "<Name>" : site.Name;
                longName      = String.IsNullOrEmpty(site.LongName) ? "" : site.LongName;
                siteNode.Text = String.Format("{0} {1}", name, longName);
                sitesNode.Nodes.Add(siteNode);
                siteNode.Expand();

                foreach (IfcBuilding building in site.Buildings)
                {
                    CustomTreeNode buildingNode = new CustomTreeNode("Gebäude", building);
                    name              = String.IsNullOrEmpty(building.Name) ? "<Name>" : building.Name;
                    longName          = String.IsNullOrEmpty(building.LongName) ? "" : building.LongName;
                    buildingNode.Text = String.Format("{0} {1}", name, longName);
                    siteNode.Nodes.Add(buildingNode);
                    buildingNode.Expand();

                    foreach (IfcBuildingStorey buildingStorey in building.BuildingStoreys)
                    {
                        CustomTreeNode buildingStoreyNode = new CustomTreeNode("Etage", buildingStorey);
                        name     = String.IsNullOrEmpty(buildingStorey.Name) ? "<Name>" : buildingStorey.Name;
                        longName = String.IsNullOrEmpty(buildingStorey.LongName) ? "" : buildingStorey.LongName;
                        buildingStoreyNode.Text = String.Format("{0} {1}", name, longName);
                        buildingNode.Nodes.Add(buildingStoreyNode);

                        foreach (IfcSpace space in buildingStorey.Spaces)
                        {
                            CustomTreeNode spaceNode = new CustomTreeNode("Raum", space);
                            name           = String.IsNullOrEmpty(space.Name) ? "<Name>" : space.Name;
                            longName       = String.IsNullOrEmpty(space.LongName) ? "" : space.LongName;
                            spaceNode.Text = String.Format("{0} {1}", name, longName);
                            buildingStoreyNode.Nodes.Add(spaceNode);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void PopulateCatalogues(Document document)
        {
            CustomTreeNode cataloguesNode = new CustomTreeNode("Kataloge" /*RESX.DW_STRUCTURE_NODERESOURCES*/, null);

            cataloguesNode.Expand();
            tv.Nodes.Add(cataloguesNode);

            var relatingClassificationRefs = document.IfcXmlDocument.Items.OfType <IfcRelAssociatesClassification>()
                                             .Where(root => root.RelatedObjects.Items.Exists(item => item.Ref == document.Project.Id))
                                             .Select(item => item.RelatingClassification.Item.Ref);

            var classifications = document.Classifications.Where(item => relatingClassificationRefs.Contains(item.Id));

            foreach (IfcClassification classification in classifications)
            {
                CustomTreeNode classificationNode = new CustomTreeNode(classification.Name, classification);
                // TODO: set node images, colors, ...
                cataloguesNode.Nodes.Add(classificationNode);

                string sid = classification.Id;
                PopulateCatalogue(classificationNode, document, sid);
            }
        }
Ejemplo n.º 4
0
        private void btnTesteLectie_Click(object sender, EventArgs e)
        {
            CustomTreeNode<Test>[] list =
                (from CustomTreeNode<Test> test in listaTeste.Nodes
                 where test.Text.Equals("Teste asociate lectiei")
                 select test).ToArray();

            if (list.Length > 0)
                listaTeste.Nodes.Remove(list[0]);

            if (Res.Instance.SelectedLectie.IdsTeste == null)
                return;

            var treeNode = new CustomTreeNode<Test>("Teste asociate lectiei",
                Res.Instance.GetTesteTreeNodes(Res.Instance.SelectedLectie.IdsTeste),
                null, true);
            treeNode.Expand();
            treeNode.BackColor = Color.YellowGreen;
            listaTeste.Nodes.Add(treeNode);

            SelectTab(tabPageTeste.Name);
        }
Ejemplo n.º 5
0
        private void setTreeView(TreeView tv, bool isSource)
        {
            try
            {
                var            tables    = allTables.Where(tb => tb.IsSourceDB == isSource).OrderBy(tb => tb.DBTable.Name);
                CustomTreeNode startNode = new CustomTreeNode();
                startNode.IsParent = true;
                startNode.CanMenu  = true;
                startNode.Text     = "所有表";
                tv.Nodes.Add(startNode);

                var tempNode = new CustomTreeNode();
                var color    = Color.Black;
                foreach (var table in tables)
                {
                    switch (table.Differences)
                    {
                    case DifferencesType.unique:
                        color = Color.Green;
                        break;

                    case DifferencesType.differences:
                        color = Color.Orange;
                        break;

                    case DifferencesType.common:
                        color = Color.Black;
                        break;

                    case DifferencesType.lack:
                        color = Color.Gray;
                        break;

                    default:
                        color = Color.Black;
                        break;
                    }
                    tempNode             = new CustomTreeNode();
                    tempNode.IsParent    = true;
                    tempNode.CanMenu     = true;
                    tempNode.Table       = table.DBTable;
                    tempNode.Text        = table.DBTable.Name;
                    tempNode.Differences = table.Differences;
                    tempNode.IsSourceDB  = table.IsSourceDB;
                    tempNode.ForeColor   = color;
                    startNode.Nodes.Add(tempNode);

                    var colNode = new CustomTreeNode();
                    foreach (Column col in table.DBTable.Columns)
                    {
                        colNode           = new CustomTreeNode();
                        colNode.Column    = col;
                        colNode.Text      = string.Format("{0}({1}{2}{3})", col.Name, col.InPrimaryKey ? "PK," : "", col.DataType.IsStringType ? string.Format("{0}({1}),", col.DataType.Name, col.DataType.MaximumLength) : col.DataType.Name + ",", col.Nullable ? "null" : "not null");
                        colNode.ForeColor = color;
                        tempNode.Nodes.Add(colNode);
                    }
                }
                startNode.Expand();
            }
            catch (Exception ex)
            {
                txtSql.Text = string.Format("--消息:{0}", ex.Message);
            }
        }