Ejemplo n.º 1
0
            /// <summary>
            /// 用户结点
            /// </summary>
            public static CTreeNode BuildUserNode(object obj)
            {
                var node = new CTreeNode("登录用户", CTreeType.UserLogin);

                node.SetImageIndex(8);
                return(node);
            }
Ejemplo n.º 2
0
            /// <summary>
            /// 遥测站结点
            /// </summary>
            /// <returns></returns>
            public static CTreeNode BuildRemoteStationNode(object obj)
            {
                var node = new CTreeNode("遥测站管理", CTreeType.CeZhan1);

                node.SetImageIndex(10);
                return(node);
            }
Ejemplo n.º 3
0
            /// <summary>
            /// 系统设置结点
            /// </summary>
            public static CTreeNode BuildSysNode(object obj)
            {
                var node = new CTreeNode("系统管理", CTreeType.SystemSetting);

                node.SetImageIndex(0);
                return(node);
            }
Ejemplo n.º 4
0
            /// <summary>
            /// 用户结点
            /// </summary>
            public static CTreeNode BuildUserManageNode(object obj)
            {
                var node = new CTreeNode("用户管理", CTreeType.UserSetting);

                node.SetImageIndex(8);
                return(node);
            }
Ejemplo n.º 5
0
 /// <summary>
 /// 分中心结点
 /// </summary>
 /// <param name="subcenter"></param>
 /// <returns></returns>
 public static CTreeNode BuildSubCenterNode(object obj)
 {
     var subcenter = obj as CEntitySubCenter;
     var node = new CTreeNode(subcenter.SubCenterName, CTreeType.CeZhan2, subcenter.SubCenterID.ToString());
     node.SetImageIndex(12);
     return node;
 }
Ejemplo n.º 6
0
            /// <summary>
            /// 串口信息结点
            /// </summary>
            public static CTreeNode BuildPortNode(object obj)
            {
                var node = new CTreeNode("串口配置", CTreeType.CommunicationPort);

                node.SetImageIndex(2);
                //var ports = CDBDataMgr.Instance.GetAllSerialPort();
                //foreach (var port in ports)
                //{
                //    string msg = String.Format("COM{0} [{1}]", port.PortNumber, CEnumHelper.SerialTransTypeToUIStr(port.TransType));
                //    var portLevel2 = new CTreeNode(msg, CTreeType.PortSettings2);
                //    //  设置小图标

                //    //  添加二级菜单
                //    node.Nodes.Add(portLevel2);
                //}
                var coms = XmlDocManager.Instance.GetAllComPorts();

                var sysComs  = new List <string>(SerialPort.GetPortNames());
                var comsInDB = CDBDataMgr.Instance.GetAllSerialPortName();

                foreach (var com in coms)
                {
                    var dllInfo = XmlDocManager.Instance.GetChannelDllByComOrPort(com, true);
                    if (dllInfo == null)
                    {
                        continue;
                    }
                    string comName = "COM" + com;
                    if (!sysComs.Contains(comName))
                    {
                        continue;
                    }
                    if (!comsInDB.Contains(comName))
                    {
                        continue;
                    }
                    string msg        = String.Format("COM{0} [{1}]", com, dllInfo.Name);
                    var    portLevel2 = new CTreeNode(msg, CTreeType.CommunicationPort2);
                    //  设置小图标

                    //  添加二级菜单
                    node.Nodes.Add(portLevel2);
                }

                return(node);
            }
Ejemplo n.º 7
0
            /// <summary>
            /// 数据协议结点
            /// </summary>
            public static CTreeNode BuildDataNode(object obj)
            {
                var node = new CTreeNode("数据协议", CTreeType.DataProtocolCfg);
                node.SetImageIndex(4);

                var m_dllCollections = Protocol.Manager.XmlDocManager.Deserialize();
                foreach (var item in m_dllCollections.Infos)
                {
                    if (item.Type == "data" && item.Enabled)
                    {
                        var level2 = new CTreeNode(item.Name, CTreeType.DataProtocolCfg2);

                        node.Nodes.Add(level2);
                    }
                }
                return node;
            }
Ejemplo n.º 8
0
            /// <summary>
            /// 信道协议结点
            /// </summary>
            public static CTreeNode BuildChannelNode(object obj)
            {
                delnode();
                //  添加信道协议
                var node = new CTreeNode("通讯方式", CTreeType.ChannelProtocolCfg);
                node.SetImageIndex(6);

                var m_dllCollections = Protocol.Manager.XmlDocManager.Deserialize();
                foreach (var item in m_dllCollections.Infos)
                {
                    if (item.Type == "channel" && item.Enabled)
                    {
                        var level2 = new CTreeNode(item.Name, CTreeType.ChannelProtocolCfg2);

                        node.Nodes.Add(level2);
                    }
                }
               
                return node;
            }
Ejemplo n.º 9
0
            /// <summary>
            /// 监测站点结点
            /// </summary>
            /// <param name="station"></param>
            /// <returns></returns>
            //public static CTreeNode BuildStationNode(object obj)
            //{
            //    var station = obj as CEntityStation;
            //    string text = string.Format("{0} ({1})", station.StationName, station.StationID);
            //    var node = new CTreeNode(text, CTreeType.CeZhan3, station.StationID);
            //    //node.SetImageIndex(14);
            //    if(station.StationType == EStationType.ERainFall)
            //    {
            //        node.SetImageIndex(18);
            //    }else if (station.StationType == EStationType.ERiverWater)
            //    {
            //        node.SetImageIndex(20);
            //    }else if (station.StationType == EStationType.EHydrology)
            //    {
            //        node.SetImageIndex(22);
            //    }

            //    return node;
            //}
            
            public static CTreeNode BuildStationNode(object obj)
            {
                //  if (obj.ToString() == "Hydrology.Entity.CEntityStation")
                if (obj is CEntityStation)
                {
                    var station = obj as CEntityStation;

                    string text = string.Format("{0} ({1})", station.StationName, station.StationID);
                    var node = new CTreeNode(text, CTreeType.CeZhan3, station.StationID);

                    //node.SetImageIndex(14);
                    if (station.StationType == EStationType.ERainFall)
                    {
                        node.SetImageIndex(18);
                    }
                    else if (station.StationType == EStationType.ERiverWater)
                    {
                        node.SetImageIndex(20);
                    }
                    else if (station.StationType == EStationType.EHydrology)
                    {
                        node.SetImageIndex(22);
                    }
                    return node;
                }
                else
                {
                    var station = obj as CEntitySoilStation;

                    string text = string.Format("{0} ({1})", station.StationName, station.StationID);
                    var node = new CTreeNode(text, CTreeType.CeZhan3, station.StationID);

                    node.SetImageIndex(14);
                    return node;
                }

            }