Exemplo n.º 1
0
        /// <summary>
        /// 添加孩子节点;
        /// </summary>
        /// <param name="obj">孩子节点</param>
        public override void Add(ObjNode obj)
        {
            int index = SubObj_Lsit.IndexOf(obj);

            if (index < 0)
            {
                SubObj_Lsit.Add(obj);
                Console.WriteLine("222" + obj.ObjName);
            }
            else
            {
                Console.WriteLine("添加重复节点;");
            }
            //SubObj_Lsit.Add(obj);
        }
Exemplo n.º 2
0
 private void IsRepeatNode(ObjNode iter, List <ObjNode> listIter)
 {
     foreach (ObjNode iterListSub in listIter)
     {
         if (iter.ObjName == iterListSub.ObjName)
         {
             bIsRepeat = true;
         }
         else
         {
             if (iterListSub.SubObj_Lsit != null)
             {
                 IsRepeatNode(iter, iterListSub.SubObj_Lsit);
             }
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 点击枝节点时;
        /// 1、在右侧列表中更新叶子节点;
        /// 2、触发SNMP的GetNext查询;
        /// </summary>
        /// <param name="sender">对应的容器</param>
        /// <param name="e"></param>
        public override void ClickObjNode(object sender, EventArgs e)
        {
            Console.WriteLine("TreeNode Clicked!");

            MetroExpander items = sender as MetroExpander;

            // 清理掉之前填入的Children节点;
            items.SubExpender.Children.Clear();

            // 将叶子节点加入右侧容器;
            if ((items.obj_type as ObjNode).SubObj_Lsit != null)
            {
                foreach (var iter in (items.obj_type as ObjNode).SubObj_Lsit)
                {
                    // 子节点如果是枝节点跳过;
                    if (iter is ObjTreeNode)
                    {
                        continue;
                    }

                    // 初始化对应的内容,并加入到容器中;
                    MetroExpander subitems = new MetroExpander();
                    subitems.Header   = iter.ObjName;
                    subitems.Click   += iter.ClickObjNode;
                    subitems.obj_type = iter;
                    items.SubExpender.Children.Add(subitems);
                }
                // 该节点有对应的表可查;
                if (this.ObjTableName != @"/")
                {
                }
            }
            else
            {
                MetroExpander item = sender as MetroExpander;
                ObjNode       node = item.obj_type as ObjNode;

                Console.WriteLine("LeafNode Clicked!" + node.ObjName);
            }
        }
Exemplo n.º 4
0
 abstract public void Add(ObjNode obj);                         // 增加孩子节点;
 abstract public void Remove(ObjNode obj);                      // 删除孩子节点;
Exemplo n.º 5
0
        }                                                              // 对应的界面表格;

        abstract public void Add(ObjNode obj);                         // 增加孩子节点;
Exemplo n.º 6
0
 public override void Remove(ObjNode obj)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
        /// <summary>
        /// 当点击叶子节点时,会触发GetNext操作;
        /// 注意:基站GetNext不支持全节点查询,最大粒度为Get命令当中的节点数量;
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void ClickObjNode(object sender, EventArgs e)
        {
            MetroExpander               item       = sender as MetroExpander;
            ObjNode                     node       = item.obj_type as ObjNode;
            IReDataByTableEnglishName   ret        = new ReDataByTableEnglishName();
            Dictionary <string, string> GetNextRet = new Dictionary <string, string>();
            int IndexNum = 0;

            contentlist.Clear();
            GetNextResList.Clear();
            ObjParentOID = String.Empty;

            // 目前可以获取到节点对应的中文名以及对应的表名;
            Console.WriteLine("LeafNode Clicked!" + node.ObjName + "and TableName " + this.ObjTableName);

            //根据表名获取该表内所有MIB节点;
            nodeb.db.getDataByTableEnglishName(this.ObjTableName, out ret, nodeb.m_IPAddress.ToString());

            List <string> oidlist = new List <string>();             // 填写SNMP模块需要的OIDList;

            name_cn.Clear(); oid_cn.Clear(); oid_en.Clear();         // 每个节点都有自己的表数据结构;
            try
            {
                int.TryParse(ret.indexNum, out IndexNum);              // 获取这张表索引的个数;
                IndexCount   = int.Parse(ret.indexNum);
                LastColumn   = 0;                                      // 初始化判断整表是否读完的判断字段;
                ChildCount   = ret.childrenList.Count - IndexNum;
                ObjParentOID = ret.oid;                                // 将父节点OID赋值;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }



            // 遍历所有子节点,组SNMP的GetNext命令的一行OID集合;
            foreach (var iter in ret.childrenList)
            {
                oidlist.Clear();
                // 索引不参与查询,将所有其他孩子节点进行GetNext查询操作;
                if (int.Parse(iter.childNo) > IndexNum)
                {
                    // 如果不是真MIB,不参与查询;
                    if (iter.isMib != "1")
                    {
                        ChildCount--;
                        continue;
                    }

                    string temp = prev_oid + iter.childOid;
                    name_cn.Add(prev_oid + iter.childNameMib, iter.childNameCh);
                    oid_en.Add(prev_oid + iter.childOid, iter.childNameMib);
                    oid_cn.Add(prev_oid + iter.childOid, iter.childNameCh);
                    oidlist.Add(temp);

                    // 通过GetNext查询单个节点数据;
                    SnmpMessageV2c msg = new SnmpMessageV2c("public", nodeb.m_IPAddress.ToString());
                    msg.GetNextRequestWhenStop(new AsyncCallback(ReceiveResBySingleNode), new AsyncCallback(NotifyMainUpdateDataGrid), oidlist);
                }
                else
                {
                }

                // 如果是单个节点遍历,就只能在此处组DataGrid的VM类;
            }

            // 通过GetNext获取整表数据,后来发现基站不支持,如果基站支持后,在此处GetNext即可;
            //SnmpMessageV2c msg = new SnmpMessageV2c("public", nodeb.m_IPAddress.ToString());
            //msg.GetNextRequest(new AsyncCallback(ReceiveRes), oidlist);
        }
Exemplo n.º 8
0
 /// <summary>
 /// 删除孩子节点;
 /// </summary>
 /// <param name="obj">孩子节点</param>
 public override void Remove(ObjNode obj)
 {
     SubObj_Lsit.Remove(obj);
 }