Esempio n. 1
0
        public void Populate(ArrayList designs)
        {
            Hashtable categories = new Hashtable(0, new CaseInsensitiveHashCodeProvider(), new CaseInsensitiveComparer());

            treeView1.BeginUpdate();

            // clear nodes
            treeView1.Nodes.Clear();

            for (int i = 0; i < designs.Count; ++i)
            {
                DesignData   design   = (DesignData)designs[i];
                CategoryNode category = null;

                if (categories.ContainsKey(design.Category))
                {
                    category = (CategoryNode)categories[design.Category];
                }
                else
                {
                    category = new CategoryNode(design.Category);
                    categories.Add(category.Text, category);
                    treeView1.Nodes.Add(category);
                }

                category.AddDesign(design);
            }

            treeView1.EndUpdate();
            categories.Clear();
        }
        /// <summary>
        /// Shows the open file dialog box and opens a document.
        /// </summary>
        private void OpenDocument()
        {
            string fileName = SelectOpenFileName();

            if (fileName == null)
            {
                return;
            }

            // This operation can take some time so we set the Cursor to WaitCursor.
            Application.DoEvents();
            Cursor cursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            // Load document is put in a try-catch block to handle situations when it fails for some reason.
            try
            {
                // Loads the document into Aspose.Words object model.
                mDocument = new Document(fileName);

                Tree.BeginUpdate();

                // Clears the tree from the previously loaded documents.
                Tree.Nodes.Clear();

                // Creates instance of an Item class which will control the GUI representation of the document root node.
                Tree.Nodes.Add(Item.CreateItem(mDocument).TreeNode);

                // Shows the immediate children of the document node.
                Tree.Nodes[0].Expand();

                // Selects root node of the tree.
                Tree.SelectedNode = Tree.Nodes[0];

                Tree.EndUpdate();

                Text = "Document Explorer - " + fileName;

                menuSaveAs.Enabled          = true;
                toolBar1.Buttons[1].Enabled = true;

                menuRender.Enabled          = true;
                toolBar1.Buttons[3].Enabled = true;
                menuPreview.Enabled         = true;
                toolBar1.Buttons[4].Enabled = true;

                menuExpandAll.Enabled       = true;
                toolBar1.Buttons[6].Enabled = true;
                menuCollapseAll.Enabled     = true;
                toolBar1.Buttons[7].Enabled = true;
            }
            catch (Exception ex)
            {
                new ExceptionDialog(ex).ShowDialog();
            }

            // Restore cursor.
            Cursor.Current = cursor;
        }
Esempio n. 3
0
        /// <summary>
        /// Purpose: Initializes the tree and fill the root node with the initial nodes.
        /// </summary>
        private void InitTreeAndFillRoot()
        {
            // Add all devices in this machine. Get them from WMI. See for
            // detailed WMI information the WMI Platform SDK Documentation.
            SelectQuery sqLogicalDrives                 = new SelectQuery("SELECT * FROM Win32_LogicalDisk");
            ManagementObjectSearcher   mosSearcher      = new ManagementObjectSearcher(sqLogicalDrives);
            ManagementObjectCollection mocLogicalDrives = mosSearcher.Get();

            tvMain.BeginUpdate();
            foreach (ManagementObject moDrive in mocLogicalDrives)
            {
                // add a node. Select an image for the drive type.
                TreeNode tnNode     = tvMain.Nodes.Add(moDrive.Properties["DeviceID"].Value.ToString());
                int      iDriveType = int.Parse(moDrive.Properties["DriveType"].Value.ToString());
                if (iDriveType < 2 || iDriveType > 5)
                {
                    tnNode.ImageIndex         = 0;
                    tnNode.SelectedImageIndex = 0;
                }
                else
                {
                    tnNode.ImageIndex         = iDriveType;
                    tnNode.SelectedImageIndex = iDriveType;
                }
                // add dummy node so the user can browse fast through the directories.
                // add an empty string, a directory can't be an empty string.
                TreeNode tnDummy = tnNode.Nodes.Add("");
            }
            tvMain.EndUpdate();
        }
Esempio n. 4
0
        public void InitializeVirtual(string platform)
        {
            if (!mInitialized)
            {
                GameDataTreeView.BeginUpdate();

                GameDataTreeView.Nodes.Clear();
                mVirtual = true;

                // Populate our project tree
                ArrayList virtualDirectories        = MOG_DBAssetAPI.GetAllProjectSyncTargetFilesForPlatform(platform);
                ArrayList fixedUpVirtualDirectories = new ArrayList();
                foreach (string file in virtualDirectories)
                {
                    // Only add files that have '\\' in front of them.  These are files.  Those
                    // without '\\' are packages and the files that go into them
                    if (file.StartsWith("\\"))
                    {
                        fixedUpVirtualDirectories.Add(file.TrimStart("\\".ToCharArray()));
                    }
                    else
                    {
                        // File did not have a starting '\', so just add it :)
                        fixedUpVirtualDirectories.Add(file);
                    }
                }

                mSyncTargetFiles = new DirectorySet(fixedUpVirtualDirectories);
                if (MOG_ControllerProject.GetCurrentSyncDataController() != null)
                {
                    mRoot     = new TreeNode(MOG_ControllerProject.GetCurrentSyncDataController().GetSyncDirectory());
                    mRoot.Tag = new guiAssetTreeTag(MOG_ControllerProject.GetCurrentSyncDataController().GetSyncDirectory(), mRoot, MOG_ControllerProject.GetCurrentSyncDataController(), false);

                    VirtualExpand(mRoot, "", MOG_ControllerProject.GetCurrentSyncDataController());

                    FillDirectory(mRoot, MOG_ControllerProject.GetCurrentSyncDataController().GetSyncDirectory(), SystemColors.InactiveCaptionText);

                    GameDataTreeView.Nodes.Add(mRoot);

                    mRoot.Expand();
                }

                mInitialized = true;

                // If we have nothing for this tree, we should disable it...
                if (GameDataTreeView.Nodes.Count < 1)
                {
                    GameDataTreeView.Visible = false;
                    NoLocalDataLabel.Visible = true;
                }
                else
                {
                    GameDataTreeView.Visible = true;
                    NoLocalDataLabel.Visible = false;
                }

                GameDataTreeView.EndUpdate();
            }
        }
