private void InitializeData(string xmlPath)
        {
            TreeListNode node  = null;
            TreeListNode node2 = null;
            TreeListNode node3 = null;

            objChannelManager.Channels.Clear();
            objChannelManager.XmlPath = xmlPath;
            var chList = objChannelManager.GetChannels(xmlPath);

            TreeList1.Nodes.Clear();
            foreach (var ch in chList)
            {
                ////Sort.
                ch.Devices.Sort(delegate(Device x, Device y) { return(x.DeviceName.CompareTo(y.DeviceName)); });
                node = TreeList1.AppendNode(new object[] { ch.ChannelName }, null);
                node.StateImageIndex = 1;
                foreach (var dv in ch.Devices)
                {
                    node2 = TreeList1.AppendNode(new object[] { dv.DeviceName }, node);
                    node2.StateImageIndex = 0;
                    foreach (var db in dv.DataBlocks)
                    {
                        node3 = TreeList1.AppendNode(new object[] { db.DataBlockName }, node2);
                        node3.StateImageIndex = 2;
                    }
                }
            }
        }
Esempio n. 2
0
        private void InitializeData(string xmlPath)
        {
            TreeListNode node  = null;
            TreeListNode node2 = null;

            objChannelManager.Channels.Clear();
            objChannelManager.XmlPath = xmlPath;
            var chList = objChannelManager.GetChannels(xmlPath);

            TreeList1.Nodes.Clear();
            foreach (var ch in chList)
            {
                var dvList = new List <TreeNode>();
                ////Sort.
                ch.Devices.Sort(delegate(Device x, Device y) { return(x.DeviceName.CompareTo(y.DeviceName)); });
                node = TreeList1.AppendNode(new object[] { ch.ChannelName }, null);
                foreach (var dv in ch.Devices)
                {
                    var tgList = new List <TreeNode>();
                    node2 = TreeList1.AppendNode(new object[] { dv.DeviceName }, node);
                    foreach (var db in dv.DataBlocks)
                    {
                        tgList.Add(new TreeNode(db.DataBlockName));
                        TreeList1.AppendNode(new object[] { db.DataBlockName }, node2).StateImageIndex = 2;
                    }

                    var dvNode = new TreeNode(dv.DeviceName, tgList.ToArray());
                }

                var chNode = new TreeNode(ch.ChannelName, dvList.ToArray());
            }
        }
Esempio n. 3
0
        private void frmBackOffice_Load(object sender, EventArgs e)
        {
            SkinHelper.InitSkinPopupMenu(iPaintStyle);
            Settings.tabbedView = tabbedView;
            // --------------------------------------
            Settings.LoadControl(new uDashboard());
            ///--------------------------------------


            TreeList1.KeyFieldName = "FormID"; TreeList1.ParentFieldName = "Perant_FormID";
            TreeList1.DataSource   = db.LKUPMainTrees.OrderBy(c => c.indexSort).ToList();
            TreeList1.ExpandToLevel(0);
        }
Esempio n. 4
0
        public void FillTree(string Find = "")
        {
            if (CheckEdit1.Checked == true)
            {
                TreeList1.Nodes.Clear();
                TreeList1.BeginUnboundLoad();

                Setings.View();
                if (Convert.ToBoolean(Setings.GetFiled("BasicDataNo")))
                {
                    Sql = ("Select Code , CONVERT(INT,code)  T_Code , Name,Main , MainNo From " + MasterTable + ((MasterWhere + "".Trim() != "") ? " Where " + MasterWhere : " order by CONVERT(INT, Code) "));
                }
                else
                {
                    Sql = ("Select Code , Code T_Code,Name, Main,MainNo  From " + MasterTable + ((MasterWhere + "".Trim() != "") ? " Where " + MasterWhere : " order by Code"));
                }

                DataTable DT = new DataTable();

                try
                { Settings.DR.Close(); }
                catch (Exception) { }

                TreeList1.SelectImageList = ImageList1;

                Settings.CMD.CommandText = Sql;
                try
                {
                    Settings.DR = Settings.CMD.ExecuteReader();
                    DT.Load(Settings.DR);

                    TreeList1.DataSource      = DT;
                    TreeList1.KeyFieldName    = "Code";
                    TreeList1.ParentFieldName = "MainNo";
                }
                catch (Exception)
                {
                    if (Convert.ToBoolean(Setings.GetFiled("BasicDataNo")))
                    {
                        Settings.CMD.CommandText = "Select CONVERT(INT,Code ) code,CONVERT(INT,code ) T_Code,Name From " + MasterTable + " order by CONVERT(INT,code )";
                    }
                    else
                    {
                        Settings.CMD.CommandText = "Select Code , code T_Code,Name From " + MasterTable + " order by code  ";
                    }


                    Settings.DR = Settings.CMD.ExecuteReader();
                    int x = 0;
                    while (Settings.DR.Read())
                    {
                        TreeListNode P     = null;
                        TreeListNode xNode = TreeList1.AppendNode(new object(), P);
                        xNode.SetValue(0, Settings.DR["Code"]);
                        xNode.SetValue(1, Settings.DR["Name"]);
                        x++;
                    }
                }
                TreeList1.EndUnboundLoad();
            }
            else
            {
                TreeList1.Nodes.Clear();
            }



            if (Find.Trim() != "")
            {
                TreeList1.FocusedNode = TreeList1.FindNodeByFieldValue("Code", Find);
                //var node = TreeList1.FindNodeByFieldValue("T_Code",Find );
                //  if (node != null)
                //  {
                //      node.Expanded = true;
                //      node.Visible = true;
                //      TreeList1.FocusedNode = node;
                //  }
            }
        }