首页 > 编程语言 >C# tree view节点解析数据+model、DAL、TOOl

C# tree view节点解析数据+model、DAL、TOOl

时间:2022-11-05 15:44:52浏览次数:39  
标签:string C# tree TOOl List enginneModel Add new public

EnginneModel.cs
namespace WindowsFormsApp3
{
    public class EnginneModel
    {
        public string paramsName { get; set; }

        public string paramsType { get; set; }

        public string paramsBindingData { get; set; }

    }
}

 

EnginneDAL.cs

namespace WindowsFormsApp3
{
    public class EnginneDAL
    {
        
        public List<EnginneModel> InPara = new List<EnginneModel>();
        
        public List<EnginneModel> OutPara = new List<EnginneModel>();

    }
}

 

EnginneTool.cs

namespace WindowsFormsApp3
{
    public class EnginneTool
    {
        EnginneDAL enginneDAL = new EnginneDAL();
        public void SaveData(List<string> listIn, List<string> listOut)
        {
            
            for (int i = 0; i < listIn.Count/3; i++)
            {
                EnginneModel enginneModel = new EnginneModel();
                enginneModel.paramsName = (listIn[i*3]);
                enginneModel.paramsType = (listIn[i*3+1]);
                enginneModel.paramsBindingData = (listIn[i*3+2]);
                enginneDAL.InPara.Add(enginneModel);
            }
            for (int i = 0; i < listOut.Count / 3; i++)
            {
                EnginneModel enginneModel = new EnginneModel();
                enginneModel.paramsName = (listOut[i * 3]);
                enginneModel.paramsType = (listOut[i * 3 + 1]);
                enginneModel.paramsBindingData = (listOut[i * 3 + 2]);
                enginneDAL.OutPara.Add(enginneModel);
            }
        }

        public void Run(EnginneDAL enginneDAL)
        {
            string s= enginneDAL.InPara[0].paramsBindingData;

            enginneDAL.OutPara[0].paramsName = s;
        }
    }
}

 

解析tree view函数

 /// <summary>
        /// 解析treeview数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            List<string> ListInpara = new List<string>();
            List<string> ListOutPara = new List<string>();
            List<string> ListIn = new List<string>();
            List<string> ListOut = new List<string>();
            ListInpara.Add("(Image)image:工具1-OutImage");
            ListInpara.Add("(Parameter)Max:工具2-InPara1");
            
            ListOutPara.Add("(Parameter)Area:工具2-OutPara1");

            TreeviewNameSplit(ListInpara, ref ListIn);
            TreeviewNameSplit(ListOutPara, ref ListOut);

            EnginneTool enginneTool = new EnginneTool();
            enginneTool.SaveData(ListIn, ListOut);
        }

        /// <summary>
        /// 解析方法
        /// </summary>
        /// <param name="list"></param>
        /// <param name="listPara"></param>
        public void TreeviewNameSplit(List<string> list, ref List<string> listPara)
        {
            foreach (var item in list)
            {
                string ss = item.Replace("(", "");
                string[] sType = ss.Split(')');
                listPara.Add(sType[0]);
                foreach (var item1 in sType)
                {
                    if (item1.Contains(":"))
                    {
                        string[] sName = item1.Split(':');
                        listPara.Add(sName[0]);
                        listPara.Add(sName[1]);
                    }
                }
            }
        }

 

标签:string,C#,tree,TOOl,List,enginneModel,Add,new,public
From: https://www.cnblogs.com/xiaohuzi007/p/16860320.html

相关文章

  • Linux上配置Github上git clone的python项目
    1、先在Linux安装Anaconda,可以参考这篇博客 (安装成功后,命令行开头会出现base)2、接下来gitclone+仓库地址,下载很慢或者无法下载,参考这篇博客3、进入该项目,创建虚拟环......
  • 解决react执行两遍的问题
    解决react执行两遍的问题原因使用脚手架创建项目后默认会开启严格模式,在严格模式下,React开发环境下会刻意执行两次渲染,用于突出显示应用程序中潜在问题。解决将入......
  • hyper注册到nacos
    1.HyperfRPC服务搭建 创建服务提供者composercreate-projecthyperf/hyperf-skeletonmicro_servercdmicro_server安装注册中心Nacos适配器composerrequir......
  • LeakCannary 的主要原理
    大概可以分为以下几步:((1)监测Activity的生命周期的onDestroy()的调用。(2)当某个Activity的onDestroy()调用后,便对这个activity创建一个带ReferenceQueue的......
  • 基础JUC高并发编程-尚硅谷
    JUC高并发编程B站地址:【尚硅谷】大厂必备技术之JUC并发编程_哔哩哔哩_bilibili参考笔记1:(119条消息)【尚硅谷】大厂必备技术之JUC并发编程——笔记总结_浙桐的博客-CSD......
  • tomcat部署Jenkins
    安装环境jdk1.8tomcat9.0jenkins2.290准备工作安装好Tomcat,8080端口启动安装好jdk,配置好环境变量ECS服务器步骤登录官网,选择对应版本,下载war包http://mi......
  • CH58X/CH57X/V208的Broadcaster(广播者)例程讲解
    在对ble进行应用的时候,每个用户的需求可能不尽相同。这里着重介绍从机Broadcaster例程,只广播不连接。使用该例程时可以在手机使用APP上对Broadcaster进行调试。安卓端在......
  • accoders NOI #5047. 猜数游戏 题解
    题目描述Alice和Bob玩游戏。Alice有一个\(1~n\)中的正整数\(y\)。Bob不知道这个数。游戏中的每一轮,Bob选一个正整数\(x\),并提问Alice:\(y\)是否大于等于\(x......
  • Docker部署Nginx报错 WARNING: IPv4 forwarding is disabled. Networking will not wo
    Docker部署Nginx报错WARNING:IPv4forwardingisdisabled.Networkingwillnotwork.[root@localhost~]#dockerrun--namenginx-1-p8080:80-dnginx  ......
  • CentOS 7(Linux)安装Docker
    CentOS7(Linux)安装Docker一、分别执行下列命令添加并更新yum源    yum update    yuminstallepel-release-y    yumcleanall    y......