Esempio n. 5
0
 private void tvRegistry_BeforeExpand(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
 {
     tvRegistry.BeginUpdate();
     foreach (TreeNode tn in e.Node.Nodes)
     {
         AddBranch(tn);
     }
     tvRegistry.EndUpdate();
 }
Esempio n. 6
0
        private void CloseCurrentFile()
        {
            _treeView_Elements.BeginUpdate();
            _treeView_Elements.Nodes.Clear();
            _treeView_Elements.EndUpdate();

            _dsImage.Reset();

            FreeImage();
        }
Esempio n. 7
0
        private void OpenDatabase(string fName)
        {
            if (database != null)
            {
                CloseDatabase();
            }

            if (fName.Length > 0)
            {
                database = new SqliteDb();
                int err = database.Open(fName);
                if (err != 0)
                {
                    database = null;
                }
            }

            if (database != null)
            {
                databaseName = fName;

                treeView1.BeginUpdate();

                // Clear the TreeView each time the method is called.
                treeView1.Nodes.Clear();

                TreeNode databaseNode = new TreeNode(fName);

                SqliteVm vm        = new SqliteVm(database, true);
                string   tableList = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;";

                int fini = vm.Execute(tableList);
                while (fini == Sqlite.Row)
                {
                    string tableName = vm.GetString("name");

                    databaseNode.Nodes.Add(tableName);

                    fini = vm.NextRow();
                }
                vm.SqlFinalize();
                vm = null;

                treeView1.Nodes.Add(databaseNode);

                treeView1.EndUpdate();
                //Enable menu items
                this.menuItem3.Enabled      = true;
                this.menuAddTest.Enabled    = true;
                this.saveAsMenuItem.Enabled = true;
                this.saveDbMenuItem.Enabled = true;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Clears all the tree nodes and reloads the scripts from Pandora
        /// </summary>
        private void RefreshTrees()
        {
            tCat.BeginUpdate();
            tItems.BeginUpdate();

            tCat.Nodes.Clear();
            tItems.Nodes.Clear();

            tCat.Nodes.AddRange(Pandora.Items.GetNodes());

            tCat.EndUpdate();
            tItems.EndUpdate();
        }
Esempio n. 9
0
        /// <summary>
        /// Refreshes the trees
        /// </summary>
        private void RefreshTrees()
        {
            tCat.BeginUpdate();
            tDeco.BeginUpdate();

            tCat.Nodes.Clear();
            tDeco.Nodes.Clear();

            tCat.Nodes.AddRange(Decorator.TreeNodes);

            tCat.EndUpdate();
            tDeco.EndUpdate();
        }
Esempio n. 10
0
        /// <summary>
        /// Refresh both treenodes
        /// </summary>
        private void RefreshTrees()
        {
            tClasses.BeginUpdate();
            tProps.BeginUpdate();

            tClasses.Nodes.Clear();
            tProps.Nodes.Clear();

            tClasses.Nodes.AddRange(PropsData.Props.TreeNodes);

            tClasses.EndUpdate();
            tProps.EndUpdate();
        }
        /// <summary>
        /// Initialize the Explorer treeView
        /// </summary>
        public void Initialize()
        {
            GameDataTreeView.BeginUpdate();
            GameDataTreeView.Nodes.Clear();

            // Create MOG projects root
            PopulateMogProjects();

            // Get all local drives available on this computer
            PopulateLocalDrives(DRIVE_TYPE_HD);

            GameDataTreeView.EndUpdate();
        }
Esempio n. 12
0
 private void fillTreeTeachers()
 {
     _treeView1.BeginUpdate();
     foreach (Teacher teacher in AppForm.CURR_OCTT_DOC.TeachersRootNode.Nodes)
     {
         TreeNode tn = new TreeNode(teacher.getTreeText());
         tn.Tag = teacher;
         _treeView1.Nodes.Add(tn);
     }
     _treeView1.ExpandAll();
     _treeView1.EndUpdate();
     this.Refresh();
 }
Esempio n. 13
0
        /// <summary>
        /// Gets or sets a value indicating whether the New Folder item appears in the menu.
        /// </summary>
        //public bool ShowNewFolderButton
        //{
        //    get
        //    {
        //        return mnuNew.Enabled;
        //    }
        //    set
        //    {
        //        mnuNew.Enabled = value;
        //    }
        //}
        #endregion

        #region Helper Functions

        /// <summary>
        /// Adds the root node for the device to the TreeView
        /// </summary>
        private void AddRoot()
        {
            //stop updates during filling
            tvFolders.BeginUpdate();

            //add an empty node (use device image)
            TreeNode root = tvFolders.Nodes.Add("");

            root.ImageIndex         = 0;     // ehemals 1
            root.SelectedImageIndex = 0;     // ehemals 1

            tvFolders.EndUpdate();
        }
Esempio n. 14
0
        LoadTree()
        {
            m_tvDom.BeginUpdate();  // suppress redraw events
            m_tvDom.Nodes.Clear();

            MakeTree(m_xmlDoc, null);

            m_tvDom.ExpandAll();
            if (m_tvDom.Nodes.Count > 0)
            {
                m_tvDom.SelectedNode = m_tvDom.Nodes[0]; // make first one selected
            }
            m_tvDom.EndUpdate();                         // flushes redraw events
        }
Esempio n. 15
0
        DBObjects(AcDb.ObjectIdCollection objIds, TransactionHelper tr)
        {
            m_trans = tr;

            // Required for Windows Form Designer support
            InitializeComponent();

            m_tvObjs.BeginUpdate();

            AddObjectIdCollectionToTree(objIds);
            m_tvObjs.ExpandAll();

            m_tvObjs.EndUpdate();
        }
Esempio n. 16
0
        private void miNew_Click(object sender, System.EventArgs e)
        {
            CheckModified();

            tCat.BeginUpdate();
            tCat.Nodes.Clear();
            tCat.EndUpdate();

            tLoc.BeginUpdate();
            tLoc.Nodes.Clear();
            tLoc.EndUpdate();

            m_Changed = false;
        }
Esempio n. 17
0
        /// <summary>
        /// 传入ID信息查找模板的值
        /// </summary>
        /// <param name="strReportID"></param>
        /// <param name="strFormID"></param>
        /// <param name="strControlID"></param>
        private void m_mthFindAllTemplateUsedInCtl(string strFormID, string strControlID)
        {
            if (strFormID == null || strControlID == null || strFormID.Length <= 0 || strControlID.Length <= 0)
            {
                return;
            }
            m_objTextTemplate.m_strDoctor_ID  = MDIParent.strOperatorID.Trim();
            m_objTextTemplate.m_strFORM_ID    = strFormID;
            m_objTextTemplate.m_strCONTROL_ID = strControlID;
            clsTemplateInfo[] objTemplateInfo;
//			clsTextTemplate objTextTemplate;

            CustomFromService.clsMinElementColServ m_objServ =
                (CustomFromService.clsMinElementColServ)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(CustomFromService.clsMinElementColServ));

            long lngRes = m_objServ.m_lngGetTemplates(strFormID, strControlID, out objTemplateInfo);

            if (lngRes > 0 && objTemplateInfo != null)
            {
                treeView1.BeginUpdate();
                for (int i = 0; i < objTemplateInfo.Length; i++)
                {
                    TreeNode node = new TreeNode(objTemplateInfo[i].m_strTEMPLATE_NAME);
                    node.Tag                = objTemplateInfo[i];
                    node.ImageIndex         = 2;
                    node.SelectedImageIndex = 1;
                    if (objTemplateInfo[i].m_strDoctor_ID.Trim() == MDIParent.strOperatorID.Trim())
                    {
                        node.ForeColor = Color.Green;
                    }
//					else
//						node.ForeColor = Color.Yellow;
                    treeView1.Nodes[0].Nodes.Add(node);
                }
                treeView1.ExpandAll();
                treeView1.EndUpdate();
                m_pnlControl.Tag = "";
//				m_objTextTemplate.m_strGUI_ID=objTextTemplate.m_strGUI_ID;
//				this.m_pnlControl.Tag=objTTVO.m_strGUI_ID;
//				if(objTIVO!=null)
//				{
//				m_mthLoadControl(objTIVO.m_strTEMPLATE_XML);
//				this.m_cmdChange.Tag=objTIVO;
//				}
//				if(objTTVO.m_objTmpCtlValueArr!=null)
//				{
//				m_mthLoadControlValue(objTTVO.m_objTmpCtlValueArr);
//				}
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Reloads the trees
        /// </summary>
        private void RefreshTrees()
        {
            tCat.BeginUpdate();
            tImg.BeginUpdate();

            tCat.Nodes.Clear();
            tImg.Nodes.Clear();

            tCat.Nodes.Add(GetDirectoryNode(Pandora.Profile.Screenshots.BaseFolder));
            tCat.Nodes[0].Expand();

            tCat.EndUpdate();
            tImg.EndUpdate();
        }
Esempio n. 19
0
        private void btLoad_Click(object sender, System.EventArgs e)
        {
            OE.OEFolder  folder;
            OE.OEProject project;
            int          i, p = 0;
            int          cnt = OE.FoldersCount;
            TreeNode     root;
            TreeNode     node;

            Tree.BeginUpdate();
            Tree.Nodes.Clear();
            for (i = 0; i < cnt; i++)
            {
                folder   = OE.GetFolder(i);
                root     = new TreeNode(folder.Caption);
                root.Tag = folder;
                Tree.Nodes.Add(root);
                for (p = 0; p < folder.ItemsCount; p++)
                {
                    project = (OE.OEProject)folder.GetItem(p);
                    node    = new TreeNode(project.Caption);
                    root.Nodes.Add(node);
                    node.Tag = project;
//					node = Tree.Nodes.Add( root );
//					node.Text = project.Caption;
                }
            }
            Tree.EndUpdate();
        }
        private void SetupTree()
        {
            TreeNode CourseNode;
            TreeNode CardNode;

            tvwCourse.Nodes.Clear();
            tvwCourse.BeginUpdate();

            tvwCourse.ImageList          = imgIcons;
            tvwCourse.ImageIndex         = 0;
            tvwCourse.SelectedImageIndex = 0;
            foreach (ICourseInfo c in mParent.db.GolfCourses)
            {
                CourseNode     = tvwCourse.Nodes.Add(c.Name);
                CourseNode.Tag = c;
                foreach (IScoreCardInfo card in c.ScoreCards)
                {
                    CardNode     = CourseNode.Nodes.Add(card.PlayDate.ToShortDateString());
                    CardNode.Tag = card;
                }
            }

            tvwCourse.AfterSelect += new TreeViewEventHandler(CourseStats);
            tvwCourse.EndUpdate();
        }
Esempio n. 21
0
        public static void LoadCategoriesView(TreeView target, PosData.CategoriesDataTable source)
        {
            var roots = from p in source
                        select p;
            target.BeginUpdate();
            TreeNode currentNode = null;
            foreach (PosData.CategoriesRow row in roots)
            {
                if (row.ParentId == 0)//root nodes only
                {
                    currentNode = new TreeNode(row.CategoryName, 0, 0);
                    currentNode.Tag = row.CategoryId;
                    target.Nodes.Add(currentNode);
                }

                var current = from c in source
                              where c.ParentId == row.CategoryId && c.ParentId != 0L
                              select c;
                if (current != null && current.Count<PosData.CategoriesRow>() > 0)
                {
                    _LoadCategoriesView(currentNode, current, source);
                }

            }
            target.EndUpdate();
        }
Esempio n. 22
0
        public void initialTree(System.Windows.Forms.TreeView tv, System.Data.DataSet ds)
        {
            tv.BeginUpdate();
            tv.Nodes.Clear();
            System.Windows.Forms.TreeNode tn = null;
            if (tv.Nodes.Count == 0)
            {
                tn = new System.Windows.Forms.TreeNode("SNOMED", 4, 4);
                tv.Nodes.Add(tn);
            }
            else
            {
                tn = tv.Nodes[0];
            }

            //添加子节点
            foreach (DataRow dr in ds.Tables["cnp_com_snopmed"].Rows)
            {
                TreeNode treeModual = null;
                if (string.Compare(dr["PARENTCODE"].ToString(), "root") == 0)
                {
                    foreach (TreeNode treeNode in tn.Nodes) //父亲结点
                    {
                        break;
                    }
                    if (treeModual == null)
                    {
                        treeModual     = new TreeNode(dr["ID"].ToString(), 0, 1);
                        treeModual.Tag = dr["ID"].ToString();
                        tn.Nodes.Add(treeModual);
                        //添加孙子节点
                        foreach (DataRow dt in ds.Tables["cnp_com_snopmed"].Rows)
                        {
                            TreeNode treeType = null;
                            if (string.Compare(dt["PARENTCODE"].ToString(), treeModual.Text) == 0)
                            {
                                foreach (TreeNode treeNodeType in treeModual.Nodes)
                                {
                                    if (treeNodeType.Text == dr["ID"].ToString())
                                    {
                                        treeType = treeNodeType;
                                        break;
                                    }
                                }
                                if (treeType == null)
                                {
                                    treeType      = new TreeNode(dr["ID"].ToString(), 0, 1);
                                    treeType.Tag  = dt["ID"].ToString();
                                    treeType.Text = dt["NAME"].ToString();
                                    treeModual.Nodes.Add(treeType);
                                }
                            }
                        }
                        treeModual.Text = dr["NAME"].ToString();
                    }
                }
            }

            tv.EndUpdate();
        }
Esempio n. 23
0
        protected void CommonInit(IEnumerable <SnoopableObjectWrapper> objs)
        {
            m_tvObjs.BeginUpdate();

            AddObjectsToTree(objs);

            // if the tree isn't well populated, expand it and select the first item
            // so its not a pain for the user when there is only one relevant item in the tree
            if (m_tvObjs.Nodes.Count == 1)
            {
                m_tvObjs.Nodes[0].Expand();
                if (m_tvObjs.Nodes[0].Nodes.Count == 0)
                {
                    m_tvObjs.SelectedNode = m_tvObjs.Nodes[0];
                }
                else
                {
                    m_tvObjs.SelectedNode = m_tvObjs.Nodes[0].Nodes[0];
                }
            }

            m_tvObjs.EndUpdate();

            // Add Load to update ListView Width
            Utils.AddOnLoadForm(this);
        }
Esempio n. 24
0
        private void m_cndFind_Click(object sender, System.EventArgs e)
        {
            clsCaseGradeValue[] objGradeValueArr;
            if (m_cboDept.SelectedItem == null /*|| m_cboArea.SelectedItem == null*/)
            {
                clsPublicFunction.ShowInformationMessageBox("请先选择科室!");
                return;
            }

            long lngRes = 0;

            if (m_cboArea.Items.Count > 0)
            {
                if (m_cboArea.SelectedItem == null)
                {
                    clsPublicFunction.ShowInformationMessageBox("请先选择病区!");
                    return;
                }
                lngRes = m_objDomain.m_lngGetGradeInfoByArea(((clsInPatientArea)m_cboArea.SelectedItem).m_StrAreaID_CHR, m_dtpSeachDate.Value, m_dtpSeachDate2.Value, out objGradeValueArr);
            }
            else
            {
                lngRes = m_objDomain.m_lngGetGradeInfoByDept(((clsDepartment)m_cboDept.SelectedItem).m_StrDeptID, m_dtpSeachDate.Value, m_dtpSeachDate2.Value, out objGradeValueArr);
            }

            if (lngRes <= 0 || objGradeValueArr == null)
            {
                return;
            }

            m_trvPatient.BeginUpdate();
            m_trvPatient.Nodes.Clear();

            TreeNode node = null;

            if (m_cboArea.Items.Count > 0)
            {
                node     = new TreeNode(m_cboArea.SelectedItem.ToString());
                node.Tag = (clsInPatientArea)m_cboArea.SelectedItem;
            }
            else
            {
                node     = new TreeNode(m_cboDept.SelectedItem.ToString());
                node.Tag = (clsDepartment)m_cboDept.SelectedItem;
            }

            node.ImageIndex = 0;
            for (int i = 0; i < objGradeValueArr.Length; i++)
            {
                TreeNode trnChild = new TreeNode(objGradeValueArr[i].m_strInPatientID);
                trnChild.Tag                = objGradeValueArr[i];
                trnChild.ImageIndex         = 1;
                trnChild.SelectedImageIndex = 1;
                node.Nodes.Add(trnChild);
            }
            m_trvPatient.Nodes.Add(node);
            m_trvPatient.SelectedNode = node;
            m_trvPatient.ExpandAll();
            m_trvPatient.EndUpdate();
        }
Esempio n. 25
0
        private void RefreshTree()
        {
            tvFormula.BeginUpdate();
            try
            {
                tvFormula.ImageList = ilFormula;
                tvFormula.Nodes.Clear();
                tvFormula.Nodes.Add("Root");
                tvFormula.Nodes[0].Nodes.Add("Basic");
                //tvFormula.Nodes[0].Nodes.Add("Test");

                FormulaBase[] fbs = FormulaBase.GetAllFormulas();
                foreach (FormulaBase fb in fbs)
                {
                    CreateNode(fb);
                }

                tvFormula.Nodes[0].Expand();
                tvFormula.Nodes[0].Nodes[0].Expand();
                gbParam.Controls.Clear();

                if (tvFormula.Nodes[0].Nodes[0].Nodes.Count > 0)
                {
                    tvFormula.SelectedNode = tvFormula.Nodes[0].Nodes[0].Nodes[0];
                }
            }
            finally
            {
                tvFormula.EndUpdate();
            }
        }
        public void DrawTree(TreeView treeView)
        {
            treeView.BeginUpdate();
            treeView.Nodes["All"].Nodes.Clear();
            foreach (Site site in SiteCollection)
            {
                TreeNode siteNode = new TreeNode(site.Dto.DescriptionName);
                siteNode.Tag = site;
                treeView.Nodes["All"].Nodes.Add(siteNode);
                foreach (Team team in site.TeamColl)
                {
                    TreeNode teamNode = new TreeNode(team.Dto.Description);
                    teamNode.Tag = team;
                    siteNode.Nodes.Add(teamNode);
                    foreach (Agent agent in team.AgentColl)
                    {
                        TreeNode agentNode = new TreeNode(agent.Dto.Name);
                        agentNode.Tag = agent;
                        teamNode.Nodes.Add(agentNode);
                    }
                }
            }

            treeView.EndUpdate();
        }
Esempio n. 27
0
 /// <summary>
 /// Refreshes the tree
 /// </summary>
 private void DoTree()
 {
     Tree.BeginUpdate();
     Tree.Nodes.Clear();
     Tree.Nodes.AddRange(m_Info.GetTreeNodes());
     Tree.EndUpdate();
 }
 public static void RefreshTreeView(TreeView treeView)
 {
     treeView.BeginUpdate();
     foreach (NodeBase node in treeView.Nodes)
         node.Refresh();
     treeView.EndUpdate();
 }
Esempio n. 29
0
        private void FillTreeView(Listings TreeListing)
        {
            TreeNode nod;

            try
            {
                tvwBusiness.BeginUpdate();
                foreach (Listing li in TreeListing.Listing)
                {
                    nod = new TreeNode(li.CompanyName);
                    nod.Nodes.Add(li.Address);
                    nod.Nodes.Add(li.Phone);
                    tvwBusiness.Nodes.Add(nod);
                }
                tvwBusiness.EndUpdate();
            }


            catch (Exception ex)
            {
                MessageBox.Show("Could not parse results (" + ex.Message + ")!");
            }
            finally
            {
                tvwBusiness.Nodes.Clear();
            }
        }
Esempio n. 30
0
        void LoadData()
        {
            using (GmConnection conn = App.ConnectionFactory.CreateConnection())
            {
                GmCommand cmd = conn.CreateCommand("select ProductCode, Name as ProductName, ParentProductCode from Product where DeletedFlag=0 and GroupFlag=1");


                using (IDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Product p = new Product(dr);
                        htProducts.Add(p.Code, p);
                    }
                }
            }
            foreach (Product p in htProducts.Values)
            {
                if (p.ParentCode != null)
                {
                    Product parent = htProducts[p.ParentCode] as Product;
                    p.SetParent(parent);
                }
                else
                {
                    rootProducts.Add(p);
                }
            }
            treeView.BeginUpdate();
            BuildTree(treeView.Nodes, rootProducts);
            treeView.EndUpdate();
            UpdateControls();
            UpdateStatus();
        }
Esempio n. 31
0
        // read list of catalogs for the given library (in the tree node)
        private void PopulateCatalogs(TreeNode tn)
        {
            Cursor c = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            tvLibsCats.BeginUpdate();

            if (tn != null)
            {
                SasLibrary l = new SasLibrary(currentServer, tn.Text);
                if (l != null)
                {
                    foreach (SasCatalog cat in l.GetSasCatalogMembers())
                    {
                        TreeNode catNode = tn.Nodes.Add(cat.Name);
                        catNode.ImageIndex         = (int)CatImages.Catalog;
                        catNode.SelectedImageIndex = (int)CatImages.Catalog;
                        catNode.Tag = "CATALOG";
                    }
                }
            }

            tvLibsCats.EndUpdate();

            Cursor.Current = c;

            UpdateToolbar();
        }
Esempio n. 32
0
 public void RebuildTree(ObjectManager om)
 {
     this.om = om;
     tvObject.SuspendLayout();
     try
     {
         tvObject.BeginUpdate();
         try
         {
             tvObject.Nodes.Clear();
             foreach (BaseObject bo in om.Objects)
             {
                 TreeNode tn = new TreeNode(bo.Name);
                 tn.Tag = bo;
                 tvObject.Nodes.Add(tn);
             }
         }
         finally
         {
             tvObject.EndUpdate();
         }
     }
     finally
     {
         tvObject.ResumeLayout();
     }
 }
Esempio n. 33
0
        private void cmdFill_Click(object sender, System.EventArgs e)
        {
            DateTime tmr;
            TimeSpan ts;
            int      NumNodes = int.Parse(txtMax.Text);

            lblFill.Text  = "";
            lblClear.Text = "";
            Application.DoEvents();
            this.Cursor = Cursors.WaitCursor;
            tmr         = DateTime.Now;
//      Tree.BeginUpdate();
            //--------------------------------------------------------------------
            //Add only root nodes
            //      for(int k=0; k< NumNodes; k++)
            //        Tree.Nodes.Add("Node " + k.ToString());
            //--------------------------------------------------------------------

            //---------------------------------------------------------------------
            //Add a single root node and many child nodes.
//      TreeNode HeaderNode = Tree.Nodes.Add("User Header Node");
//      for(int k=0; k< NumNodes; k++)
//        HeaderNode.Nodes.Add("Node " + k.ToString());
//      HeaderNode.Expand();
            //---------------------------------------------------------------------

            //Add nodes and show them before shutting down the tree pane update
            bool     AllowUpdate = true;
            TreeNode HeaderNode  = Tree.Nodes.Add("User Header Node");

            for (int k = 0; k < NumNodes; k++)
            {
                if (AllowUpdate && HeaderNode.Nodes.Count > Tree.VisibleCount)
                {
                    HeaderNode.Expand();
                    Application.DoEvents();
                    Tree.BeginUpdate();
                    AllowUpdate = false;
                }
                HeaderNode.Nodes.Add("Node " + k.ToString());
            }
            Tree.EndUpdate();
            ts           = DateTime.Now - tmr;
            lblFill.Text = ts.TotalSeconds.ToString() + " seconds to add " +
                           NumNodes.ToString() + " Nodes ";
            this.Cursor = Cursors.Arrow;
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="TemporaryRedrawPauser"/> class.
		/// </summary>
		/// <param name="o">The o.</param>
		/// <param name="useWaitCursor">if set to <c>true</c> [use wait cursor].</param>
		public TemporaryRedrawPauser(
			TreeView o,
			bool useWaitCursor )
		{
			_o1 = o;
			o.BeginUpdate();

			enableWaitCursor( useWaitCursor, o );
		}
Esempio n. 35
0
 public static void DisplayTo( TreeView tree )
 {
     tree.BeginUpdate();
     tree.Nodes.Clear();
     Recurse( tree.Nodes, Config.GetUserDirectory( "Macros" ) );
     tree.EndUpdate();
     tree.Refresh();
     tree.Update();
 }
Esempio n. 36
0
        ////System.IO.StringWriter s;
        //public void SerializeTreeView(TreeView treeView, string fileName)
        //{
        //    XmlTextWriter textWriter = new XmlTextWriter(fileName, System.Text.Encoding.ASCII);
        //    // writing the xml declaration tag
        //    textWriter.WriteStartDocument();
        //    //textWriter.WriteRaw("\r\n");
        //    // writing the main tag that encloses all node tags
        //    textWriter.WriteStartElement("TreeView");
        //    // save the nodes, recursive method
        //    SaveNodes(treeView.Nodes, textWriter);
        //    textWriter.WriteEndElement();
        //    textWriter.Close();
        //}
        public void DeserializeTreeView(TreeView treeView, string fileName,XmlNode  parentXMLNode)
        {
            XmlTextReader reader = null;
            try
            {

                // disabling re-drawing of treeview till all nodes are added
                treeView.BeginUpdate();
                XmlDocument doc = new XmlDocument();
                XmlNode currentXmlNode = null;
                if (parentXMLNode == null)
                {
                    doc.Load(fileName);
                    currentXmlNode = doc.FirstChild;
                }
                else
                {
                    currentXmlNode = parentXMLNode;
                }
                foreach (XmlNode xmlNode in currentXmlNode.ChildNodes)
                {
                    if (xmlNode.NodeType == XmlNodeType.Element)
                    {
                        if (xmlNode.Name == FormDesignerConstants.FormPattern)
                        {
                            TreeNode newNode = new TreeNode();
                            newNode.Text = xmlNode.Name;
                            treeView.Nodes.Add(newNode);
                            HandleChildNodes(newNode, xmlNode);
                        }
                        if (xmlNode.Name == FormDesignerConstants.DataPattern)
                        {
                            TreeNode newNode = new TreeNode();
                            newNode.Text = xmlNode.Name;
                            treeView.Nodes.Add(newNode);
                            HandleChildNodes(newNode, xmlNode);
                        }
                        if (xmlNode.Name == FormDesignerConstants.WorkflowPattern)
                        {
                            TreeNode newNode = new TreeNode();
                            newNode.Text = xmlNode.Name;
                            treeView.Nodes.Add(newNode);
                            HandleChildNodes(newNode, xmlNode);
                        }
                    }
                }
            }
            catch (FileNotFoundException )
            {
                MessageBox.Show("Project Manifest.xml File not Found");
            }
            finally
            {
                // enabling redrawing of treeview after all nodes are added
                treeView.EndUpdate();
            }
        }
 public static void RecordStep(TreeView tree, string step)
 {
     if (tree.Nodes[0] != null)
     {
         tree.BeginUpdate();
         tree.Nodes[0].Nodes.Insert(tree.Nodes[0].Nodes.Count, step);
         tree.EndUpdate();
         tree.ExpandAll();
     }
 }
Esempio n. 38
0
 public static void AddPageTree(TreeView tvPages)
 {
     var dal = DALFacade.GetPageSchemeDAL();
     var schemes = dal.SelectAll();
     tvPages.BeginUpdate();
     tvPages.Nodes.Clear();
     foreach (var scheme in schemes)
     {
         var node = new TreeNode(scheme.Name);
         node.Tag = node;
         tvPages.Nodes.Add(node);
     }
     Cursor.Current = Cursors.Default;
     tvPages.EndUpdate();
 }
        //-----------------------------------------------------------------------------
        // Print the value to the treeview
        // This will clear out the TreeView and repopulate it with the Value.
        //-----------------------------------------------------------------------------
        void Print(MDbgValue val, TreeView t)
        {
            t.BeginUpdate();

            t.Nodes.Clear();

            if (val == null)
            {
                t.Nodes.Add("(Error:Expression not valid in this scope)");
            }
            else
            {
                PrintInternal(val, t.Nodes, 0);
            }

            t.EndUpdate();
        }
Esempio n. 40
0
        /// <summary>
        /// Adds a Computer object to the specified TreeView.
        /// </summary>
        /// <param name="treeView">TreeView to add Computer to</param>
        /// <param name="computer">Computer added as a node to the TreeView</param>
        public static void AddComputerToView(TreeView treeView, Computer computer)
        {
            TreeNode computerNode = new TreeNode(computer.Name);

            AddOperatingSystemNode(computerNode, computer.OperatingSystem);
            AddPrintersNode(computerNode, computer.Printers);
            AddProcessesNode(computerNode, computer.Processes);
            AddSharesNode(computerNode, computer.Shares);
            AddLogicalDisksNode(computerNode, computer.LogicalDisks);
            AddComputerSystemNode(computerNode, computer.System);
            AddProcessorsNode(computerNode, computer.Processors);
            AddNetworkAdaptersNode(computerNode, computer.NetworkAdapters);

            // Add computer node and its related nodes to this tree view control
            treeView.BeginUpdate();
            treeView.Nodes.Add(computerNode);
            treeView.EndUpdate();
        }
Esempio n. 41
0
        public void Build(TreeView tree)
        {
            tree.BeginUpdate();
            tree.Nodes.Clear();
            tree.Nodes.Add(ReadHeader(objectFile.Header));
            tree.Nodes.Add(ReadReferences(objectFile.References));
            tree.Nodes.Add(ReadGlobals(objectFile.Globals));
            tree.Nodes.Add(ReadLateBounds(objectFile.LateBounds));
            tree.Nodes.Add(ReadLayouts(objectFile.Layouts));
            tree.Nodes.Add(ReadStrings(objectFile.Strings));
            tree.Nodes.Add(ReadTypes(objectFile.Types));
            tree.Nodes.Add(ReadClasses(objectFile.Classes));
            tree.Nodes.Add(ReadInstances(objectFile.Instances));
            tree.Nodes.Add(ReadConstructors(objectFile.Constructors));

            if (config.DisplayFlatOpCodes)
                tree.Nodes.Add(ReadCode(objectFile.OpCodes));

            tree.EndUpdate();
        }
Esempio n. 42
0
        public static void PopulateTreeView(DatabaseSchema schema, TreeView treeView1)
        {
            // Suppress repainting the TreeView until all the objects have been created.
            treeView1.BeginUpdate();

            treeView1.Nodes.Clear(); //clear out anything that exists
            treeView1.ShowNodeToolTips = true;

            var treeRoot = new TreeNode("Schema");
            treeView1.Nodes.Add(treeRoot);

            FillTables(treeRoot, schema);
            FillViews(treeRoot, schema);
            FillSprocs(treeRoot, schema.StoredProcedures);
            FillFunctions(treeRoot, schema);
            if (schema.Packages.Count > 0) FillPackages(treeRoot, schema);
            FillUsers(treeRoot, schema);

            treeView1.EndUpdate();
        }
Esempio n. 43
0
        private void BuildTree(String aText, List<String> summary, IFileSystemItem root,
            TreeView aView, Boolean insertSubfolders)
        {
            summary.Add(String.Format("Имя папки: {0}", root.Name));
            summary.Add(new String('-', 50));
            summary.Add(String.Empty);

            aView.BeginUpdate();
            try
            {
                aView.Nodes.Clear();
                TreeNode aRoot = InsertFsi(summary, root, insertSubfolders, true);
                aRoot.Text = aText;
                aView.Nodes.Add(aRoot);
                aRoot.Expand();
                aView.SelectedNode = aRoot;
            }
            finally
            {
                aView.EndUpdate();
            }
        }
Esempio n. 44
0
        public ExpansionTreeView(TreeView treeView, List<StrandNode> strandNodeList,
			uint dKrystalLevel, List<int> missingPointValues)
        {
            _treeView = treeView;
            _strandNodeList = strandNodeList;

            string missingPointValuesStr = "";
            if(missingPointValues.Count > 0)
                missingPointValuesStr = K.GetStringOfUnsignedInts(missingPointValues);
            #region constant krystal inputs
            if(dKrystalLevel == 0) // constant krystal inputs
            {
                int p = strandNodeList[0].strandPoint;
                int d = strandNodeList[0].strandDensity;
                strandNodeList[0].Text = "1: m1"
                    + ", p" + p.ToString()
                    + ", d" + d.ToString();
                _treeView.Nodes.Add(strandNodeList[0]);
            }
            #endregion constant krystal inputs
            else
                #region line krystal inputs
                if(dKrystalLevel == 1) // line krystal
                {
                    _treeView.BeginUpdate();
                    if(missingPointValues.Count > 0)
                        _treeView.Nodes.Add("Missing p value(s): " + missingPointValuesStr);
                    foreach(StrandNode strandNode in strandNodeList)
                    {
                        int m = strandNode.strandMoment;
                        int p = strandNode.strandPoint;
                        int d = strandNode.strandDensity;
                        strandNode.Text = m.ToString()
                            + ": m" + m.ToString()
                            + ", p" + p.ToString()
                            + ", d" + d.ToString();
                        _treeView.Nodes.Add(strandNode);
                    }
                    _treeView.EndUpdate();
                }
                #endregion line krystal inputs
                else
                #region higher level krystal inputs
                {
                    // Construct the levels of the tree above the strandNodeList, adding the StrandNodes where
                    // necessary. (The upper levels consist of pure TreeNodes and include the single root node.)
                    TreeNode[] currentNode = new TreeNode[dKrystalLevel];
                    int[] localSectionNumber = new int[dKrystalLevel];// does not include the local strand section numbers
                    int localStrandSectionNumber = 0;
                    foreach(StrandNode strandNode in strandNodeList)
                    {
                        if(strandNode.strandLevel <= dKrystalLevel)
                        {
                            localStrandSectionNumber = 0;
                            int levelIndex = strandNode.strandLevel - 1;
                            while(levelIndex < dKrystalLevel)
                            {
                                TreeNode tn = new TreeNode();
                                tn.Expand();
                                currentNode[levelIndex] = tn;
                                if(levelIndex > 0) // there is only one node at levelIndex == 0, and it has no text
                                {
                                    currentNode[levelIndex - 1].Nodes.Add(tn);
                                    localSectionNumber[levelIndex - 1]++;
                                    localSectionNumber[levelIndex] = 0;
                                    if(levelIndex == 1)
                                        tn.Text = localSectionNumber[levelIndex - 1].ToString();
                                    else
                                        tn.Text = tn.Parent.Text + "." + localSectionNumber[levelIndex - 1].ToString();
                                }
                                levelIndex++;
                            }
                        }
                        localStrandSectionNumber++;
                        currentNode[dKrystalLevel - 1].Nodes.Add(strandNode);
                        localSectionNumber[dKrystalLevel - 1]++;
                        int m = strandNode.strandMoment;
                        int p = strandNode.strandPoint;
                        int d = strandNode.strandDensity;
                        strandNode.Text = strandNode.Parent.Text
                            + "." + localStrandSectionNumber.ToString()
                            + ": m" + m.ToString()
                            + ", p" + p.ToString()
                            + ", d" + d.ToString();
                    }
                    // Now add the moment numbers to the pure TreeNode.Texts
                    foreach(StrandNode strandNode in strandNodeList)
                    {
                        if(strandNode.strandLevel <= dKrystalLevel)
                        {
                            TreeNode tn = strandNode.Parent;
                            bool continueUp = true;
                            while(continueUp)
                            {
                                if(tn.Text.EndsWith(".1") && tn.Level > 0)
                                    continueUp = true;
                                else continueUp = false;
                                int m = strandNode.strandMoment;
                                tn.Text = tn.Text + ": m" + m.ToString();
                                if(continueUp)
                                    tn = tn.Parent;
                            }
                        }
                    }
                    _treeView.BeginUpdate();
                    _treeView.Nodes.Clear();
                    if(missingPointValues.Count > 0)
                        _treeView.Nodes.Add("Missing p value(s): " + missingPointValuesStr);
                    foreach(TreeNode n in currentNode[0].Nodes)
                    {
                        _treeView.Nodes.Add(n);
                    }
                    _treeView.EndUpdate();
                }
                #endregion higher level krystal inputs
        }
        /// <summary>
        /// Fills specified tree with dynamically generated samples list.
        /// </summary>
        /// <param name="tree">Tree control to fill.</param>
        private void FillSamplesTree(TreeView tree)
        {
            // Loads sample XML data
            LoadInXMLData(applicationPath);

            // Fill samples tree
            tree.BeginUpdate();
            XmlNode rootNode = samplesContentXMLDoc["SampleContentList"];
            FillSampleListIntern(rootNode, tree.Nodes);
            tree.EndUpdate();

            // Prepare index list
            PrepareIndexInfoList();

            // Fill index list
            this.listBoxIndex.BeginUpdate();
            foreach(object obj in this.indexInfoList)
            {
                this.listBoxIndex.Items.Add(obj);
            }
            this.listBoxIndex.EndUpdate();
        }
        private void ReadTreeNode(TreeView xtreeView)
        {
            xtreeView.BeginUpdate();
            xtreeView.Nodes.Clear();
            TreeNode tn = new TreeNode();
            if (xtreeView.Nodes.Count == 0)
            {
                tn = new TreeNode("会员类别信息");
                tn.Name = Program.RootCode + Program.RootCode;
                tn.ImageIndex = 0;
                xtreeView.Nodes.Add(tn);
                xtreeView.SelectedNode = tn;
            }

            string sql = "";
            sql = "select * from MemberType where  Parent_='0000000000'";

            DataTable myDataTable1 = Program.SqlDataTable("MemberType", sql);

            foreach (DataRow myDataRow in myDataTable1.Rows)  //添加一级地址
            {
                TreeNode tnfirst = new TreeNode();
                tnfirst.Text = myDataRow["nam"].ToString();
                tnfirst.Name = myDataRow["Code"].ToString() + myDataRow["SysNo"].ToString();
                xtreeView.SelectedNode.Nodes.Add(tnfirst);

                if (Int32.Parse(myDataRow["SysNo"].ToString()) == 0)
                {
                    tnfirst.ImageIndex = 0;
                }
                else
                {
                    tnfirst.ImageIndex = 1;
                }
                GetTVAllNode(tnfirst, tnfirst.Name.Substring(0, 10));
            }
            xtreeView.ExpandAll();
            xtreeView.EndUpdate();
            //myDataAdapter.Dispose();
            //myDataSet.Dispose();
        }
Esempio n. 47
0
        public static void RebuildList( TreeView tree )
        {
            tree.BeginUpdate();
            UpdateNode( m_Root );

            tree.Nodes.Clear();
            tree.Nodes.Add( m_Root );
            m_Root.Expand();
            tree.EndUpdate();
        }
Esempio n. 48
0
        private static TreeNode LastSelectNode = null; //最后选中的节点

        #endregion Fields

        #region Methods

        /// <summary>
        /// 恢复TREEVIEW最后一次选中的节点状态 和展开的状态和图标
        /// </summary>
        /// <param name="treeView"></param>
        /// <param name="fileName"></param>
        public static bool LoadXml(TreeView treeView, string fileName)
        {
            bool working = true;

            XmlTextReader reader = null;
            try
            {
                treeView.Nodes.Clear();
                // disabling re-drawing of treeview till all nodes are added
                treeView.BeginUpdate();
                reader = new XmlTextReader(fileName);

                TreeNode parentNode = null;

                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (reader.Name == XmlNodeTag)
                        {
                            TreeNode newNode = new TreeNode();
                            bool isEmptyElement = reader.IsEmptyElement;

                            // loading node attributes
                            int attributeCount = reader.AttributeCount;
                            if (attributeCount > 0)
                            {
                                for (int i = 0; i < attributeCount; i++)
                                {
                                    reader.MoveToAttribute(i);
                                    SetAttributeValue(newNode, reader.Name, reader.Value);
                                    SetTreeViewState(treeView);
                                }
                            }

                            // add new node to Parent Node or TreeView
                            if (parentNode != null)
                                parentNode.Nodes.Add(newNode);
                            else
                                treeView.Nodes.Add(newNode);

                            // making current node 'ParentNode' if its not empty
                            if (!isEmptyElement)
                            {
                                parentNode = newNode;
                            }
                        }
                    }
                    // moving up to in TreeView if end tag is encountered
                    else if (reader.NodeType == XmlNodeType.EndElement)
                    {
                        if (reader.Name == XmlNodeTag)
                        {
                            parentNode = parentNode.Parent;
                        }
                    }
                    else if (reader.NodeType == XmlNodeType.XmlDeclaration)
                    { //Ignore Xml Declaration
                    }
                    else if (reader.NodeType == XmlNodeType.None)
                    {
                        working = false;
                    }
                    else if (reader.NodeType == XmlNodeType.Text)
                    {
                        parentNode.Nodes.Add(reader.Value);
                    }
                    working = false;
                }
                working = false;
            }
            finally
            {
                treeView.EndUpdate();
                reader.Close();
                working = false;
            }
            working = false;

            return working;
        }
Esempio n. 49
0
        /// <summary>
        /// 把XML文件读取到TREE中
        /// </summary>
        /// <param name="treeView"></param>
        /// <param name="fileName"></param>
        public static void LoadXmlFile(TreeView treeView, string fileName)
        {
            XmlTextReader reader = null;
            try
            {
                treeView.BeginUpdate();
                reader = new XmlTextReader(fileName);

                TreeNode n = new TreeNode(fileName);
                treeView.Nodes.Add(n);
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        bool isEmptyElement = reader.IsEmptyElement;
                        StringBuilder text = new StringBuilder();
                        text.Append(reader.Name);
                        int attributeCount = reader.AttributeCount;
                        if (attributeCount > 0)
                        {
                            text.Append(" ( ");
                            for (int i = 0; i < attributeCount; i++)
                            {
                                if (i != 0) text.Append(", ");
                                reader.MoveToAttribute(i);
                                text.Append(reader.Name);
                                text.Append(" = ");
                                text.Append(reader.Value);
                            }
                            text.Append(" ) ");
                        }

                        if (isEmptyElement)
                        {
                            n.Nodes.Add(text.ToString());
                        }
                        else
                        {
                            n = n.Nodes.Add(text.ToString());
                        }
                    }
                    else if (reader.NodeType == XmlNodeType.EndElement)
                    {
                        n = n.Parent;
                    }
                    else if (reader.NodeType == XmlNodeType.XmlDeclaration)
                    {

                    }
                    else if (reader.NodeType == XmlNodeType.None)
                    {
                        return;
                    }
                    else if (reader.NodeType == XmlNodeType.Text)
                    {
                        n.Nodes.Add(reader.Value);
                    }

                }
            }
            finally
            {
                treeView.EndUpdate();
                reader.Close();
            }
        }
