Exemplo n.º 1
0
        public void Fill(Database db, ConnectionInfo ci, bool selectFirst)
        {
            isLoading = true;
            //trv.Nodes.Clear();
            string time;

            var tc = new TimerCount();

            using (progress = new FormProgress())
            {
                //f.StartProgress(1, count);
                progress.SetMessage("Loading objects");
                progress.Show(this);
                progress.Update();

                try
                {
                    tc.Next("NodeDatabase");

                    if (nodeDb == null)
                    {
                        nodeDb = new NodeDatabase(ci.Text);
                        nodeDb.Fill(db);
                        trv.Nodes.Add(nodeDb);

                        trv.HandleMultiSelection = true;

                        tc.Next("ExpandAllForce");
                        trv.ExpandAllForce(db);
                    }

                    tc.Next("DataToView");
                    DataToView();
                    tc.Next("LoadGrid");
                    LoadGrid(db);
                    tc.Next("nodeDb.Expand()");
                    nodeDb.Expand();

                    if (selectFirst)
                    {
                        bool isSelected = false;

                        int count = 0;

                        var nodeTables = GetNode <NodeTables>();
                        foreach (NodeBase node in nodeTables.Nodes)
                        {
                            count++;
                            if (node.Checked)
                            {
                                isSelected       = true;
                                trv.SelectedNode = node;
                                node.EnsureVisible();
                                break;
                            }
                        }

                        if (!isSelected)
                        {
                            var nodeViews = GetNode <NodeViews>();
                            foreach (NodeBase node in nodeViews.Nodes)
                            {
                                count++;
                                if (node.Checked)
                                {
                                    trv.SelectedNode = node;
                                    node.EnsureVisible();
                                    break;
                                }
                            }
                        }

                        if (count <= 15)
                        {
                            trv.TopNode = nodeDb;
                        }
                    }


                    //nodeDb.Checked = false;
                    //nodeDb.UncheckChildren();
                    //nodeDb.Checked = false;

                    time = tc.ToString();
                }
                catch (Exception ex)
                {
                    time = tc.ToString();
                    Program.ShowError(ex);
                }
            }

            //ControlUtil.ChangeFontOnlyParent(tabObjects, 12);

            isLoading = false;

#if DEBUG2
            if (db.ProviderType == EnumDbProviderType.Oracle)
            {
                Program.ShowInformation(time);
            }
#endif
        }
Exemplo n.º 2
0
        public void Fill(Database db, ConnectionInfo ci)
        {
            isLoading = true;
            trv.Nodes.Clear();
            string time;

            var tc = new TimerCount();

            file.Parameters.Tables.ForEach(p => p.IsSelected = false);
            file.Parameters.Views.ForEach(p => p.IsSelected  = false);

            using (progress = new FormProgress())
            {
                //f.StartProgress(1, count);
                progress.SetMessage("Loading objects");
                progress.Show(this);
                progress.Update();

                try
                {
                    tc.Next("NodeDatabase");
                    nodeDb = new NodeDatabase(ci.Text);
                    nodeDb.Fill(db);
                    trv.Nodes.Add(nodeDb);

                    trv.HandleMultiSelection = true;

                    tc.Next("ExpandAllForce");
                    trv.ExpandAllForce(db);

                    tc.Next("DataToView");
                    DataToView();
                    tc.Next("LoadGrid");
                    LoadGrid(db);
                    tc.Next("nodeDb.Expand()");
                    nodeDb.Expand();

                    nodeDb.Checked = false;
                    nodeDb.UncheckChildren();
                    nodeDb.Checked = false;

                    time = tc.ToString();
                }
                catch (Exception ex)
                {
                    time = tc.ToString();
                    Program.ShowError(ex);
                }
            }

            //ControlUtil.ChangeFontOnlyParent(tabObjects, 12);

            isLoading = false;

#if DEBUG2
            if (db.ProviderType == EnumDbProviderType.Oracle)
            {
                Program.ShowInformation(time);
            }
#endif
        }