Beispiel #1
0
        public void FromBatch(NBatchInfoGroup group)
        {
            if (((group != null) && (group.Batchs != null)) && (group.Batchs.Count > 0))
            {
                NBatchInfo       batchInfo = group.Batchs[0];
                RadTreeNode      batchNode = CreateBatchNode(batchInfo);
                List <NFileInfo> fileInfos = batchInfo.FileInfos;

                //fileInfos.ForEach(x => x.FileName = x.FileNO);
                //HashSet<String> categorys = new HashSet<string>();

                foreach (NFileInfo fileInfo in fileInfos)
                {
                    string category = fileInfo.Category;
                    if (String.IsNullOrEmpty(category)) //没有分类的文件
                    {
                        CreateFileNodeFromServer(batchNode, fileInfo, batchInfo);
                    }
                    else
                    {
                        String      path         = batchNode.Text + "." + category;
                        RadTreeNode categoryNode = navigateTree.GetNodeByPath(path, ".");
                        if (categoryNode == null)
                        {
                            categoryNode = navigateTree.AddNodeByPath(path, ".");
                            UpdateCategoryNode(categoryNode);
                            categoryNode.Parent.Nodes.Move(categoryNode.Index, 0);  //将分类节点移到父节点最前面的位置
                        }
                        CreateFileNodeFromServer(categoryNode, fileInfo, batchInfo);
                    }
                }
                batchNode.ExpandAll();
                UpdateBatchNodeTitle(batchNode);
            }
        }
        public void LoadTreeView()
        {
            //数据库读取初始化视图
            RadTreeNode hardWardRoot = treeView.AddNodeByPath("产品");
            //hardWardRoot.Nodes.Add(TreeViewData.HardWare.COMMENT);
            RadTreeNode nodeProductA = hardWardRoot.Nodes.Add("产品A");

            nodeProductA.Nodes.Add("内壳");
            nodeProductA.Nodes.Add("外壳");
            nodeProductA.Nodes.Add("螺丝");
            nodeProductA.Nodes.Add("外箱");

            RadTreeNode nodeProductB = hardWardRoot.Nodes.Add("产品B");

            nodeProductB.Nodes.Add("内壳");
            nodeProductB.Nodes.Add("外壳");
            nodeProductB.Nodes.Add("螺丝");
            nodeProductB.Nodes.Add("外箱");
        }
        /// <summary>
        /// 初始化treeview
        /// </summary>
        public void InitTreeView()
        {
            #region hardWard tree
            RadTreeNode hardWardRoot = radTreeView.AddNodeByPath(TreeViewData.HardWare.ROOT);
            //hardWardRoot.Nodes.Add(TreeViewData.HardWare.COMMENT);
            RadTreeNode nodeCanChannel = hardWardRoot.Nodes.Add(TreeViewData.HardWare.CAN_CHANNELS);
            hardWardRoot.Nodes.Add(TreeViewData.HardWare.LIN_CHANNELS);
            //hardWardRoot.Nodes.Add(TreeViewData.HardWare.FLEXRAY_CHANNELS);
            //hardWardRoot.Nodes.Add(TreeViewData.HardWare.MOST150_CHANNELS);
            //hardWardRoot.Nodes.Add(TreeViewData.HardWare.ANALOG_INPUTS);
            //hardWardRoot.Nodes.Add(TreeViewData.HardWare.DIGITAL_INPUTS);
            //hardWardRoot.Nodes.Add(TreeViewData.HardWare.CAN_GPS);
            //hardWardRoot.Nodes.Add(TreeViewData.HardWare.MONITORING);
            //hardWardRoot.Nodes.Add(TreeViewData.HardWare.WLAN_3G);

            RadTreeNode nodeCan1 = nodeCanChannel.Nodes.Add(TreeViewData.HardWare.CAN_CHILD + 1);
            nodeCan1.Nodes.Add(TreeViewData.HardWare.CAN_HARDWARE_CONFIG);
            nodeCan1.Nodes.Add(TreeViewData.HardWare.CAN_1_DATA);
            RadTreeNode nodeCan2 = nodeCanChannel.Nodes.Add(TreeViewData.HardWare.CAN_CHILD + 2);
            nodeCan2.Nodes.Add(TreeViewData.HardWare.CAN_HARDWARE_CONFIG);
            nodeCan2.Nodes.Add(TreeViewData.HardWare.CAN_2_DATA);
            #endregion

            #region hardWard tree
            RadTreeNode generalRoot = radTreeView.AddNodeByPath(TreeViewData.General.ROOT);
            generalRoot.Nodes.Add(TreeViewData.General.DATABASE);
            generalRoot.Nodes.Add(TreeViewData.General.SPECIAL_FEATURES);
            generalRoot.Nodes.Add(TreeViewData.General.INCLUDE_FILES);
            #endregion

            #region LoggingMemory1
            RadTreeNode loggingMemory = radTreeView.AddNodeByPath(TreeViewData.LoggingMemory1.ROOT);
            loggingMemory.Nodes.Add(TreeViewData.LoggingMemory1.TRIGGERS);
            loggingMemory.Nodes.Add(TreeViewData.LoggingMemory1.FILTERS);
            #endregion

            #region LoggingMemory2
            RadTreeNode loggingMemory2 = radTreeView.AddNodeByPath(TreeViewData.LoggingMemory2.ROOT);
            loggingMemory2.Nodes.Add(TreeViewData.LoggingMemory2.TRIGGERS);
            loggingMemory2.Nodes.Add(TreeViewData.LoggingMemory2.FILTERS);
            #endregion

            #region XCP/CCP
            RadTreeNode xcpccp = radTreeView.AddNodeByPath(TreeViewData.CcpOrXcp.ROOT);
            xcpccp.Nodes.Add(TreeViewData.CcpOrXcp.DESCRIPTIONS);
            xcpccp.Nodes.Add(TreeViewData.CcpOrXcp.SIGNAL_REQUESTS);
            #endregion

            #region diagnotics
            RadTreeNode diagnotics = radTreeView.AddNodeByPath(TreeViewData.Diagnostics.ROOT);
            diagnotics.Nodes.Add(TreeViewData.Diagnostics.DIAGNOSTIC_DESCRIPTIONS);
            diagnotics.Nodes.Add(TreeViewData.Diagnostics.REQUESTS);
            #endregion

            #region output
            RadTreeNode output = radTreeView.AddNodeByPath(TreeViewData.Output.ROOT);
            output.Nodes.Add(TreeViewData.Output.LEDS);
            output.Nodes.Add(TreeViewData.Output.TRANSMIT_MESSAGE);
            output.Nodes.Add(TreeViewData.Output.SET_IGITAL_OUTPUT);
            #endregion

            #region filemanager
            RadTreeNode fileManager  = radTreeView.AddNodeByPath(TreeViewData.FileManager1.ROOT);
            RadTreeNode loggerDevice = fileManager.Nodes.Add(TreeViewData.FileManager1.LOGGER_DEVICE);
            RadTreeNode cardReader   = fileManager.Nodes.Add(TreeViewData.FileManager1.CARD_READER);

            loggerDevice.Nodes.Add(TreeViewData.FileManager1.DEVICE_INFORMATION);
            loggerDevice.Nodes.Add(TreeViewData.FileManager1.CLASSIC_VIEW);
            loggerDevice.Nodes.Add(TreeViewData.FileManager1.NAVIGATOR_VIEW);

            cardReader.Nodes.Add(TreeViewData.FileManager1.CLASSIC_VIEW);
            cardReader.Nodes.Add(TreeViewData.FileManager1.NAVIGATOR_VIEW);
            #endregion

            this.radTreeView.ExpandAll();
        }