Esempio n. 50
0
        public static void RenderToTreeControl(List<KPFormCustomization> listCustoms,
            TreeView tv)
        {
            tv.BeginUpdate();
            tv.Nodes.Clear();

            foreach(KPFormCustomization kpfc in listCustoms)
            {
                string strName = kpfc.FullName;
                int nLastDot = strName.LastIndexOf('.');
                if(nLastDot >= 0) strName = strName.Substring(nLastDot + 1);

                TreeNode tnForm = tv.Nodes.Add(strName);
                tnForm.Tag = kpfc;

                TreeNode tnWindow = tnForm.Nodes.Add("Window");
                tnWindow.Tag = kpfc.Window;

                foreach(KPControlCustomization kpcc in kpfc.Controls)
                {
                    TreeNode tnControl = tnForm.Nodes.Add(kpcc.Name);
                    tnControl.Tag = kpcc;
                }

                tnForm.ExpandAll();
            }

            tv.EndUpdate();
        }
Esempio n. 51
0
        /// <summary>
        /// Fills in the specified System.Windows.Forms.TreeView component with content representing the fuzzy relation
        /// </summary>
        /// <param name="treeView">Treeview component to display the relation's hierararchy</param>
        /// <param name="pictureBox">PictureBox component to display grapfs for particular nodes, where possible</param>
        /// <param name="label">Label to display caption for the picture</param>
        public void BuildTree( TreeView treeView, PictureBox pictureBox, Label label)
        {
            ImageList imageList = new ImageList();
            imageList.Images.Add("dimensions", Resources.Graph);
            imageList.Images.Add("function", Resources.Function);
            imageList.Images.Add("subrelations", Resources.Function);
            imageList.Images.Add("fuzzySet", Resources.Function);
            imageList.Images.Add("nodeFuzzyRelation", Resources.Function);
            imageList.Images.Add("dimensionType", Resources.Function);
            imageList.Images.Add("dimensionDiscreteKnown", Resources.Function);
            imageList.Images.Add("dimensionDiscreteUnknown", Resources.Function);
            imageList.Images.Add("dimensionContinuousKnown", Resources.Function);
            imageList.Images.Add("dimensionContinuousUnknown", Resources.Function);

            RelationImage img = new RelationImage(_relation, _inputs, _variableDimension);
            img.SupportOnly = true;

            Bitmap bmp = new Bitmap(300, 200);
            imageList.Images.Add(bmp);

            treeView.ImageList = imageList;
            pictureBox.BackColor = GraphBackgroundColor;
            pictureBox.Image = null;
            label.Text = "";

            treeView.BeginUpdate();
            treeView.Nodes.Clear();

            buildSubTree(_relation, treeView.Nodes, pictureBox, label);

            treeView.EndUpdate();
        }
Esempio n. 52
0
        /// <summary>
        /// Fills in the specified System.Windows.Forms.TreeView component with content representing the fuzzy relation
        /// </summary>
        /// <param name="treeView">Treeview component to display the relation's hierararchy</param>
        /// <param name="pictureBox">PictureBox component to display graphs for particular nodes, where possible. Null if graphs not required.</param>
        /// <param name="label">Label to display caption for the picture. Null if graphs not required.</param>
        public void BuildTree( TreeView treeView, PictureBox pictureBox, Label label)
        {
            _pictureBox = pictureBox;
            _label = label;

            ImageList imageList = new ImageList();
            imageList.Images.Add("dimensions", Resources.dimensions);
            imageList.Images.Add("function", Resources.Function1);
            imageList.Images.Add("subrelations", Resources.subrelations);
            imageList.Images.Add("fuzzySet", Resources.fuzzySet);
            imageList.Images.Add("nodeFuzzyRelation", Resources.nodeFuzzyRelation);
            imageList.Images.Add("dimensionType", Resources.dimensionType);
            imageList.Images.Add("dimensionDiscreteKnown", Resources.dimensionDiscrete);
            imageList.Images.Add("dimensionDiscreteUnknown", Resources.dimensionDiscreteUnknown);
            imageList.Images.Add("dimensionContinuousKnown", Resources.dimensionContinuous);
            imageList.Images.Add("dimensionContinuousUnknown", Resources.dimensionContinuousUnknown);
            imageList.Images.Add("defuzzification", Resources.defuzzification);
            imageList.Images.Add("defuzzificationOutput", Resources.defuzzificationOutput);
            imageList.Images.Add("spacer", Resources.spacer);

            treeView.ImageList = imageList;
            pictureBox.BackColor = GraphBackgroundColor;
            pictureBox.Image = null;
            label.Text = "";

            treeView.BeginUpdate();
            treeView.Nodes.Clear();

            if (_deffuzification == null)
            {
                buildSubTree(_relation, treeView.Nodes, pictureBox, label);
            }
            else
            {
                TreeNode deffuz = new TreeNode(_deffuzification.GetType().Name);
                deffuz.ImageKey = "defuzzification";
                deffuz.SelectedImageKey = "defuzzification";
                deffuz.Tag = _deffuzification;
                treeView.Nodes.Add(deffuz);
                TreeNode deffuzOutput = new TreeNode(
                    String.Format("{0}={1:F5} {2}",
                        _deffuzification.OutputDimension.Name,
                        _deffuzification.CrispValue,
                        _deffuzification.OutputDimension is IContinuousDimension ? ((IContinuousDimension)_deffuzification.OutputDimension).Unit : ""
                    )
                );
                deffuzOutput.ImageKey = "defuzzificationOutput";
                deffuzOutput.SelectedImageKey = "defuzzificationOutput";
                deffuz.Nodes.Add(deffuzOutput);
                buildSubTree(_relation, deffuz.Nodes, pictureBox, label);
            }

            treeView.EndUpdate();

            treeView.AfterSelect -= treeView_AfterSelect_EventHandler;
            if (_pictureBox != null && _label != null)
                treeView.AfterSelect += treeView_AfterSelect_EventHandler;
        }
Esempio n. 53
0
		public void SortedRecursive ()
		{
			TreeView tv = new TreeView ();
			tv.TreeViewNodeSorter = new InverseNodeSorter ();
			tv.BeginUpdate ();
			TreeNode root_node = tv.Nodes.Add ("Root");
			for (char c = 'a'; c <= 'f'; c++) {
				TreeNode node = new TreeNode (c.ToString ());
				for (int i = 0; i < 3; i++)
					node.Nodes.Add (i.ToString ());

				root_node.Nodes.Add (node);
			}
			tv.EndUpdate ();

			// Make sure we are sorted
			tv.Sort ();

			Assert.AreEqual ("f", root_node.Nodes [0].Text, "#A1");
			Assert.AreEqual ("e", root_node.Nodes [1].Text, "#A2");
			Assert.AreEqual ("d", root_node.Nodes [2].Text, "#A3");
			Assert.AreEqual ("c", root_node.Nodes [3].Text, "#A4");
			Assert.AreEqual ("b", root_node.Nodes [4].Text, "#A5");
			Assert.AreEqual ("a", root_node.Nodes [5].Text, "#A5");

			foreach (TreeNode n in root_node.Nodes) {
				Assert.AreEqual ("2", n.Nodes [0].Text, "#B1");
				Assert.AreEqual ("1", n.Nodes [1].Text, "#B2");
				Assert.AreEqual ("0", n.Nodes [2].Text, "#B3");
			}
		}
Esempio n. 54
0
		public void SortBeginUpdate ()
		{
			TreeView tv = new TreeView ();
			tv.Sorted = true;
			tv.BeginUpdate ();
			tv.Nodes.Add ("x");
			tv.Nodes.Add ("f");
			tv.Nodes.Add ("a");

			// Even if BeginUpdate was called, Sort is called.
			Assert.AreEqual ("a", tv.Nodes [0].Text, "#A1");
			Assert.AreEqual ("f", tv.Nodes [1].Text, "#A2");
			Assert.AreEqual ("x", tv.Nodes [2].Text, "#A3");
		}
Esempio n. 55
0
        /// <summary>
        /// Sets the bold state of the given node.
        /// </summary>
        /// <param name="item">
        /// The node to set.
        /// </param>
        /// <param name="bolded">
        /// Indicates whether the item should be bolded.
        /// </param>
        /// <param name="tree">
        /// The tree that contains the item.
        /// </param>
        private static void SetBoldState(TreeNode item, bool bolded, TreeView tree)
        {
            Param.AssertNotNull(item, "item");
            Param.Ignore(bolded);
            Param.AssertNotNull(tree, "tree");

            if (bolded)
            {
                if (item.NodeFont == null)
                {
                    // Make the item bold.
                    item.NodeFont = new Font(tree.Font, FontStyle.Bold);
                }
                else if (!item.NodeFont.Bold)
                {
                    // Make the item bold.
                    item.NodeFont = new Font(item.NodeFont, FontStyle.Bold);
                }
            }
            else
            {
                if (item.NodeFont != null && item.NodeFont.Bold)
                {
                    // Make the item not bold.
                    item.NodeFont = new Font(item.NodeFont, FontStyle.Regular);
                }
            }

            // This forces the tree to redraw the bolded nodes.
            tree.BeginUpdate();
            tree.EndUpdate();
        }
Esempio n. 56
0
        /// <summary>
        /// ermittelt alle Empfänger und stellt diese dar
        /// </summary>
        /// <param name="pin_TreeNode"></param>
        /// <param name="pin_IDMenge"></param>
        public void LadeMitteilungsEmpfaenger(TreeView pin_TreeView,  int[] pin_EmpfaengerIDMenge)
        {
            #region Holen der Empfänger
            String[] einheitenMenge;
            String[] helfermenge;
            String[] kfzMenge;
            // Holen der Empfänger, speichern in die String-Arrays
            _st_ToDo.HoleEmpfaenger(pin_EmpfaengerIDMenge, out einheitenMenge, out helfermenge, out kfzMenge);
            #endregion

            #region Darstellen in EmpfängerTreeview
            // Anpassen Treeview beginnen
            pin_TreeView.BeginUpdate();

            pin_TreeView.Nodes.Clear();
            // alle mögliche Kräftetypen
            string[] str_typmenge = new string[3];
            str_typmenge[0] = "Einheiten";
            str_typmenge[1] = "Helfer";
            str_typmenge[2] = "Kfz";
            // Laufindex
            int i_lauf = 0;

            // Knoten auf der obersten Hierachieebene erstellen
            for(int i=0; i < str_typmenge.Length; i++)
            {
                pin_TreeView.Nodes.Add(str_typmenge[i]);
            }
            // Knoten unter dem Oberknoten "Einheit"
            foreach(String s in einheitenMenge)
            {
                TreeNode neuerKnoten = new TreeNode(s);
                pin_TreeView.Nodes[0].Nodes.Add(neuerKnoten);
                pin_TreeView.Nodes[0].Nodes[i_lauf].Checked = true;
                i_lauf++;
            }
            i_lauf = 0;
            // Knoten unter dem Oberknoten "Helfer"
            foreach(String s in helfermenge)
            {
                TreeNode neuerKnoten = new TreeNode(s);
                pin_TreeView.Nodes[1].Nodes.Add(neuerKnoten);
                pin_TreeView.Nodes[1].Nodes[i_lauf].Checked = true;
                i_lauf++;
            }
            i_lauf = 0;
            // Knoten unter dem Oberknoten "Kfz"
            foreach(String s in kfzMenge)
            {
                TreeNode neuerKnoten = new TreeNode(s);
                pin_TreeView.Nodes[2].Nodes.Add(neuerKnoten);
                pin_TreeView.Nodes[2].Nodes[i_lauf].Checked = true;
                i_lauf++;
            }

            // Anpassen Treeview beenden
            pin_TreeView.ExpandAll();
            pin_TreeView.EndUpdate();
            #endregion
        }
Esempio n. 57
0
        static void BuildAPITree(TreeView Tree, XmlDocument API)
        {
            try
            {
                Tree.BeginUpdate();
                Tree.Nodes.Clear();
                //Build class
                foreach (XmlNode Class in API.SelectNodes("api")[0].SelectNodes("class"))
                {
                    TreeNode ClassNode = new TreeNode();
                    string ClassName = Class.SelectNodes("name")[0].InnerText;
                    ClassNode.Name = ClassName;
                    ClassNode.Text = ClassName;
                    ClassNode.ForeColor = Color.Green;
                    string ClassType = Class.SelectNodes("type")[0].InnerText;
                    ClassNode.ToolTipText = Class.SelectNodes("description")[0].InnerText;

                    TreeNode ConstructorsNode = new TreeNode();
                    ConstructorsNode.Name = "Constructors";
                    ConstructorsNode.Text = "Constructors";
                    ConstructorsNode.ForeColor = Color.Brown;

                    TreeNode PropertiesNode = new TreeNode();
                    PropertiesNode.Name = "Properties";
                    PropertiesNode.Text = "Properties";
                    PropertiesNode.ForeColor = Color.DarkBlue;

                    TreeNode MethodsNode = new TreeNode();
                    MethodsNode.Name = "Methods";
                    MethodsNode.Text = "Methods";
                    MethodsNode.ForeColor = Color.IndianRed;

                    TreeNode MembersNode = new TreeNode();
                    MembersNode.Name = "Members";
                    MembersNode.Text = "Members";

                    if (ClassType.Equals("Non-Static"))
                    {
                        ClassNode.Nodes.Add(ConstructorsNode);
                    }
                    if (ClassType.Equals("Non-Static") || ClassType.Equals("Static"))
                    {
                        ClassNode.Nodes.Add(PropertiesNode);
                        ClassNode.Nodes.Add(MethodsNode);
                    }
                    if (ClassType.Equals("Enum"))
                    {
                        ClassNode.Nodes.Add(MembersNode);
                    }
                    //Build constructors
                    try
                    {
                        foreach (XmlNode Constructor in Class.SelectNodes("constructors")[0].SelectNodes("constructor"))
                        {
                            TreeNode ConstructorNode = new TreeNode();
                            string ConstructorName = Constructor.SelectNodes("name")[0].InnerText;
                            ConstructorNode.Name = "constructors-" + ConstructorName;
                            ConstructorNode.Text = ConstructorName;
                            ConstructorNode.ForeColor = Color.Brown;
                            ConstructorNode.ToolTipText = Constructor.SelectNodes("description")[0].InnerText;
                            ConstructorsNode.Nodes.Add(ConstructorNode);
                        }
                    }
                    catch
                    {

                    }
                    //Build properties
                    try
                    {
                        foreach (XmlNode Property in Class.SelectNodes("properties")[0].SelectNodes("property"))
                        {
                            TreeNode PropertyNode = new TreeNode();
                            string PropertyName = Property.SelectNodes("name")[0].InnerText + " : " + Property.SelectNodes("datatype")[0].InnerText;
                            PropertyNode.Name = "properties-" + PropertyName;
                            PropertyNode.Text = PropertyName;
                            PropertyNode.ForeColor = Color.DarkBlue;
                            PropertyNode.ToolTipText = Property.SelectNodes("description")[0].InnerText;
                            PropertiesNode.Nodes.Add(PropertyNode);
                        }
                    }
                    catch
                    {

                    }
                    //Build methods
                    try
                    {
                        foreach (XmlNode Method in Class.SelectNodes("methods")[0].SelectNodes("method"))
                        {
                            TreeNode MethodNode = new TreeNode();
                            string MethodName = Method.SelectNodes("name")[0].InnerText + " : " + Method.SelectNodes("return")[0].InnerText;
                            MethodNode.Name = "methods-" + MethodName;
                            MethodNode.Text = MethodName;
                            MethodNode.ForeColor = Color.IndianRed;
                            MethodNode.ToolTipText = Method.SelectNodes("description")[0].InnerText;
                            MethodsNode.Nodes.Add(MethodNode);
                        }
                    }
                    catch
                    {

                    }
                    //Build members
                    try
                    {
                        foreach (XmlNode Member in Class.SelectNodes("members")[0].SelectNodes("member"))
                        {
                            TreeNode MemberNode = new TreeNode();
                            string MemberName = Member.SelectNodes("name")[0].InnerText;
                            MemberNode.Name = "members-" + MemberName;
                            MemberNode.Text = MemberName;
                            MemberNode.ForeColor = Color.IndianRed;
                            MemberNode.ToolTipText = Member.SelectNodes("description")[0].InnerText;
                            MembersNode.Nodes.Add(MemberNode);
                        }
                    }
                    catch
                    {

                    }
                    Tree.Nodes.Add(ClassNode);
                    Tree.EndUpdate();
                }
            }
            catch(Exception Exp)
            {
                Tree.EndUpdate();
                throw Exp;
            }
        }
Esempio n. 58
0
        public bool ProcessTorrentFile(string torrentFile, TreeView tvTree, CommandLineArgs args)
        {
            // ----------------------------------------
            // read in torrent file

            if (tvTree != null)
                tvTree.Nodes.Clear();

            BEncodeLoader bel = new BEncodeLoader();
            BTFile btFile = bel.Load(torrentFile);

            if (btFile == null)
                return false;

            BTItem bti = btFile.GetItem("info");
            if ((bti == null) || (bti.Type != BTChunk.kDictionary))
                return false;

            BTDictionary infoDict = (BTDictionary) (bti);

            bti = infoDict.GetItem("piece length");
            if ((bti == null) || (bti.Type != BTChunk.kInteger))
                return false;

            Int64 pieceSize = ((BTInteger) bti).Value;

            bti = infoDict.GetItem("pieces");
            if ((bti == null) || (bti.Type != BTChunk.kString))
                return false;

            BTString torrentPieces = (BTString) (bti);

            bti = infoDict.GetItem("files");

            if (bti == null) // single file torrent
            {
                bti = infoDict.GetItem("name");
                if ((bti == null) || (bti.Type != BTChunk.kString))
                    return false;

                BTString di = (BTString) (bti);
                string nameInTorrent = di.AsString();

                BTItem fileSizeI = infoDict.GetItem("length");
                Int64 fileSize = ((BTInteger) fileSizeI).Value;

                this.NewTorrentEntry(torrentFile, -1);
                if (this.DoHashChecking)
                {
                    byte[] torrentPieceHash = torrentPieces.StringTwentyBytePiece(0);

                    FileInfo fi = this.FindLocalFileWithHashAt(torrentPieceHash, 0, pieceSize, fileSize);
                    if (fi != null)
                        this.FoundFileOnDiskForFileInTorrent(torrentFile, fi, -1, nameInTorrent);
                    else
                        this.DidNotFindFileOnDiskForFileInTorrent(torrentFile, -1, nameInTorrent);
                }
                this.FinishedTorrentEntry(torrentFile, -1, nameInTorrent);

                // don't worry about updating overallPosition as this is the only file in the torrent
            }
            else
            {
                Int64 overallPosition = 0;
                Int64 lastPieceLeftover = 0;

                if (bti.Type != BTChunk.kList)
                    return false;

                BTList fileList = (BTList) (bti);

                // list of dictionaries
                for (int i = 0; i < fileList.Items.Count; i++)
                {
                    this.Prog(100 * i / fileList.Items.Count);
                    if (fileList.Items[i].Type != BTChunk.kDictionary)
                        return false;

                    BTDictionary file = (BTDictionary) (fileList.Items[i]);
                    BTItem thePath = file.GetItem("path");
                    if (thePath.Type != BTChunk.kList)
                        return false;
                    BTList pathList = (BTList) (thePath);
                    // want the last of the items in the list, which is the filename itself
                    int n = pathList.Items.Count - 1;
                    if (n < 0)
                        return false;
                    BTString fileName = (BTString) (pathList.Items[n]);

                    BTItem fileSizeI = file.GetItem("length");
                    Int64 fileSize = ((BTInteger) fileSizeI).Value;

                    int pieceNum = (int) (overallPosition / pieceSize);
                    if (overallPosition % pieceSize != 0)
                        pieceNum++;

                    this.NewTorrentEntry(torrentFile, i);

                    if (this.DoHashChecking)
                    {
                        byte[] torrentPieceHash = torrentPieces.StringTwentyBytePiece(pieceNum);

                        FileInfo fi = this.FindLocalFileWithHashAt(torrentPieceHash, lastPieceLeftover, pieceSize, fileSize);
                        if (fi != null)
                            this.FoundFileOnDiskForFileInTorrent(torrentFile, fi, i, fileName.AsString());
                        else
                            this.DidNotFindFileOnDiskForFileInTorrent(torrentFile, i, fileName.AsString());
                    }

                    this.FinishedTorrentEntry(torrentFile, i, fileName.AsString());

                    int sizeInPieces = (int) (fileSize / pieceSize);
                    if (fileSize % pieceSize != 0)
                        sizeInPieces++; // another partial piece

                    lastPieceLeftover = (lastPieceLeftover + (Int32) ((sizeInPieces * pieceSize) - fileSize)) % pieceSize;
                    overallPosition += fileSize;
                } // for each file in the torrent
            }

            if (tvTree != null)
            {
                tvTree.BeginUpdate();
                btFile.Tree(tvTree.Nodes);
                tvTree.ExpandAll();
                tvTree.EndUpdate();
                tvTree.Update();
            }

            this.Prog(0);

            return true;
        }
Esempio n. 59
0
 private void updateTreeView(string xml, TreeView treeView)
 {
     treeView.BeginUpdate();
     try
     {
         treeView.Nodes.Clear();
         XmlDocument tmpxmldoc = new XmlDocument();
         tmpxmldoc.LoadXml(xml);
         FillTree(tmpxmldoc.DocumentElement, treeView.Nodes);
         treeView.ExpandAll();
     }
     catch (Exception ex)
     {
         Logger.Log("Error during XML conversion", Helpers.LogLevel.Error, ex);
     }
     finally
     {
         treeView.EndUpdate();
     }
 }
Esempio n. 60
0
        public void Import(TextBox dataCardTextBox, string initializeString, TreeView treeView)
        {
            if (IsValid(dataCardTextBox, "Datacard"))
            {
                CurrentState = State.StateImporting;
                treeView.BeginUpdate();

                ImportDataCard(dataCardTextBox.Text, initializeString, treeView);

                treeView.EndUpdate();
            }   
        }